
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.72 KB | hits: 21 | expires: Never
Is there a proper way of ensuring only one user at a time makes changes to an object with REST HTTP?
# the Django model
class Thing(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
# the Tastypie Resource
class ThingResource(ModelResource):
class Meta:
queryset = Thing.objects.all()
#1 User 1: Opens app viewing Thing #1 with name = "my name", description = "my description"
#2 User 2: Opens app viewing Thing #1 (same state as User 1)
#3 User 2: Changes description of Thing #1 to "something"
#4 User 1: Changes name of Thing #1 to "some other name"
If-Unmodified-Since: <date-noted-from-initial-GET>
If-Match: <etag-noted-from-initial-GET>