Ramdas S wrote:

I got this model

class billnumber(models.Model):
    date = models.DateTimeField(auto_now_add=True, primary_key = True)
    def __str__(self):
        return self.id
    class Admin:
        pass
    class Meta:
        ordering = ['-date',]

Trying to populate the table using Admin....

This is throwing up an error.

Exception Type: IndexError  Exception Value: list index out of rangeException
Location: /usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py
in render_change_form, line 196

What I am I doing wrong. I think this is a bug. Is there a work around

Thanks

Ramdas

Since you've set date to be the primary key, Django doesn't add the id
column which you reference in the __str__ method. Either change that to
self.date, or remove the primary_key=True from the date field
definition.

See
http://www.djangoproject.com/documentation/model_api/#automatic-primary-key-fields

--
DR.


--~--~---------~--~----~------------~-------~--~----~
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