1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #21846 -- Made NestedObjects handle related_name with %(app_label)s or %(class)s.

This commit is contained in:
Loic Bistuer
2014-01-22 00:25:33 +07:00
committed by Tim Graham
parent a5ec11c4bb
commit c3fdeb28ff
3 changed files with 32 additions and 3 deletions

View File

@@ -47,3 +47,18 @@ class Guest(models.Model):
class EventGuide(models.Model):
event = models.ForeignKey(Event, on_delete=models.DO_NOTHING)
class Vehicle(models.Model):
pass
class VehicleMixin(Vehicle):
vehicle = models.OneToOneField(Vehicle, parent_link=True, related_name='vehicle_%(app_label)s_%(class)s')
class Meta:
abstract = True
class Car(VehicleMixin):
pass