Re: Unable to load a modified tabular.html
You may try this:
1. Create new folders under $MYPROJECT named my_templates/admin/edit_inline/
2. Save your customized tabular.html under my_templates/admin/edit_inline/
3. Edit settings.py as below:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(os.path.dirname(__file__), 'my_templates'),
os.path.join(os.path.dirname(__file__), 'templates'),
)
Then django will try to find the templates from my_templates first, than the standard one.
Michael
在 2013年10月24日星期四UTC+8下午11时32分43秒,Vittorio写道:
-- 1. Create new folders under $MYPROJECT named my_templates/admin/edit_inline/
2. Save your customized tabular.html under my_templates/admin/edit_inline/
3. Edit settings.py as below:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(os.path.dirname(__file__), 'my_templates'),
os.path.join(os.path.dirname(__file__), 'templates'),
)
Then django will try to find the templates from my_templates first, than the standard one.
Michael
在 2013年10月24日星期四UTC+8下午11时32分43秒,Vittorio写道:
Context: Mac OS X 10.7, Django 1.5.4 using Admin
I was able to taylor the admin/edit_inline/tabular.html to eliminate some redundant info (such as the obsessive label indicating from which Object is extracted the inline record, repeated record by record!) in my many inlines putting the revised tabular.html under $MYPROJECT/templates/admin/edit_inline/. It works like a charm!
Now, for a specific model only I need to modify tabular.html eliminating the 'delete?' label and the relating little boxes in each record of the inline model.
Therefore I created a mytabular.html file and put it under myproject/templates/admin/ then in
# views.py
def mytabular(request):
return render_to_response('mytabular.html')
# urls.py
urlpatterns = patterns('',
.............
url(r'^magazzino/', include(admin.site.urls)),
url(r'^movimentoordine/(\d+)/$', 'magazzino.views.mytabular', name='mytabular'),
)
[The called url is e.g. 'http://localhost:8000/magazzino/magazzino/ ']movimentoordine/2/
Unfortunately django doesn't seem to take my desire into account and invariably calls admin/edit_inline/tabular.html instead of mytabular.html as debug_toolbar says.
I tried also to put mytabular.html under $MYPROJECT/templates/admin/edit_inline/ to no avail.
Please help.
Ciao
Vittorio
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/562c5858-f432-49bf-9fe5-87fa7f43ae14%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home