Friday, April 29, 2011

Re: .save() works with no (custom, not 'id') primary key specified?

I think because the primary_key field auto defaults to be auto-inc?

On Fri, Apr 29, 2011 at 5:47 PM, Jeff Blaine <cjblaine@gmail.com> wrote:
How is this possible based on the model below?

d = Device()
d.save()
# no errors

class Device(models.Model):

    propertyno      = models.CharField('Property Number',
                                       max_length=10,
                                       primary_key=True)

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

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

No comments:

Post a Comment