mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[1.6.x] Fixed #17519 -- Fixed missing SQL constraints to proxy models.
Thanks thibaultj for the report, jenh for the patch,
and charettes for the tests.
Backport of aa830009de from master
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