I've googled and looked at the docs, but haven't found anything
related to this scenario:
I got a master/detail model, defined like so:
class Master(models.Model):
title = models.CharField(max_length=100)
def details_url(self):
return '<a href="here comes the url linking to details">Details</a>'
self.content_object)
details_url.short_description = 'Link to details'
details_url.allow_tags = True
class Detail(models.Model):
master = models.ForeignKey(Master)
details = models.TextField()
They're exposed in the admin using admin.py. My question is this:
1) How can I make the details_url property in the Master-model so that
when exposed in the admin.py a user can click it and go the listing of
details and only see details related to that instance of Master-model?
2) If this can only be done using a custom view, how do I get the view
to produce a page looking like the rest of the admin? I know I can use
the same template code as the admin, but is there a faster way to
produce for instance listings like the details in my case? Generic
views/classes?
3) Adding Master to list_filter for the detailsAdmin-class is not
possible due to the amount of Master-records. Or is it ...? And even
if it was possible, how can I set filters from another page, like if I
click a link in the change_list for Master-model going to the Details
change_list, how can I set the filtering to be set to a specific
instance of a Master model?
In short; all I want is the have the change_list filtered to only show
details related to a specific master-record and reuse as much of the
admin-code/featurebase as possible.
--
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org
--
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.