I’ve got a model that looks like
class order(models.Model):
user = models.ForeignKey(some_user)
number = models.PositiveIntegerField()
number is supposed to be an incremented (+1) amount based on the total number of existing orders for a user. I’ve looked into F() objects before but from what I can gather they can only be used for updating a field thats pre-existing. Is there a way to increment that the number by 1 without having a to worry about two orders have the same number?
Seeing as Django doesn’t support creating atomic sequences, my conclusion is to use Redis for atomic counting and just query that in order to get the latest order value.