I came up against this also. My work-around was to create a model that exists explicitly for the purpose of generating sequential integers (I also need them to be unique, so it's acceptable for my purposes). You might like to have two fields to accomplish the same thing with duplicates (which I admit is less than ideal).
On Mon, Apr 16, 2012 at 16:17, Roy Smith <r...@panix.com> wrote: > I need an integer field which generates increasing integers. But I don't > want it to be my primary key. In fact, it can't be, because I want the > ability to manually reset it to something else. The auto-increment is just > a default value. > > If I do: > > > class Image(Model): > > serial = AutoField() > > I get an error when I do syncdb or schemamigration: > > > AssertionError: AutoFields must have primary_key=True. > > Is this a bug? > > --- > Roy Smith > r...@panix.com > > -- > 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. > > -- Marcin Tustin Tel: 07773 787 105 -- 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.