aboutsummaryrefslogtreecommitdiffstats
path: root/examples/simpleexample/models.py
diff options
context:
space:
mode:
authortom christie tom@tomchristie.com2011-01-31 08:41:21 +0000
committertom christie tom@tomchristie.com2011-01-31 08:41:21 +0000
commit9024c2e94e27aa7a40882e9beae62e0502fc2677 (patch)
tree1ceb676de4cec7c4112c1888f8d64b05a8d7960b /examples/simpleexample/models.py
parent42f2f9b40d1295e18a5b720b0d1f6ad85e928d8a (diff)
downloaddjango-rest-framework-9024c2e94e27aa7a40882e9beae62e0502fc2677.tar.bz2
Going live
Diffstat (limited to 'examples/simpleexample/models.py')
-rw-r--r--examples/simpleexample/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/simpleexample/models.py b/examples/simpleexample/models.py
index 13867f61..b628f895 100644
--- a/examples/simpleexample/models.py
+++ b/examples/simpleexample/models.py
@@ -1,6 +1,6 @@
from django.db import models
-MAX_INSTANCES = 20
+MAX_INSTANCES = 10
class MyModel(models.Model):
foo = models.BooleanField()
@@ -13,9 +13,9 @@ class MyModel(models.Model):
def save(self, *args, **kwargs):
"""For the purposes of the sandbox, limit the maximum number of stored models."""
+ super(MyModel, self).save(*args, **kwargs)
while MyModel.objects.all().count() > MAX_INSTANCES:
MyModel.objects.all()[0].delete()
- super(MyModel, self).save(*args, **kwargs)
@models.permalink
def get_absolute_url(self):