mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user