class Customer(models.Model):
user = models.OneToOneField(User,on_delete=models.CASCADE,blank=True,null=True)
activate_token = models.CharField(max_length=200,default=str(uuid.uuid4()))
forget_password_token = models.CharField(max_length=200,default=str(uuid.uuid4()))
first_name = models.CharField(max_length=100,blank=True,null=True)
last_name = models.CharField(max_length=100,blank=True,null=True)
status = models.CharField(max_length=100,blank=True,null=True)
email = models.CharField(max_length=100,blank=True,null=True)
gender = models.CharField(max_length=50,blank=True,null=True)
city = models.CharField(max_length=100,blank=True,null=True)
country = models.CharField(max_length=100,blank=True,null=True)
Accounts\migrations\0010_alter_customer_activate_token_and_more.py
- Alter field activate_token on customer
- Alter field forget_password_token on customer
Migrations for 'Store':
Store\migrations\0004_product_shipping_charges_alter_product_price.py
- Add field shipping_charges to product
- Alter field price on product
I have a model of customer i am storeing two things there one is user activation token and the other is forgot password token i want it random so i used uuid but when ever i am running migrate this migration always happening by the way i am not facing any functional error everything working fine but i have a feeling it might give me a error
CodePudding user response:
Just replace the uuid4 function call with the callable (that is, without brackets) and Django will know that the uuid is meant to remain constant.
forget_password_token = models.CharField(max_length=200,default=str(uuid.uuid4))