Tuesday, January 17, 2017

Re: Creating a sample poll app 2

Because you need to import the Question model from the models.py file before you can register it in the admin. "from .models import X" means "import X from the file models which is in the same directory as the current file".


On Tuesday, January 17, 2017 at 3:18:47 PM UTC+1, Rachit Tibrewal wrote:
Why is '.models' in the documentation?
##polls/admin.py
from django.contrib import admin

from .models import Question

admin.site.register(Question)

--
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/dc818be1-8a20-46f5-9661-0cfb2585a763%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment