Hi Stephen;

On Thu, May 7, 2009 at 8:36 AM, Stephen Cheng <[email protected]>wrote:

>
> I have thought this for quite a while and no idea so far. I like the
> forms/pages auto generated by Admin engine, but I also want to
> incorporate some of the forms/pages into my site with following
> expectations:
>
> 1. I can use my own template.

There is an entire section in the docs dedicated to overriding the default
templates.
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates


>
> 2. use my own template and also use the context variables from my apps

I would recommend using template tags to accomplish this. You could do it at
the view level or the context processor level, but I think that would be
more difficult.


>
> 3. possibly use nicer url instead of auto url
>

With the urls, you have a few options, and I have never needed to do this,
but if I did, I would probably look into the ABSOLUTE_URL_OVERRIDES setting.
Janis Leidel has a good write up here:
http://jannisleidel.com/2008/08/easy-overrides-absolute-urls-reusable-apps/.
Another way you can do this is by looking at the code in
django.contrib.admin.sites.site. There is a function names get_urls in 1.1
(now in Beta) that is assigned to the property urls. You could overide this
and create a a custom subclass admin that would have your custom urls. There
are probably a few gotchas in there, because the views in the sites require
all of the information that is passes in the auto url, so you would have to
make sure the signature is the same or the views are different, in which
case you are essentially just writing your own admin.

>
> Any thought? or this is silly?


The templating overiding will be extremely easy. Changing the URLs is going
to be an adventure. I don't really see the point, but I don't know your
project either. If you have the time, go for it! If your successful, a write
up or blog post about how you did it would be a very interesting read.

Good luck and I hope this helps,

Michael

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to