Re: Overriding admin templates

2008-11-27 Thread Lars Stavholm

bfrederi wrote:
> It turns out I am having the same issue. I just added on batchadmin
> and I can't seem to override templates across the entire project (I
> wanted to add some JQuery to filters.html). How did you solve your
> problem?

Apologies, I don't clearly remember, but I just checked my settings.py,
and batchadmin is last in the list of installed app's, and now it works.
/L

> On Nov 3, 5:02 am, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Lars Stavholm wrote:
>>> Karen Tracey wrote:
 On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
 > wrote:
 Low Kian Seong wrote:
 >http://www.djangobook.com/en/1.0/chapter17/
 Yes, thank you, that's it.
 It worked nicely for the change_form.html example given in that
 chapter. However, for the change_list.html it still doesn't work.
 Seems to me I've hit a django bug. Anyone else?
 I just tried this, and it works for me for change_list.html. So I'm not
 sure what is going on in your case.  For me it just works, overriding
 change_list on a per-model basis using a file:
 templates/admin///change_list.html
>>> Hm, I'm using django from svn trunk revision 9208.
>>> What version are you using?
>>> /L
>> As it turns out, it was a conflict with an addon, the batchadmin addon,
>> that caused the confusion. Django truly works as advertised. My setup
>> of batchadmin however, needs more tweaking.
>>
>> Thanks for all your help.
>> /Lars
>>
 > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
 > wrote:
 >> Low Kian Seong wrote:
 >>> You are supposed to put the admin template you want to override in
 >>> your own template directory definition in settings.py
 >>> So, if you defined it as /home/stava/>>> >>> name>/template/admin/change_list.html
 >> Huh?
 >> /L
 >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
 > wrote:
  I'd like to override part of an admin change_list template.
  Reading the documentation, my understanding is that I can place
  a template in a certain place in the templates directory 
 hierarchy,
  and django will look for it and use it, i.e.:
  templates/admin/build/job/change_list.html
  ...where "build" is my application and "job" is my model class.
  The change_list.html file only contains the part I want to
 override,
  i.e. the extrahead block. It contains:
  {% extends "admin/change_list.html" %}
  {% block extrahead %}
    
  {% endblock %}
  However, this does not work for me, so I'm expecting it to be some
  mistake on my part, I just can't figure out what the mistake is.
  Now, if I put the file in ./templates/admin/build/change_list.html
  it still wont work. On the other hand, this would be overriding 
 all
  "build" application change lists, which is not what I was
 looking for.
  Only way I've found is to copy the change_list.html from the 
 django
  installation in contrib/admin/templates/admin, and then modify
 it to
  my needs, using "if" statements to figure out which application
 model
  class is being rendered, and the put the change_list.html in my
 app's
  templates/admin directory, which doesn't feel right.
  Any input appreciated
  /Lars Stavholm
> > 
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-26 Thread bfrederi

It turns out I am having the same issue. I just added on batchadmin
and I can't seem to override templates across the entire project (I
wanted to add some JQuery to filters.html). How did you solve your
problem?

