AutoField

22 views
Skip to first unread message

Saeed Pooladzadeh

unread,
May 27, 2019, 12:15:12 AM5/27/19
to Django users

Hi

When I add this line in my model:

eid=models.AutoField()

I see error in my migration!!

What is the problem?

Bob Gailer

unread,
May 27, 2019, 1:05:29 AM5/27/19
to Django users

> I don't know what your problem is but our problem is that we have no idea what error you got. Please copy and paste the entire error message into your reply and also reply all so that everyone gets to read your response stop

Andrew C.

unread,
May 27, 2019, 1:10:19 AM5/27/19
to django...@googlegroups.com
Probably because you have two AutoFields. You can’t have two in the same model. Set this to eid=models.AutoField(primary_key=True)

This is because Django models automatically makes an id autofield primary key if nothing else is set as pk.

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP1rxO7ROcWYL9LYO4XMt8_gHmgd74gMJ%3D0yo2pjdegkNekZfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Saeed Pooladzadeh

unread,
May 27, 2019, 4:30:43 AM5/27/19
to Django users

But I have just one AutoField()!!!
در دوشنبه 27 مهٔ 2019، ساعت 5:40:19 (UTC+4:30)، Yoo نوشته:
Probably because you have two AutoFields. You can’t have two in the same model. Set this to eid=models.AutoField(primary_key=True)

This is because Django models automatically makes an id autofield primary key if nothing else is set as pk.
On Sun, May 26, 2019 at 9:05 PM Bob Gailer <bga...@gmail.com> wrote:

On May 26, 2019 8:16 PM, "Saeed Pooladzadeh" <ling...@gmail.com> wrote:
>
>
> Hi
>
> When I add this line in my model:
>
> eid=models.AutoField()
>
> I see error in my migration!!
>
> What is the problem?
>
> I don't know what your problem is but our problem is that we have no idea what error you got. Please copy and paste the entire error message into your reply and also reply all so that everyone gets to read your response stop

--
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...@googlegroups.com.

ramadhan ngallen

unread,
May 27, 2019, 1:35:00 PM5/27/19
to Django users
By Default each model in django has one primary key (id) which is also auto filled. If you don't want to use django's autofilled primary key, you suppose to make custom primary key
 You may use the link below

Best Regards

Ramadhan Ngallen
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages