diff options
| author | markotibold | 2011-03-06 13:26:19 +0100 | 
|---|---|---|
| committer | markotibold | 2011-03-06 13:26:19 +0100 | 
| commit | 177e666fc2b2781fde35dca72dbf1b3710213706 (patch) | |
| tree | ce714aabc1cdc246f3b5c4ca6365d6529b93361a /examples | |
| parent | bba89cbcf13d35e32efd2035258063e7f0967e0d (diff) | |
| download | django-rest-framework-177e666fc2b2781fde35dca72dbf1b3710213706.tar.bz2 | |
BlogPosts > 10 rotation implemeneted
Latest Modelresource example is broken. Required attribute should be set to form, not model. Is fixed.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/blogpost/models.py | 3 | ||||
| -rw-r--r-- | examples/modelresourceexample/models.py | 2 | ||||
| -rw-r--r-- | examples/resourceexample/forms.py | 2 | 
3 files changed, 5 insertions, 2 deletions
diff --git a/examples/blogpost/models.py b/examples/blogpost/models.py index ba7810dc..03de1f00 100644 --- a/examples/blogpost/models.py +++ b/examples/blogpost/models.py @@ -38,6 +38,9 @@ class BlogPost(models.Model):      def save(self, *args, **kwargs):          self.slug = slugify(self.title)          super(self.__class__, self).save(*args, **kwargs) +        for obj in self.__class__.objects.order_by('-pk')[10:]: +            obj.delete() +  class Comment(models.Model): diff --git a/examples/modelresourceexample/models.py b/examples/modelresourceexample/models.py index c235d7b3..16047524 100644 --- a/examples/modelresourceexample/models.py +++ b/examples/modelresourceexample/models.py @@ -3,7 +3,7 @@ from django.db import models  MAX_INSTANCES = 10  class MyModel(models.Model): -    foo = models.BooleanField(required=False) +    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) diff --git a/examples/resourceexample/forms.py b/examples/resourceexample/forms.py index e484afba..aa6e7685 100644 --- a/examples/resourceexample/forms.py +++ b/examples/resourceexample/forms.py @@ -1,6 +1,6 @@  from django import forms  class MyForm(forms.Form): -    foo = forms.BooleanField() +    foo = forms.BooleanField(required=False)      bar = forms.IntegerField(help_text='Must be an integer.')      baz = forms.CharField(max_length=32, help_text='Free text.  Max length 32 chars.')  | 