On Nov 3, 5:02 am, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> Lars Stavholm wrote:
> > Karen Tracey wrote:
> >> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
> >> > wrote:
>
> >>     Low Kian Seong wrote:
> >>     >http://www.djangobook.com/en/1.0/chapter17/
>
> >>     Yes, thank you, that's it.
>
> >>     It worked nicely for the change_form.html example given in that
> >>     chapter. However, for the change_list.html it still doesn't work.
> >>     Seems to me I've hit a django bug. Anyone else?
>
> >> I just tried this, and it works for me for change_list.html. So I'm not
> >> sure what is going on in your case.  For me it just works, overriding
> >> change_list on a per-model basis using a file:
>
> >> templates/admin///change_list.html
>
> > Hm, I'm using django from svn trunk revision 9208.
> > What version are you using?
> > /L
>
> As it turns out, it was a conflict with an addon, the batchadmin addon,
> that caused the confusion. Django truly works as advertised. My setup
> of batchadmin however, needs more tweaking.
>
> Thanks for all your help.
> /Lars
>
> >>     > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
> >>     > wrote:
> >>     >> Low Kian Seong wrote:
> >>     >>> You are supposed to put the admin template you want to override in
> >>     >>> your own template directory definition in settings.py
>
> >>     >>> So, if you defined it as /home/stava/ >>     >>> name>/template/admin/change_list.html
> >>     >> Huh?
> >>     >> /L
>
> >>     >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
> >>     > wrote:
> >>      I'd like to override part of an admin change_list template.
>
> >>      Reading the documentation, my understanding is that I can place
> >>      a template in a certain place in the templates directory 
> >> hierarchy,
> >>      and django will look for it and use it, i.e.:
>
> >>      templates/admin/build/job/change_list.html
>
> >>      ...where "build" is my application and "job" is my model class.
>
> >>      The change_list.html file only contains the part I want to
> >>     override,
> >>      i.e. the extrahead block. It contains:
>
> >>      {% extends "admin/change_list.html" %}
> >>      {% block extrahead %}
> >>        
> >>      {% endblock %}
>
> >>      However, this does not work for me, so I'm expecting it to be some
> >>      mistake on my part, I just can't figure out what the mistake is.
>
> >>      Now, if I put the file in ./templates/admin/build/change_list.html
> >>      it still wont work. On the other hand, this would be overriding 
> >> all
> >>      "build" application change lists, which is not what I was
> >>     looking for.
>
> >>      Only way I've found is to copy the change_list.html from the 
> >> django
> >>      installation in contrib/admin/templates/admin, and then modify
> >>     it to
> >>      my needs, using "if" statements to figure out which application
> >>     model
> >>      class is being rendered, and the put the change_list.html in my
> >>     app's
> >>      templates/admin directory, which doesn't feel right.
>
> >>      Any input appreciated
> >>      /Lars Stavholm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-03 Thread Lars Stavholm

Lars Stavholm wrote:
> Karen Tracey wrote:
>> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
>> > wrote:
>>
>> Low Kian Seong wrote:
>> > http://www.djangobook.com/en/1.0/chapter17/
>>
>> Yes, thank you, that's it.
>>
>> It worked nicely for the change_form.html example given in that
>> chapter. However, for the change_list.html it still doesn't work.
>> Seems to me I've hit a django bug. Anyone else?
>>
>> I just tried this, and it works for me for change_list.html. So I'm not
>> sure what is going on in your case.  For me it just works, overriding
>> change_list on a per-model basis using a file:
>>
>> templates/admin///change_list.html
> 
> Hm, I'm using django from svn trunk revision 9208.
> What version are you using?
> /L

As it turns out, it was a conflict with an addon, the batchadmin addon,
that caused the confusion. Django truly works as advertised. My setup
of batchadmin however, needs more tweaking.

Thanks for all your help.
/Lars

>> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
>> > wrote:
>> >> Low Kian Seong wrote:
>> >>> You are supposed to put the admin template you want to override in
>> >>> your own template directory definition in settings.py
>> >>>
>> >>> So, if you defined it as /home/stava/> >>> name>/template/admin/change_list.html
>> >> Huh?
>> >> /L
>> >>
>> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
>> > wrote:
>>  I'd like to override part of an admin change_list template.
>> 
>>  Reading the documentation, my understanding is that I can place
>>  a template in a certain place in the templates directory hierarchy,
>>  and django will look for it and use it, i.e.:
>> 
>>  templates/admin/build/job/change_list.html
>> 
>>  ...where "build" is my application and "job" is my model class.
>> 
>>  The change_list.html file only contains the part I want to
>> override,
>>  i.e. the extrahead block. It contains:
>> 
>>  {% extends "admin/change_list.html" %}
>>  {% block extrahead %}
>>    
>>  {% endblock %}
>> 
>>  However, this does not work for me, so I'm expecting it to be some
>>  mistake on my part, I just can't figure out what the mistake is.
>> 
>>  Now, if I put the file in ./templates/admin/build/change_list.html
>>  it still wont work. On the other hand, this would be overriding all
>>  "build" application change lists, which is not what I was
>> looking for.
>> 
>>  Only way I've found is to copy the change_list.html from the django
>>  installation in contrib/admin/templates/admin, and then modify
>> it to
>>  my needs, using "if" statements to figure out which application
>> model
>>  class is being rendered, and the put the change_list.html in my
>> app's
>>  templates/admin directory, which doesn't feel right.
>> 
>>  Any input appreciated
>>  /Lars Stavholm
>> 
>> 
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>>
>>
>>
>>
> 
> 
> 
> > 
> 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-03 Thread Lars Stavholm

