Included Proxy models in example app.

fix_request_path_info
Diederik van der Boor 2013-04-07 22:16:41 +02:00
parent 54cf2f37d8
commit a0ab068449
2 changed files with 35 additions and 0 deletions

View File

@ -61,3 +61,15 @@ if 'UUIDModelA' in globals():
admin.site.register(UUIDModelA, UUIDModelAAdmin) admin.site.register(UUIDModelA, UUIDModelAAdmin)
class ProxyChildAdmin(PolymorphicChildModelAdmin):
base_model = ProxyBase
class ProxyAdmin(PolymorphicParentModelAdmin):
base_model = ProxyBase
child_models = (
(ProxyA, ProxyChildAdmin),
(ProxyB, ProxyChildAdmin),
)
admin.site.register(ProxyBase, ProxyAdmin)

View File

@ -47,3 +47,26 @@ if 'UUIDField' in globals():
field2 = models.CharField(max_length=10) field2 = models.CharField(max_length=10)
class UUIDModelC(UUIDModelB): class UUIDModelC(UUIDModelB):
field3 = models.CharField(max_length=10) field3 = models.CharField(max_length=10)
class ProxyBase(PolymorphicModel):
title = models.CharField(max_length=200)
def __unicode__(self):
return u"<ProxyBase[type={0}]: {1}>".format(self.polymorphic_ctype, self.title)
class Meta:
ordering = ('title',)
class ProxyA(ProxyBase):
class Meta:
proxy = True
def __unicode__(self):
return u"<ProxyA: {0}>".format(self.title)
class ProxyB(ProxyBase):
class Meta:
proxy = True
def __unicode__(self):
return u"<ProxyB: {0}>".format(self.title)