Django tutorial, cannot add "polls" to admin

31 views
Skip to first unread message

Ser5

unread,
Oct 6, 2011, 2:44:59 PM10/6/11
to django...@googlegroups.com
Hi! Help me please to solve one tutorial problem.

Now I'm reading the 2nd part of the tutorial and have stuck with adding polls app to the Django admin.
Everything worked fine in the tutorial until I reached "Make the poll app modifiable in the admin" part.

Here is the link to the tutorial page I'm currently at:
https://docs.djangoproject.com/en/1.3/intro/tutorial02/

I have already added admin.py file and now have mysite/polls directory with the following content:
Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        06.10.2011     23:54         94 admin.py
-a---        07.10.2011      0:21        609 models.py
-a---        06.10.2011     23:39       1478 models.pyc
-a---        06.10.2011     23:13        399 tests.py
-a---        06.10.2011     23:13         27 views.py
-a---        06.10.2011     23:13          0 __init__.py
-a---        06.10.2011     23:19        150 __init__.pyc

admin.py contains this:
-----------------------
from polls.models import Poll
from django.contrib import admin

admin.site.register(Poll)
-----------------------


If this can help, models.py have this content:
-----------------------
from django.db import models
import datetime



class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')
   
    def __unicode__(self):
        return self.question
   
    def was_published_today(self):
        return self.pub_date.date() == datetime.date.today()
   

   
class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()
   
    def __unicode__(self):
        return self.choice
-----------------------



I restarted the Django development server several times.
And I'm looking here http://127.0.0.1:8000/admin/ for the "poll" app to appear. But it doesn't =( Still only "Auth" and "Sites" here.

Tell me please - did I miss something? Or did the tutorial miss something?

Yaşar Arabacı

unread,
Oct 6, 2011, 4:45:15 PM10/6/11
to django...@googlegroups.com
How does your urls.py look like? Did you uncomment admin related things in there?

2011/10/6 Ser5 <ser5...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/c0WVz5UjgFUJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
http://yasar.serveblog.net/

Ser5

unread,
Oct 6, 2011, 5:07:56 PM10/6/11
to django...@googlegroups.com
Ahhh, after heavy digging of the internet and gazing at example app "django-registration" I discovered that I have missed one thing - I didn't include "polls" in INSTALLED_APPS. After adding it I finally got "Polls" in the Django admin.

But anyway, thank you for trying to help me =)

Seems like that my problem is solved now and I'm ready to meet next ones =)

Reply all
Reply to author
Forward
0 new messages