Re: Using Primary key in two fields

2018-10-20 Thread Vishvajit Pathak
Hi Rakhee, Could you try following ? : icatid = models.BigIntegerField(db_column='ICatID') makedate = models.DateTimeField(db_column='MakeDate') revdate = models.DateTimeField(db_column='RevDate', blank=True, null=True) makeid = models.BigAutoField(db_column='MakeId') class Meta: unique_togeth

Re: Using Primary key in two fields

2018-10-17 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Tue, Oct 16, 2018 at 10:55:48PM -0700, Rakhee Menon wrote: > Hi Everyone, > > I have a scenario where one field needs to be a primary key and another > field needs to be an AutoFieldand Autofield requires a condition > primary_key = true >

Re: Using Primary key in two fields

2018-10-17 Thread Ігор Магур
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 пише: > Hi Everyone, > > I have

Using Primary key in two fields

2018-10-16 Thread Rakhee Menon
Hi Everyone, I have a scenario where one field needs to be a primary key and another field needs to be an AutoFieldand Autofield requires a condition primary_key = true I get this error django_reports.MstCompositionFm.makeid: (fields.E100) AutoFields must set primary_key=True. django_repo