Wednesday 15 February 2012

Using Django admin template tags -


I want to use templatetags in contrib.admin in Djnago I am To do this, go to INSTALLED_APPS in settings.py.

  INSTALLED_APPS = ('django.contrib.auth', 'django.contrib.contenttypes',' Django.contrib.sessions', 'django.contrib.sites',' django.contrib. Messages', 'django.contrib.staticfiles',' django.contrib.admin ', ...)   

but when I try to use a tag, it says Is invalid block tag: 'x' . I tried to use the 'search_form' and 'admin_list_filter' tag and I saw an error for them. {% Admin_list_filter cl spec%} {% endfor%} for spec in <% s {@}% {@}

What am I missing?

Thanks

The template tag is actually reusable by the Django administrator. To use search_form tags, you will need to provide a ChangeList example, which is coupled very tightly with Django Administrator.

To reuse tags you were able to do, you have to do tag libraries first. Therefore, you have to load the admin_list tag before using it in the search_form tag.

  {% load_manager_list} {% search_form cl%}    

No comments:

Post a Comment