All,
Currently I'm working with the following 2 models:
class A (models.Model):
...
class B (A):
somefield = ...
I have a generic views with querysets defined as:
url(r"A/view/(?P<object_id>\d+)/$",
"django.views.generic.list_detail.object_detail", dict(queryset =
A.objects.all(), template_name = "views/view-A.template",
template_object_name = "A"), name = "view_A"),
url(r"A/list/$", "django.views.generic.list_detail.object_list",
dict(queryset = A.objects.all(), template_name = "lists/list-
As.template", template_object_name = "A", paginate_by = 20), name =
"list_As"),
I have a pair of templates that view individual, and list, A objects.
Should a B object be in the queryset results, I'm rendering additional
template content (B.somefield).
Currently, I'm accomplishing this with a template tag:
@register.filter
def A_get_B(instance):
if isinstance(instance, B):
return instance.b
try:
return event.userevent.user
except UserEvent.DoesNotExist:
return None
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.