Karen Tracey wrote:
> On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]
> > wrote:
> 
> 
> Low Kian Seong wrote:
> > http://www.djangobook.com/en/1.0/chapter17/
> 
> Yes, thank you, that's it.
> 
> It worked nicely for the change_form.html example given in that
> chapter. However, for the change_list.html it still doesn't work.
> Seems to me I've hit a django bug. Anyone else?
> 
> 
> I just tried this, and it works for me for change_list.html. So I'm not
> sure what is going on in your case.  For me it just works, overriding
> change_list on a per-model basis using a file:
> 
> templates/admin///change_list.html

Hm, I'm using django from svn trunk revision 9208.
What version are you using?
/L

> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]
> > wrote:
> >> Low Kian Seong wrote:
> >>> You are supposed to put the admin template you want to override in
> >>> your own template directory definition in settings.py
> >>>
> >>> So, if you defined it as /home/stava/ >>> name>/template/admin/change_list.html
> >> Huh?
> >> /L
> >>
> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]
> > wrote:
>  I'd like to override part of an admin change_list template.
> 
>  Reading the documentation, my understanding is that I can place
>  a template in a certain place in the templates directory hierarchy,
>  and django will look for it and use it, i.e.:
> 
>  templates/admin/build/job/change_list.html
> 
>  ...where "build" is my application and "job" is my model class.
> 
>  The change_list.html file only contains the part I want to
> override,
>  i.e. the extrahead block. It contains:
> 
>  {% extends "admin/change_list.html" %}
>  {% block extrahead %}
>    
>  {% endblock %}
> 
>  However, this does not work for me, so I'm expecting it to be some
>  mistake on my part, I just can't figure out what the mistake is.
> 
>  Now, if I put the file in ./templates/admin/build/change_list.html
>  it still wont work. On the other hand, this would be overriding all
>  "build" application change lists, which is not what I was
> looking for.
> 
>  Only way I've found is to copy the change_list.html from the django
>  installation in contrib/admin/templates/admin, and then modify
> it to
>  my needs, using "if" statements to figure out which application
> model
>  class is being rendered, and the put the change_list.html in my
> app's
>  templates/admin directory, which doesn't feel right.
> 
>  Any input appreciated
>  /Lars Stavholm
> 
> 
> >>
> >>
> >
> >
> >
> 
> 
> 
> 
> 
> 
> > 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Karen Tracey
On Sat, Nov 1, 2008 at 5:54 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:

>
> Low Kian Seong wrote:
> > http://www.djangobook.com/en/1.0/chapter17/
>
> Yes, thank you, that's it.
>
> It worked nicely for the change_form.html example given in that
> chapter. However, for the change_list.html it still doesn't work.
> Seems to me I've hit a django bug. Anyone else?
>

I just tried this, and it works for me for change_list.html. So I'm not sure
what is going on in your case.  For me it just works, overriding change_list
on a per-model basis using a file:

templates/admin///change_list.html

Karen


> /L
>
> > On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
> >> Low Kian Seong wrote:
> >>> You are supposed to put the admin template you want to override in
> >>> your own template directory definition in settings.py
> >>>
> >>> So, if you defined it as /home/stava/ >>> name>/template/admin/change_list.html
> >> Huh?
> >> /L
> >>
> >>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]>
> wrote:
>  I'd like to override part of an admin change_list template.
> 
>  Reading the documentation, my understanding is that I can place
>  a template in a certain place in the templates directory hierarchy,
>  and django will look for it and use it, i.e.:
> 
>  templates/admin/build/job/change_list.html
> 
>  ...where "build" is my application and "job" is my model class.
> 
>  The change_list.html file only contains the part I want to override,
>  i.e. the extrahead block. It contains:
> 
>  {% extends "admin/change_list.html" %}
>  {% block extrahead %}
>    
>  {% endblock %}
> 
>  However, this does not work for me, so I'm expecting it to be some
>  mistake on my part, I just can't figure out what the mistake is.
> 
>  Now, if I put the file in ./templates/admin/build/change_list.html
>  it still wont work. On the other hand, this would be overriding all
>  "build" application change lists, which is not what I was looking for.
> 
>  Only way I've found is to copy the change_list.html from the django
>  installation in contrib/admin/templates/admin, and then modify it to
>  my needs, using "if" statements to figure out which application model
>  class is being rendered, and the put the change_list.html in my app's
>  templates/admin directory, which doesn't feel right.
> 
>  Any input appreciated
>  /Lars Stavholm
> 
> 
> >>
> >>
> >
> >
> >
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm

