I'm new in django, I want to create custom Cart number that starts with #. When a new record comes into database. #1-1000, #1-1001, #1-9999, .... #2-1000, ...#2-9999 etc.
This is my model
class Cart(models.Model):
# id = models.CharField(primary_key=True, editable=False, max_length=10)
user = models.ForeignKey(Customer, on_delete=models.CASCADE, related_name="cart")
create_date = models.DateField(auto_now_add=True)
cart_number = models.CharField(max_length=500, default=increment_cart_number, null=True, blank=True)
total_summa = models.FloatField()
time = models.TimeField(auto_now_add=True)
The cart_number
will be always in range 1000- 9999 so how can I do that with increment_cart_number
function?