Creating a sample poll app 2

23 views
Skip to first unread message

Rachit Tibrewal

unread,
Jan 17, 2017, 9:18:47 AM1/17/17
to Django users
Why is '.models' in the documentation?
##polls/admin.py
from django.contrib import admin

from .models import Question

admin.site.register(Question)

jorr...@gmail.com

unread,
Jan 17, 2017, 12:00:40 PM1/17/17
to Django users
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".
Reply all
Reply to author
Forward
0 new messages