On Jun 21, 2019, at 7:49 AM, Martin Kong <cok898@gmail.com> wrote:HelloI make python manage.py migrate instead,but that should be the next step thoRegardsMartinOn Fri, 21 Jun 2019 at 7:45 PM, Sebastian Jung <sebastian.jung2@gmail.com> wrote:Hello,Do you make python3 manage.py migrate after makemigrations?RegardsMartin Kong <cok898@gmail.com> schrieb am Fr., 21. Juni 2019, 13:25:HelloI am new to django, and i am following the tutorial provide in github, from the tutorial.The tutorial I am following is https://github.com/django/django/blob/master/docs/intro/tutorial02.txtand 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 stepsI'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?Thanksfrom 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--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAKGT9mw6VfP_Ftrsz8iAGtXQ3mDXfeOgOxz7MfuYvejTNko8Gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CADEd1fZCnF4B%3DqNB14jqzW16pZ8BqFfMqr4PJBuy_BiwxTpxgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Friday, June 21, 2019
Re: Question about makemigrations
"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."
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment