Google Groups Home
Help | Sign in
Easy customizing of admin subsections?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Jaanus  
View profile
 More options Dec 4 2005, 4:22 am
From: "Jaanus" <jaa...@gmail.com>
Date: Sun, 04 Dec 2005 01:22:16 -0800
Local: Sun, Dec 4 2005 4:22 am
Subject: Easy customizing of admin subsections?
Hi,

Django is cool :-) Im currently looking at it to possibly use it in
several high-profile initiatives. So far so good.

One thing I came across is a question of whether I can easily customize
subsections of admin. Now the tutorials explain it nicely about
admin_base, but Id need to be more granular - lets say I have an app
for managing some assets, and one view of that app is downloading full
statistics in CSV format. Now I have created a view to output the CSV,
but Id like to link to it from the appropriate place in the admin. Lets
say in the view where I see all the objects of the app.

I took a look at admin.views.main and in change_list, I can see a lot
of hardcore fiddling with raw_template going on to produce the output.
Id avoid messing with that at all costs - rather, Id like to have parts
of the admin UI more templated so that I could customize the object
list view through the template and add my link at an appropriate
location. Does that sound reasonable? Or is there any other easy way
for me to accomplish this (insert custom link at an appropriate
location in the admin), other than messing with change_list code?

--
rgds,
Jaanus


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Wittams  
View profile
 More options Dec 4 2005, 8:21 am
From: Robert Wittams <rob...@wittams.com>
Date: Sun, 04 Dec 2005 13:21:36 +0000
Local: Sun, Dec 4 2005 8:21 am
Subject: Re: Easy customizing of admin subsections?

I think you want to upgrade to trunk, where a long term effort to make
the admin very customisable has been merged.

In your case, you will be able to create a template called:

admin/<my_app>/<my_model>/change_list.html

with

{%extends "admin/change_list.html"%}
{%block search%} <a href="/admin/csv_thing/">CSV
thing</a>{{block.super}}{%endblock%}

as the content.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jaanus  
View profile
 More options Dec 4 2005, 11:32 am
From: "Jaanus" <jaa...@gmail.com>
Date: Sun, 04 Dec 2005 16:32:16 -0000
Local: Sun, Dec 4 2005 11:32 am
Subject: Re: Easy customizing of admin subsections?

Robert Wittams wrote:
> I think you want to upgrade to trunk, where a long term effort to make
> the admin very customisable has been merged.

Hey now... that was too easy! you're cheating! :D (I was indeed on .90
and trunk works as you say)

> In your case, you will be able to create a template called:

> admin/<my_app>/<my_model>/change_list.html

> with

> {%extends "admin/change_list.html"%}
> {%block search%} <a href="/admin/csv_thing/">CSV
> thing</a>{{block.super}}{%endblock%}

> as the content.

Yep, this worked, thanks, except that it was
admin/<my_model>/change_list.html (or my_app, dunno, name is the same,
anyway just one subdir needed, not one), and of course no .html
extension in "extends". Good stuff.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Wittams  
View profile
 More options Dec 4 2005, 7:36 pm
From: Robert Wittams <rob...@wittams.com>
Date: Mon, 05 Dec 2005 00:36:47 +0000
Local: Sun, Dec 4 2005 7:36 pm
Subject: Re: Easy customizing of admin subsections?

> Yep, this worked, thanks, except that it was
> admin/<my_model>/change_list.html (or my_app, dunno, name is the same,
> anyway just one subdir needed, not one),

Both should work.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tonemcd  
View profile
(1 user)  More options Dec 9 2005, 1:12 am
From: "tonemcd" <tony.mcdon...@gmail.com>
Date: Thu, 08 Dec 2005 22:12:50 -0800
Local: Fri, Dec 9 2005 1:12 am
Subject: Re: Easy customizing of admin subsections?
Whoa, this is very neat...

I see the /admin/csv_thing/ URL getting dispatched to (presumably) a
method in the target app, <my_app> - is this correct?

If so (big drum roll here), does that mean a method in my_app can get
the content of 'result_list' from change_list.html, and work on it to
produce the CSV output? This would be a big deal IMHO.

And if so, how would the result_list get passed to the method?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jaanus  
View profile
 More options Dec 11 2005, 5:27 am
From: "Jaanus" <jaa...@gmail.com>
Date: Sun, 11 Dec 2005 10:27:37 -0000
Local: Sun, Dec 11 2005 5:27 am
Subject: Re: Easy customizing of admin subsections?

> I see the /admin/csv_thing/ URL getting dispatched to (presumably) a
> method in the target app, <my_app> - is this correct?

Yes, I put it in the views of the app.

> If so (big drum roll here), does that mean a method in my_app can get
> the content of 'result_list' from change_list.html, and work on it to
> produce the CSV output? This would be a big deal IMHO.

Probably not. At least I didn't do it, I just got the data for the csv
generator using the standard get_list stuff etc, with Django it's only
a few lines anyway.

--
rgds,
Jaanus


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Wittams  
View profile
 More options Dec 11 2005, 9:44 am
From: Robert Wittams <rob...@wittams.com>
Date: Sun, 11 Dec 2005 14:44:51 +0000
Local: Sun, Dec 11 2005 9:44 am
Subject: Re: Easy customizing of admin subsections?

tonemcd wrote:
> Whoa, this is very neat...

> I see the /admin/csv_thing/ URL getting dispatched to (presumably) a
> method in the target app, <my_app> - is this correct?

> If so (big drum roll here), does that mean a method in my_app can get
> the content of 'result_list' from change_list.html, and work on it to
> produce the CSV output? This would be a big deal IMHO.

> And if so, how would the result_list get passed to the method?

The best way to do this would be to override the view function in the
url conf, and subclass ChangeList. I don't claim that that class is
particularly well designed at the present time, so it might need a bit
of thought.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google