1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #20228 - Documented unique_for_date and exclude behavior.

Thanks Deepak Thukral for the patch.
This commit is contained in:
Tim Graham
2013-05-28 09:56:14 -04:00
parent 8365d76da0
commit d321d1acf0
3 changed files with 41 additions and 3 deletions

View File

@@ -207,7 +207,17 @@ class Post(models.Model):
posted = models.DateField()
def __str__(self):
return self.name
return self.title
@python_2_unicode_compatible
class DateTimePost(models.Model):
title = models.CharField(max_length=50, unique_for_date='posted', blank=True)
slug = models.CharField(max_length=50, unique_for_year='posted', blank=True)
subtitle = models.CharField(max_length=50, unique_for_month='posted', blank=True)
posted = models.DateTimeField(editable=False)
def __str__(self):
return self.title
class DerivedPost(Post):
pass