Low Kian Seong wrote:
> http://www.djangobook.com/en/1.0/chapter17/

Yes, thank you, that's it.

It worked nicely for the change_form.html example given in that
chapter. However, for the change_list.html it still doesn't work.
Seems to me I've hit a django bug. Anyone else?
/L

> On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Low Kian Seong wrote:
>>> You are supposed to put the admin template you want to override in
>>> your own template directory definition in settings.py
>>>
>>> So, if you defined it as /home/stava/>> name>/template/admin/change_list.html
>> Huh?
>> /L
>>
>>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
 I'd like to override part of an admin change_list template.

 Reading the documentation, my understanding is that I can place
 a template in a certain place in the templates directory hierarchy,
 and django will look for it and use it, i.e.:

 templates/admin/build/job/change_list.html

 ...where "build" is my application and "job" is my model class.

 The change_list.html file only contains the part I want to override,
 i.e. the extrahead block. It contains:

 {% extends "admin/change_list.html" %}
 {% block extrahead %}
   
 {% endblock %}

 However, this does not work for me, so I'm expecting it to be some
 mistake on my part, I just can't figure out what the mistake is.

 Now, if I put the file in ./templates/admin/build/change_list.html
 it still wont work. On the other hand, this would be overriding all
 "build" application change lists, which is not what I was looking for.

 Only way I've found is to copy the change_list.html from the django
 installation in contrib/admin/templates/admin, and then modify it to
 my needs, using "if" statements to figure out which application model
 class is being rendered, and the put the change_list.html in my app's
 templates/admin directory, which doesn't feel right.

 Any input appreciated
 /Lars Stavholm


>>
>>
> 
> 
> 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Low Kian Seong

http://www.djangobook.com/en/1.0/chapter17/

On Sat, Nov 1, 2008 at 6:20 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>
> Low Kian Seong wrote:
>> You are supposed to put the admin template you want to override in
>> your own template directory definition in settings.py
>>
>> So, if you defined it as /home/stava/> name>/template/admin/change_list.html
>
> Huh?
> /L
>
>> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>>> I'd like to override part of an admin change_list template.
>>>
>>> Reading the documentation, my understanding is that I can place
>>> a template in a certain place in the templates directory hierarchy,
>>> and django will look for it and use it, i.e.:
>>>
>>> templates/admin/build/job/change_list.html
>>>
>>> ...where "build" is my application and "job" is my model class.
>>>
>>> The change_list.html file only contains the part I want to override,
>>> i.e. the extrahead block. It contains:
>>>
>>> {% extends "admin/change_list.html" %}
>>> {% block extrahead %}
>>>   
>>> {% endblock %}
>>>
>>> However, this does not work for me, so I'm expecting it to be some
>>> mistake on my part, I just can't figure out what the mistake is.
>>>
>>> Now, if I put the file in ./templates/admin/build/change_list.html
>>> it still wont work. On the other hand, this would be overriding all
>>> "build" application change lists, which is not what I was looking for.
>>>
>>> Only way I've found is to copy the change_list.html from the django
>>> installation in contrib/admin/templates/admin, and then modify it to
>>> my needs, using "if" statements to figure out which application model
>>> class is being rendered, and the put the change_list.html in my app's
>>> templates/admin directory, which doesn't feel right.
>>>
>>> Any input appreciated
>>> /Lars Stavholm
>>>
>>>
>>
>> >
>>
>
>
>
> >
>



-- 
Low Kian Seong
blog: http://lowkster.blogspot.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Lars Stavholm

Low Kian Seong wrote:
> You are supposed to put the admin template you want to override in
> your own template directory definition in settings.py
> 
> So, if you defined it as /home/stava/ name>/template/admin/change_list.html

Huh?
/L

> On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> I'd like to override part of an admin change_list template.
>>
>> Reading the documentation, my understanding is that I can place
>> a template in a certain place in the templates directory hierarchy,
>> and django will look for it and use it, i.e.:
>>
>> templates/admin/build/job/change_list.html
>>
>> ...where "build" is my application and "job" is my model class.
>>
>> The change_list.html file only contains the part I want to override,
>> i.e. the extrahead block. It contains:
>>
>> {% extends "admin/change_list.html" %}
>> {% block extrahead %}
>>   
>> {% endblock %}
>>
>> However, this does not work for me, so I'm expecting it to be some
>> mistake on my part, I just can't figure out what the mistake is.
>>
>> Now, if I put the file in ./templates/admin/build/change_list.html
>> it still wont work. On the other hand, this would be overriding all
>> "build" application change lists, which is not what I was looking for.
>>
>> Only way I've found is to copy the change_list.html from the django
>> installation in contrib/admin/templates/admin, and then modify it to
>> my needs, using "if" statements to figure out which application model
>> class is being rendered, and the put the change_list.html in my app's
>> templates/admin directory, which doesn't feel right.
>>
>> Any input appreciated
>> /Lars Stavholm
>>
>>
> 
> > 
> 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding admin templates

