aboutsummaryrefslogtreecommitdiffstats
path: root/examples/modelresourceexample/models.py
diff options
context:
space:
mode:
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()