Using Django revision 1011, I defined an app called "audit". I defined
a model for that app as follows:

class StatusType(meta.Model):
    description = meta.CharField(maxlength=100)

...I tried testing it like this:

>>> from django.models.audit import *
>>> s = statustypes.StatusType()
>>> s.description = "foo"
>>> s.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/<user>/django/trunk/django/utils/functional.py", line 3,
in _curried
    return args[0](*(args[1:]+moreargs), **dict(kwargs.items() +
morekwargs.items()))
  File "/home/<user>/django/trunk/django/core/meta/__init__.py", line
783, in method_save
    pk_val = getattr(self, opts.pk.column)
AttributeError: 'StatusType' object has no attribute 'id'

...given that I'm running on PostgreSQL and that the "id" field is
automatically created as a serial object and a primary key by Django, I
would expect it to be auto-populated at some point during or before the
call to "save()". I can define "id" by hand, but then that defeats the
whole point of having a serial object (which Django created on my
behalf in the first place). Is this a bug? Have I done something wrong?

TIA,
Pete

Reply via email to