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 https://docs.djangoproject.com/en/2.2/topics/db/models/
Best Regards Ramadhan Ngallen On 27 May 2019, 07:30 +0300, Saeed Pooladzadeh <[email protected]>, wrote: > > 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 <[email protected]> wrote: > > > > On May 26, 2019 8:16 PM, "Saeed Pooladzadeh" <[email protected]> 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 [email protected]. > > > > To post to this group, send email to [email protected]. > > > > 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. > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/f4ee9408-064c-4720-9b66-19f00651836b%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. 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/43189e74-13b7-417c-8a07-17f6f7adb237%40Spark. For more options, visit https://groups.google.com/d/optout.

