我想区分一些本地数据和远程数据..所以我想让本地数据的主键类似于:local_1,local_2...等。
我的模型是:
class coupon(models.Model):
success = models.IntegerField() # Count of the number of times people have made it work
failure = models.IntegerField() # Count of the number of times this has failed
couponDescription = models.TextField() # Coupon Description
active = models.BooleanField(default=True)
couponCode = models.CharField(max_length=30)
couponStore = models.CharField(max_length=30) # Store Name
featured = models.BooleanField(default=False)
couponTitle = models.CharField(max_length=100) # Coupon Title
updatedAt = models.DateTimeField(auto_now=True)
createdAt = models.DateTimeField(auto_now=True)
lastTested = models.DateField(auto_now_add=True) # When was the coupon last tested
localCouponId = models.CharField(max_length=30,primary_key=True)
那么我如何使用与...1,2,3,4....等整数连接localCouponId
的字符串进行自动递增。local_