List Info

Thread: app specific admin changes




app specific admin changes
user name
2006-07-30 21:59:08
Hi All,

I am relatively new to Django, but I am enjoying trying to
get my  
first application working.

My question today is about application specific changes to
the  
Admin.  For instance, my project is full of little test
applications  
(blog1, blog2, places, events).

I would like the "branding" at the top of each
of the change-list and  
edit pages to go along with each app - in other words, at
the top of  
the blog1 posts change-list page I would like it to say
"Blog1  
Administration" and at the top of the places
change-list page I would  
like it to say "Places Administration" and so
forth.

I think that what I need to do is to make a copy of the  
base_site.html file in the contrib/admin/templates/admin
directory  
and make my changes to it.  My problem is where to save the
file.

My directory structure looks like this:

project dir
	settings.py
	urls.py
	blog1 dir
		models.py
		urls.py
		views.py
		templates dir
			blog1_base.html
			blog1 dir
				other templates for blog1
			admin dir
				base_site.html
	places dir
		models.py
		urls.py
		views.py
		templates dir
			places_base.html
			places dir
				other templates for places
			admin dir
				base_site.html


My problem is that if I edit the base_site.html files in my 

directories above, the changes seem to be universal, and
which one  
gets used depends on the order of the directories that I
list in the  
settings file (in TEMPLATE_DIRS)

Where/how should I position the base_site.html files so that
only the  
application they pertain to will use them?

(Obviously I got this idea from part 2 of the tutorial, but
that  
seems to cover only making project-wide changes to the
admin, I am  
looking to make application specific changes.  I've
searched the  
documentation, but I didn't find anything.  But if I've
missed  
something, please point me to the right place.)

Thanks!

Tamara

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

app specific admin changes
user name
2006-07-30 23:35:21
On 7/30/06, Tamara D. Snyder <tsnyderuark.edu> wrote:
> I think that what I need to do is to make a copy of the
> base_site.html file in the
contrib/admin/templates/admin directory
> and make my changes to it.  My problem is where to save
the file.

Where you save the file will make all the difference,
because the
admin follows a simple set of rules for determining which
template it
will use.

For example, the template which shows an individual object
and lets
you edit it is called 'change_form.html'. Assuming an
application
called "blog" and a model called
"Entry", the admin will load that
template by looking for the following files, in the
following order:

blog/entry/change_form.html
blog/change_form.html
change_form.html

So, depending on where you save your template, you can
override for a
specific mode, or for all models in an application, without
affecting
anything else (if you saved a template at
"blog/change_form.html", for
example, applications other than "blog" would
still use the default
one).


-- 
"May the forces of evil become confused on the way to
your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

app specific admin changes
user name
2006-07-31 01:35:32
This is what I thought, but where do I put these files? 
Directly in  
my project directory?  In a project/templates/admin
directory?   
Directly in my application directory?  In my
application/templates  
directory?  In an application/templates/admin directory? In
an  
application/templates/application/admin directory?

I have tried:
	project/application/templates/admin - this only works for
the top  
listing in TEMPLATE_DIRS in the settings file, and it works
for all  
applications
	project/application/templates/admin/application - doesn't
work
	project/application/templates/admin/application/model -
doesn't work
	project/templates/admin/application - doesn't work
	project/templates/admin/application/model - doesn't work

I guess I just don't know where to put it, in the grand
scheme of  
things.

Thanks for the help!

On Jul 30, 2006, at 6:35 PM, James Bennett wrote:

>
> On 7/30/06, Tamara D. Snyder <tsnyderuark.edu> wrote:
>> I think that what I need to do is to make a copy of
the
>> base_site.html file in the
contrib/admin/templates/admin directory
>> and make my changes to it.  My problem is where to
save the file.
>
> Where you save the file will make all the difference,
because the
> admin follows a simple set of rules for determining
which template it
> will use.
>
> For example, the template which shows an individual
object and lets
> you edit it is called 'change_form.html'. Assuming an
application
> called "blog" and a model called
"Entry", the admin will load that
> template by looking for the following files, in the
following order:
>
> blog/entry/change_form.html
> blog/change_form.html
> change_form.html
>
> So, depending on where you save your template, you can
override for a
> specific mode, or for all models in an application,
without affecting
> anything else (if you saved a template at
"blog/change_form.html", for
> example, applications other than "blog"
would still use the default
> one).
>
>
> -- 
> "May the forces of evil become confused on the
way to your house."
>   -- George Carlin
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )