Question about makemigrations

16 views
Skip to first unread message

Martin Kong

unread,
Jun 21, 2019, 7:25:33 AM6/21/19
to django...@googlegroups.com
Hello 
I am new to django, and i am following the tutorial provide in github, from the tutorial.

and  start from 227, it shows the following instructions:

.. console::
$ python manage.py makemigrations polls
You should see something similar to the following:
.. code-block:: text
Migrations for 'polls':
polls/migrations/0001_initial.py:
- Create model Choice
- Create model Question
- Add field question to choice
However, after following the steps 
I'm missing the last sentence (Add field question to choice) .

The below is what i had written in model.py, did i make something wrong?

Thanks
from django.db import models

class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)Thanks

Sebastian Jung

unread,
Jun 21, 2019, 7:46:16 AM6/21/19
to django...@googlegroups.com
Hello,

Do you make python3 manage.py migrate after makemigrations?

Regards

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADEd1fars051JXymX0sbktNqKYak%2Bejv9uc2fGxxxbJe2Cnp1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Martin Kong

unread,
Jun 21, 2019, 7:50:18 AM6/21/19
to django...@googlegroups.com
Hello 

I make python manage.py migrate instead,but that should be the next step tho

Regards 
Martin

Rob W

unread,
Jun 21, 2019, 7:54:00 AM6/21/19
to django...@googlegroups.com
"Migrate is basically the old syncdb but it takes into account all the migrations made by makemigrations. You should run the command -migrate- after adding a new app under the INSTALLED APPS section in the settings.py file in order to synchronize the database state with your current set of models.”



Reply all
Reply to author
Forward
0 new messages