As I saw earlier, Django does not allow you to have two rows as autofield,
you can make your own save method for model. Ex. get first of
YourModel.objects invert sorted by wanted field, add to it's value 1 and
save

ср, 17 жовт. 2018, 08:55 користувач Rakhee Menon <menonrakhe...@gmail.com>
пише:

> Hi Everyone,
>
> I have a scenario where one field needs to be a primary key and another
> field needs to be an AutoField....and Autofield requires a condition
> primary_key = true
>
> I get this error
> django_reports.MstCompositionFm.makeid: (fields.E100) AutoFields must set
> primary_key=True.
> django_reports.MstSalarystructure: (models.E026) The model cannot have
> more than one field with 'primary_key=True'
>
> This is my case:
>
> icatid = models.BigIntegerField(db_column='ICatID', primary_key=True)
> makedate = models.DateTimeField(db_column='MakeDate')
> revdate = models.DateTimeField(db_column='RevDate', blank=True, null=True)
>
> makeid = models.BigAutoField(db_column='MakeId', primary_key=False)
>
> It would be of great help if anyone could figure out whats the solution
>
> Thanks in Advance,
> Rakhee
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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/341d511d-3c95-42b9-a22f-a5fa0c331da5%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/341d511d-3c95-42b9-a22f-a5fa0c331da5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CAEDge_zCsWNNwjWRYLvzRKdGmr2iKvn2UBmpQEg2kebyg3pyKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to