From: Morgan Packard <hellomorganpackard <at> gmail.com>
Subject: newbie -- hiccups in following tutorial
Newsgroups: gmane.comp.python.django.user
Date: 2008-07-22 09:02:56 GMT (13 hours and 48 minutes ago)

Hello all,

I'm going through the tutorial at 
http://www.djangoproject.com/documentation/tutorial01/,
and am having trouble with the second page (http://
www.djangoproject.com/documentation/tutorial01/).

The tutorial instructs me to add "admin.site.register(Poll)" to the
bottom of models.py. I've done that, and now the sever gives me the
following error:  AttributeError: 'module' object has no attribute
'site'

Everything else has worked perfectly up to this point.  This is how my
models.py looks:

============================================
from django.db import models
from django.contrib import admin
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

admin.site.register(Poll)
============================================

One possible clue is the fact that the urls.py Django generated for me
differes from the one in the tutorial. The urls.py Django gave me is
missing the following lines which are shown in the tutorial:

============================================
from django.contrib import admin
admin.autodiscover()
============================================

thanks so much!

-Morgan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to