mirror of
https://github.com/django/django.git
synced 2025-11-01 20:31:40 +00:00
Fixed #20228 - Documented unique_for_date and exclude behavior.
Thanks Deepak Thukral for the patch.
This commit is contained in:
parent
8365d76da0
commit
d321d1acf0
3 changed files with 41 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue