Tuesday, October 21, 2014

Re: Using ModelForm with ID associated with PostgreSQL Sequence

Hi Néstor,

Are you using an AutoField()? It seems to me that _should_ work correctly. In any case setting editable=False should fix it.

Otherwise, would it work to put your primary key field in exclude?

class MyForm(forms.ModelForm):
    class Meta:
        model = MyModel
        exclude = ['id']

Collin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d748fdf3-0ed0-4ce6-8cd2-43d973cf7bc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment