aboutsummaryrefslogtreecommitdiffstats
path: root/examples/modelresourceexample/models.py
diff options
context:
space:
mode:
authorTom Christie2012-08-29 19:54:38 +0100
committerTom Christie2012-08-29 19:54:38 +0100
commiteea2aa04378d27d79e7aba12ce95c697148bd57e (patch)
tree4ae3c67246c45df2b90e32376a067107fda486b2 /examples/modelresourceexample/models.py
parentecd3733c5e229505baca5a870963f2dd492d6dd7 (diff)
downloaddjango-rest-framework-eea2aa04378d27d79e7aba12ce95c697148bd57e.tar.bz2
Remove examples (to be moved to a seperate project)
Diffstat (limited to 'examples/modelresourceexample/models.py')
-rw-r--r--examples/modelresourceexample/models.py18
1 files changed, 0 insertions, 18 deletions
diff --git a/examples/modelresourceexample/models.py b/examples/modelresourceexample/models.py
deleted file mode 100644
index 11f3eae2..00000000
--- a/examples/modelresourceexample/models.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from django.db import models
-
-MAX_INSTANCES = 10
-
-
-class MyModel(models.Model):
- foo = models.BooleanField()
- bar = models.IntegerField(help_text='Must be an integer.')
- baz = models.CharField(max_length=32, help_text='Free text. Max length 32 chars.')
- created = models.DateTimeField(auto_now_add=True)
-
- 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().order_by('-created')[0].delete()