django-concurrency
django-concurrency copied to clipboard
Let IntegerVersionField starts with '1'
Suppose we have a model,
class User(models.Model):
version = AutoIncVersionField()
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
name = models.CharField(max_length=255)
If we create the object using create, we are getting the expected version value(which is 1).
User.objects.create(name='name')
But instead of that if we create the model using the initializer and create it using the save() method. The version is 2.
user = User(name='name')
user.save()
IntegerVersionField is not what you are looking for. Check AutoIncVersionField. Please consider that you should not add semantic to those values and ignore them, because concurrency is a low level system that should not be exposed to the business logic.
Yes. It was a mistake while copying the code. It is AutoIncVersionField.
Agreeing to your point that - concurrency is a low level system that should not be exposed to the business logic. There is no harm in version getting initialized with 2 while creating a model with version with value 2. Thought the expected behavior of AutoIncVersionField is always to increment by 1.
yep, probably is true and I keep this issue opened as enhancement