mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #17519 -- Fixed missing SQL constraints to proxy models.
Thanks thibaultj for the report, jenh for the patch, and charettes for the tests.
This commit is contained in:
parent
31ee120787
commit
aa830009de
3 changed files with 37 additions and 11 deletions
|
@ -68,11 +68,18 @@ class Reporter(models.Model):
|
|||
return "%s %s" % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
class ReporterProxy(Reporter):
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=100)
|
||||
pub_date = models.DateField()
|
||||
reporter = models.ForeignKey(Reporter)
|
||||
reporter_proxy = models.ForeignKey(ReporterProxy, null=True,
|
||||
related_name='reporter_proxy')
|
||||
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue