On May 4, 2007, at 10:39 AM, Mark Phillips wrote:

> I am walking through the tutorial again; new machine, new issues.
>
> In Tutorial 2, when I run the server, log in, and edit the Poll by
> changing the date using the Today link and click Save, django says
> the operation was completed but the old date still appears. History
> shows the edits but Action displays "no fields were changed."
>
> I am working on OS X 10.9, python 2.4, intel based Mac.
>
> I ran validate polls, and syncdb. No errors were reported.
>
> Where should I be looking?

I am using MySQL v4.1.22 for the database. The User editor in the  
admin site works as expected, so the database is fine.

I have included the models.py below; perhaps some kind soul will spot  
my error.

Is there a link to the completed tutorial code? Maybe I can spot my  
mistake by comparing my rendition with it.

  - Mark

File models.py
============
from django.db import models
import datetime

# Create your models here.
class Poll(models.Model):
     question = models.CharField(maxlength=200)
     pub_date = models.DateTimeField('date published')
     class Admin:
         fields = (
             (None, {'fields': ('pub_date', 'question')}),
             ('Date information', {'fields': ('pub_date',),  
'classes': 'collapse'}),
             )
         list_display = ('question', 'pub_date', 'was_published_today')

     def __str__(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, edit_inline=models.TABULAR,  
num_in_admin=3)
     choice = models.CharField(maxlength=200, core=True)
     votes = models.IntegerField(core=True)

     def __str__(self):
         return self.choice

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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