On 2012-04-16, at 17:17 , Roy Smith wrote:
>> AssertionError: AutoFields must have primary_key=True.
> 
> Is this a bug?

Unlikely considering the assertion was specifically added to AutoField as part 
of a commit noting:

> Refactored the way save() works so that non-integer primary keys are
> now possible. custom_pk unit tests (from [458]) now pass. Refs #81.

There doesn't seem to be any more information than that, but a quick
search on the tracker[0] many databases seem to haveā€¦ issues with
non-key autofields (let alone multiple autofields in a single table)

So the solution would be to either use a sequences-using DB backend (aka
not MySQL unless you want to hack that horribly via a dedicated table
with an autoinc PK) and create your own sequence field (which may or may
not be easy, I don't know how complex the SQL underpinnings of a Django
model field can be), or to just do it "by hand" in your model's
overridden save.

[0] https://code.djangoproject.com/ticket/8576

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to