2008-11-01 Thread Low Kian Seong

You are supposed to put the admin template you want to override in
your own template directory definition in settings.py

So, if you defined it as /home/stava//template/admin/change_list.html



On Sat, Nov 1, 2008 at 5:32 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>
> I'd like to override part of an admin change_list template.
>
> Reading the documentation, my understanding is that I can place
> a template in a certain place in the templates directory hierarchy,
> and django will look for it and use it, i.e.:
>
> templates/admin/build/job/change_list.html
>
> ...where "build" is my application and "job" is my model class.
>
> The change_list.html file only contains the part I want to override,
> i.e. the extrahead block. It contains:
>
> {% extends "admin/change_list.html" %}
> {% block extrahead %}
>   
> {% endblock %}
>
> However, this does not work for me, so I'm expecting it to be some
> mistake on my part, I just can't figure out what the mistake is.
>
> Now, if I put the file in ./templates/admin/build/change_list.html
> it still wont work. On the other hand, this would be overriding all
> "build" application change lists, which is not what I was looking for.
>
> Only way I've found is to copy the change_list.html from the django
> installation in contrib/admin/templates/admin, and then modify it to
> my needs, using "if" statements to figure out which application model
> class is being rendered, and the put the change_list.html in my app's
> templates/admin directory, which doesn't feel right.
>
> Any input appreciated
> /Lars Stavholm
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Overriding admin templates

2008-11-01 Thread Lars Stavholm

I'd like to override part of an admin change_list template.

Reading the documentation, my understanding is that I can place
a template in a certain place in the templates directory hierarchy,
and django will look for it and use it, i.e.:

templates/admin/build/job/change_list.html

...where "build" is my application and "job" is my model class.

The change_list.html file only contains the part I want to override,
i.e. the extrahead block. It contains:

{% extends "admin/change_list.html" %}
{% block extrahead %}
   
{% endblock %}

However, this does not work for me, so I'm expecting it to be some
mistake on my part, I just can't figure out what the mistake is.

Now, if I put the file in ./templates/admin/build/change_list.html
it still wont work. On the other hand, this would be overriding all
"build" application change lists, which is not what I was looking for.

Only way I've found is to copy the change_list.html from the django
installation in contrib/admin/templates/admin, and then modify it to
my needs, using "if" statements to figure out which application model
class is being rendered, and the put the change_list.html in my app's
templates/admin directory, which doesn't feel right.

Any input appreciated
/Lars Stavholm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Overriding Admin templates on a per-app and per-model basis

2007-09-11 Thread AndyB

I just tried this against trunk and got the same results.

>From a quick perusal of the admin code I can't see any special code
for template loading. Where is this functionality supposed to reside?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Overriding Admin templates on a per-app and per-model basis

2007-09-10 Thread AndyB

I was rather pleased to read that the above was possible according to
the Django book: http://www.djangobook.com/en/beta/chapter18/ (scroll
down to the section called 'Customizing admin templates')

I've already been overriding the admin templates globally by putting
custom templates in a folder named:
projectname\appname\templates\admin

This works fine.

Apparently you can have app and model specific subdirectories thus:

projectname\appname\templates\admin\appname
and
projectname\appname\templates\admin\appname\modelname

I'm using newforms-admin but will put together a simple test case
against the trunk and post the results here if no-one else can confirm
whether it's a problem in newforms-admin (or in my lousy code ;-)

I'm using 'app_directories' as my template loader. I was previously
using 'filesystem' as I couldn't get it to work any other way but
realised that the order of apps in INSTALLED_APPS was critical when
using 'django.template.loaders.app_directories'. Either way it doesn't
work

In summary my admin override templates kick in fine when I put my
templates in:
template_dir/admin/
but not when I put them in:
template_dir/admin/appname
or
template_dir/admin/appname/modelname
as suggested in the Django book as a way of getting app and model
specific admin customisation.

thanks in advance,

Andy Baker


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---