diff options
| author | Tom Christie | 2011-06-15 14:09:01 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-06-15 14:09:01 +0100 |
| commit | 7dcb851c7f1e4bc01105fc5856494c196827fe2e (patch) | |
| tree | 7c0e02a8e504b66e7a33af69f8cd60ed1ad25df3 /examples/blogpost/models.py | |
| parent | 412b5fc2d54def2f2601b860b80afaa52d595e58 (diff) | |
| download | django-rest-framework-7dcb851c7f1e4bc01105fc5856494c196827fe2e.tar.bz2 | |
Allow related models to be fully serialized
Diffstat (limited to 'examples/blogpost/models.py')
| -rw-r--r-- | examples/blogpost/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/blogpost/models.py b/examples/blogpost/models.py index c4925a15..d77f530d 100644 --- a/examples/blogpost/models.py +++ b/examples/blogpost/models.py @@ -22,6 +22,9 @@ class BlogPost(models.Model): slug = models.SlugField(editable=False, default='') def save(self, *args, **kwargs): + """ + For the purposes of the sandbox, limit the maximum number of stored models. + """ self.slug = slugify(self.title) super(self.__class__, self).save(*args, **kwargs) for obj in self.__class__.objects.order_by('-created')[MAX_POSTS:]: |
