× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Storing new data in a Django Model in 3 steps

Roberto Aguilar
Jan 12, 2016
<p>When looking to add fields to an existing model, three steps are needed:</p> <ul> <li>update the model</li> <li>create a migration</li> <li>migrate the database</li> </ul> <h2> </h2> <p><span style="color:rgb(95, 99, 102)">First, find the model in your app's </span><code>models.py</code><span style="color:rgb(95, 99, 102)"> file and add the fields.  Next, create a migration with the command <code>python manage.py makemigrations &lt;app_name&gt;</code>.  Finally, migrate the database with the command <code>python manage.py migrate</code>.</span></p>
comments powered by Disqus