aboutsummaryrefslogtreecommitdiffstats
path: root/src/testapp/models.py
diff options
context:
space:
mode:
authorTom Christie2011-01-14 18:06:40 +0000
committerTom Christie2011-01-14 18:06:40 +0000
commitb0ce3f92c68b13d7f437a21bedcc95727e271860 (patch)
tree03e1feada051ea4501189fe5d7ac66fabe8e834a /src/testapp/models.py
parent764fbe335fbd8dab2b9a097a008bd80bf6582f89 (diff)
downloaddjango-rest-framework-b0ce3f92c68b13d7f437a21bedcc95727e271860.tar.bz2
Added formats, various form improvements, more refactoring/cleanup
Diffstat (limited to 'src/testapp/models.py')
-rw-r--r--src/testapp/models.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/testapp/models.py b/src/testapp/models.py
index 32d9a612..909788a3 100644
--- a/src/testapp/models.py
+++ b/src/testapp/models.py
@@ -40,8 +40,8 @@ RATING_CHOICES = ((0, 'Awful'),
class BlogPost(models.Model):
key = models.CharField(primary_key=True, max_length=64, default=uuid_str, editable=False)
- title = models.CharField(max_length=128, help_text='The article title (Required)')
- content = models.TextField(help_text='The article body (Required)')
+ title = models.CharField(max_length=128)
+ content = models.TextField()
created = models.DateTimeField(auto_now_add=True)
slug = models.SlugField(editable=False, default='')
@@ -74,11 +74,14 @@ class BlogPost(models.Model):
class Comment(models.Model):
blogpost = models.ForeignKey(BlogPost, editable=False, related_name='comments')
- username = models.CharField(max_length=128, help_text='Please enter a username (Required)')
- comment = models.TextField(help_text='Enter your comment here (Required)')
- rating = models.IntegerField(blank=True, null=True, choices=RATING_CHOICES, help_text='Please rate the blog post (Optional)')
+ username = models.CharField(max_length=128)
+ comment = models.TextField()
+ rating = models.IntegerField(blank=True, null=True, choices=RATING_CHOICES, help_text='How did you rate this post?')
created = models.DateTimeField(auto_now_add=True)
+ class Meta:
+ ordering = ('created',)
+
@models.permalink
def get_absolute_url(self):
return ('testapp.views.CommentInstance', (self.blogpost.key, self.id))
@@ -86,5 +89,6 @@ class Comment(models.Model):
@property
@models.permalink
def blogpost_url(self):
+ """Link to the blog post resource which this comment corresponds to."""
return ('testapp.views.BlogPostInstance', (self.blogpost.key,))