Den mandag den 15. februar 2016 kl. 20.02.55 UTC+1 skrev Tim Graham:
It looks like you have a Python path problem or that your project isn't structured correctly such that the model is being registered twice. Does that mean anything to you? I'm not sure if you are also new to Python or just to Django.
On Monday, February 15, 2016 at 11:16:51 AM UTC-5, Eric Livingston wrote:I have been walking through the Tutorial for Django, and upon reaching part 5 and introducing the first test case, I get this output (the directory I put the tutorial in is called 'demo')
RuntimeError: Model class demo.polls.models.Question doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
I tried adding a Meta section to the Question model, after doing some poking around in the docs.
class Question(models.Model):
question_text = models.CharField(max_length=
200) pub_date = models.DateTimeField('date published')
class Meta:
app_label='polls'
But then I get this:
RuntimeError: Conflicting 'question' models in application 'polls': <class 'polls.models.Question'> and <class 'demo.polls.models.Question'>.
What modifications would I have to make to the standard Tutorial code so the Models are correctly bound to the polls app? Do I have to add something else to the installed_apps besides 'polls.apps.PollsConfig'? That's the only thing the tutorial says to add.
Thanks,
Eric
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/c68cc42b-733c-4f2d-b65b-40d5b878f4f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment