David Jean Louis avatar David Jean Louis committed bb63140

fixed issue #2: template tag libraries have generic names

Comments (0)

Files changed (10)

admin_tools/dashboard/templates/admin/app_index.html

 {% extends "admin/index.html" %} 
-{% load i18n dashboard_tags %} 
+{% load i18n admin_tools_dashboard_tags %} 
 
 {% if not is_popup %}
 
-{% block dashboard_css %}{% render_dashboard_css 'app_index' %}{% endblock %}
+{% block dashboard_css %}{% admin_tools_render_dashboard_css 'app_index' %}{% endblock %}
 {% block breadcrumbs %}
 <div class="breadcrumbs"><a href="../">
 {% trans "Home" %}</a> &rsaquo; 
 {% endif %} 
 
 {% block content %}
-{% render_dashboard 'app_index' %}
+{% admin_tools_render_dashboard 'app_index' %}
 {% endblock %}
 {% block sidebar %}{% endblock %}

admin_tools/dashboard/templates/admin/index.html

 {% extends "admin/base_site.html" %}
-{% load i18n dashboard_tags %}
+{% load i18n admin_tools_dashboard_tags %}
 
 {% block extrastyle %}
 {{ block.super }}
-{% block dashboard_css %}{% render_dashboard_css %}{% endblock %}
+{% block dashboard_css %}{% admin_tools_render_dashboard_css %}{% endblock %}
 {% endblock %}
 
 {% block bodyclass %}dashboard{% endblock %}
 {% block breadcrumbs %}{% endblock %}
 {% block content_title %}{% endblock %}
 {% block content %}
-{% render_dashboard %}
+{% admin_tools_render_dashboard %}
 {% endblock %}

admin_tools/dashboard/templates/dashboard/dashboard.html

-{% load i18n dashboard_tags %}
+{% load i18n admin_tools_dashboard_tags %}
 
 <script type="text/javascript" charset="utf-8">
     // When jQuery is sourced, it's going to overwrite whatever might be in the
 </div>
 <div id="{{ dashboard.get_id }}" class="dashboard-container">
     {% for module in dashboard.children %}
-{% render_dashboard_module module forloop.counter %}{% endfor %}
+{% admin_tools_render_dashboard_module module forloop.counter %}{% endfor %}
 </div>

admin_tools/dashboard/templatetags/admin_tools_dashboard_tags.py

+"""
+Dashboard template tags, the following dashboard tags are available:
+ * ``{% admin_tools_render_dashboard %}``
+ * ``{% admin_tools_render_dashboard_module %}``
+ * ``{% admin_tools_render_dashboard_css %}``
+
+To load the dashboard tags: ``{% load admin_tools_dashboard_tags %}``.
+"""
+
+import math
+from django import template
+from django.conf import settings
+from admin_tools.dashboard.utils import get_dashboard
+
+register = template.Library()
+tag_func = register.inclusion_tag('dashboard/dummy.html', takes_context=True)
+
+
+def admin_tools_render_dashboard(context, location='index', dashboard=None):
+    """
+    Template tag that renders the dashboard, it takes two optional arguments:
+    
+    ``location``
+        The location of the dashboard, it can be 'index' (for the admin index
+        dashboard) or 'app_index' (for the app index dashboard), the default
+        value is 'index'.
+
+    ``dashboard``
+        An instance of ``Dashboard``, if not given, the dashboard is retrieved
+        with the ``get_index_dashboard`` or ``get_app_index_dashboard``
+        functions, depending on the ``location`` argument.
+    """
+    if dashboard is None:
+        dashboard = get_dashboard(context, location)
+
+    dashboard.init_with_context(context)
+    context.update({
+        'template': dashboard.template,
+        'dashboard': dashboard,
+        'split_at': math.ceil(float(len(dashboard.children))/float(dashboard.columns)),
+        'media_url': settings.MEDIA_URL.rstrip('/'),
+        'has_disabled_modules': len([m for m in dashboard.children \
+                                if not m.enabled]) > 0,
+    })
+    return context
+admin_tools_render_dashboard = tag_func(admin_tools_render_dashboard)
+
+
+def admin_tools_render_dashboard_module(context, module, index=None):
+    """
+    Template tag that renders a given dashboard module, it takes a
+    ``DashboardModule`` instance as first parameter and an integer ``index`` as
+    second parameter, that is the index of the module in the dashboard.
+    """
+    module.init_with_context(context)
+    context.update({
+        'template': module.template,
+        'module': module,
+        'index': index,
+    })
+    return context
+admin_tools_render_dashboard_module = tag_func(admin_tools_render_dashboard_module)
+
+
+def admin_tools_render_dashboard_css(context, location='index', dashboard=None):
+    """
+    Template tag that renders the dashboard css files, it takes two optional
+    arguments:
+    
+    ``location``
+        The location of the dashboard, it can be 'index' (for the admin index
+        dashboard) or 'app_index' (for the app index dashboard), the default
+        value is 'index'.
+
+    ``dashboard``
+        An instance of ``Dashboard``, if not given, the dashboard is retrieved
+        with the ``get_index_dashboard`` or ``get_app_index_dashboard``
+        functions, depending on the ``location`` argument.
+    """
+    if dashboard is None:
+        dashboard = get_dashboard(context, location)
+
+    context.update({
+        'template' : 'dashboard/css.html',
+        'css_files': dashboard.Media.css,
+        'media_url': settings.MEDIA_URL.rstrip('/'),
+    })
+    return context
+admin_tools_render_dashboard_css = tag_func(admin_tools_render_dashboard_css)

admin_tools/dashboard/templatetags/dashboard_tags.py

-"""
-Dashboard template tags, the following dashboard tags are available:
- * ``{% render_dashboard %}``
- * ``{% render_dashboard_module %}``
- * ``{% render_dashboard_css %}``
-
-To load the dashboard tags: ``{% load dashboard_tags %}``.
-"""
-
-import math
-from django import template
-from django.conf import settings
-from admin_tools.dashboard.utils import get_dashboard
-
-register = template.Library()
-tag_func = register.inclusion_tag('dashboard/dummy.html', takes_context=True)
-
-
-def render_dashboard(context, location='index', dashboard=None):
-    """
-    Template tag that renders the dashboard, it takes two optional arguments:
-    
-    ``location``
-        The location of the dashboard, it can be 'index' (for the admin index
-        dashboard) or 'app_index' (for the app index dashboard), the default
-        value is 'index'.
-
-    ``dashboard``
-        An instance of ``Dashboard``, if not given, the dashboard is retrieved
-        with the ``get_index_dashboard`` or ``get_app_index_dashboard``
-        functions, depending on the ``location`` argument.
-    """
-    if dashboard is None:
-        dashboard = get_dashboard(context, location)
-
-    dashboard.init_with_context(context)
-    context.update({
-        'template': dashboard.template,
-        'dashboard': dashboard,
-        'split_at': math.ceil(float(len(dashboard.children))/float(dashboard.columns)),
-        'media_url': settings.MEDIA_URL.rstrip('/'),
-        'has_disabled_modules': len([m for m in dashboard.children \
-                                if not m.enabled]) > 0,
-    })
-    return context
-render_dashboard = tag_func(render_dashboard)
-
-
-def render_dashboard_module(context, module, index=None):
-    """
-    Template tag that renders a given dashboard module, it takes a
-    ``DashboardModule`` instance as first parameter and an integer ``index`` as
-    second parameter, that is the index of the module in the dashboard.
-    """
-    module.init_with_context(context)
-    context.update({
-        'template': module.template,
-        'module': module,
-        'index': index,
-    })
-    return context
-render_dashboard_module = tag_func(render_dashboard_module)
-
-
-def render_dashboard_css(context, location='index', dashboard=None):
-    """
-    Template tag that renders the dashboard css files, it takes two optional
-    arguments:
-    
-    ``location``
-        The location of the dashboard, it can be 'index' (for the admin index
-        dashboard) or 'app_index' (for the app index dashboard), the default
-        value is 'index'.
-
-    ``dashboard``
-        An instance of ``Dashboard``, if not given, the dashboard is retrieved
-        with the ``get_index_dashboard`` or ``get_app_index_dashboard``
-        functions, depending on the ``location`` argument.
-    """
-    if dashboard is None:
-        dashboard = get_dashboard(context, location)
-
-    context.update({
-        'template' : 'dashboard/css.html',
-        'css_files': dashboard.Media.css,
-        'media_url': settings.MEDIA_URL.rstrip('/'),
-    })
-    return context
-render_dashboard_css = tag_func(render_dashboard_css)

admin_tools/menu/templates/admin/base_site.html

 {% extends "admin/base.html" %}
-{% load i18n menu_tags %}
+{% load i18n admin_tools_menu_tags %}
 {% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}
 
 {% block extrastyle %}
 {{ block.super }}
-{% render_menu_css %}
+{% admin_tools_render_menu_css %}
 {% endblock %}
 
 {% block branding %}
 
 {% block nav-global %}
 {% if user and user.is_authenticated %}
-{% render_menu %}
+{% admin_tools_render_menu %}
 {% endif %}
 {% endblock %}

admin_tools/menu/templates/menu/item.html

-{% load menu_tags %}
+{% load admin_tools_menu_tags %}
 {% spaceless %}
 <li class="menu-item{% ifequal index 1 %} first{% endifequal %}{% if item.css_classes %} {{ item.css_classes|join:' ' }}{% endif %}">
     <a href="{{ item.url }}"{% if item.description %} title="{{ item.description }}"{% endif %}{% if item.accesskey %} accesskey="{{ item.accesskey }}"{% endif %}>{% if item.children %}<span class="icon"></span>{% endif %}{{ item.title }}</a>
     {% if item.children %}
     <ul>
         {% for child_item in item.children %}
-        {% render_menu_item child_item %}
+        {% admin_tools_render_menu_item child_item %}
         {% endfor %}
     </ul>
     {% endif %}

admin_tools/menu/templates/menu/menu.html

-{% load menu_tags %}
+{% load admin_tools_menu_tags %}
 {% if menu.children %}
 <!--[if IE 6]>
 <script type="text/javascript">
 <![endif]-->
 
 <ul id="navigation-menu">
-    {% for item in menu.children %}{% render_menu_item item forloop.counter %}{% endfor %}
+    {% for item in menu.children %}{% admin_tools_render_menu_item item forloop.counter %}{% endfor %}
 </ul>
 {% endif %}

admin_tools/menu/templatetags/admin_tools_menu_tags.py

+"""
+Menu template tags, the following menu tags are available:
+
+ * ``{% admin_tools_render_menu %}``
+ * ``{% admin_tools_render_menu_item %}``
+ * ``{% admin_tools_render_menu_css %}``
+
+To load the menu tags in your templates: ``{% load admin_tools_menu_tags %}``.
+"""
+
+from django import template
+from django.conf import settings
+from django.http import HttpRequest
+from admin_tools.menu.utils import get_admin_menu
+
+register = template.Library()
+tag_func = register.inclusion_tag('menu/dummy.html', takes_context=True)
+
+def admin_tools_render_menu(context, menu=None):
+    """
+    Template tag that renders the menu, it takes an optional ``Menu`` instance
+    as unique argument, if not given, the menu will be retrieved with the
+    ``get_admin_menu`` function.
+    """
+    if menu is None:
+        menu = get_admin_menu()
+
+    menu.init_with_context(context)
+
+    context.update({
+        'template': menu.template,
+        'menu': menu,
+        'media_url': settings.MEDIA_URL.rstrip('/'),
+    })
+    return context
+admin_tools_render_menu = tag_func(admin_tools_render_menu)
+
+
+def admin_tools_render_menu_item(context, item, index=None):
+    """
+    Template tag that renders a given menu item, it takes a ``MenuItem``
+    instance as unique parameter.
+    """
+    item.init_with_context(context)
+
+    context.update({
+        'template': item.template,
+        'item': item,
+        'index': index,
+    })
+    return context
+admin_tools_render_menu_item = tag_func(admin_tools_render_menu_item)
+
+
+def admin_tools_render_menu_css(context, menu=None):
+    """
+    Template tag that renders the menu css files,, it takes an optional 
+    ``Menu`` instance as unique argument, if not given, the menu will be
+    retrieved with the ``get_admin_menu`` function.
+    """
+    if menu is None:
+        menu = get_admin_menu()
+
+    context.update({
+        'template': 'menu/css.html',
+        'css_files': menu.Media.css,
+        'media_url': settings.MEDIA_URL.rstrip('/'),
+    })
+    return context
+admin_tools_render_menu_css = tag_func(admin_tools_render_menu_css)

admin_tools/menu/templatetags/menu_tags.py

-"""
-Menu template tags, the following menu tags are available:
-
- * ``{% render_menu %}``
- * ``{% render_menu_item %}``
- * ``{% render_menu_css %}``
-
-To load the menu tags in your templates: ``{% load menu_tags %}``.
-"""
-
-from django import template
-from django.conf import settings
-from django.http import HttpRequest
-from admin_tools.menu.utils import get_admin_menu
-
-register = template.Library()
-tag_func = register.inclusion_tag('menu/dummy.html', takes_context=True)
-
-def render_menu(context, menu=None):
-    """
-    Template tag that renders the menu, it takes an optional ``Menu`` instance
-    as unique argument, if not given, the menu will be retrieved with the
-    ``get_admin_menu`` function.
-    """
-    if menu is None:
-        menu = get_admin_menu()
-
-    menu.init_with_context(context)
-
-    context.update({
-        'template': menu.template,
-        'menu': menu,
-        'media_url': settings.MEDIA_URL.rstrip('/'),
-    })
-    return context
-render_menu = tag_func(render_menu)
-
-
-def render_menu_item(context, item, index=None):
-    """
-    Template tag that renders a given menu item, it takes a ``MenuItem``
-    instance as unique parameter.
-    """
-    item.init_with_context(context)
-
-    context.update({
-        'template': item.template,
-        'item': item,
-        'index': index,
-    })
-    return context
-render_menu_item = tag_func(render_menu_item)
-
-
-def render_menu_css(context, menu=None):
-    """
-    Template tag that renders the menu css files,, it takes an optional 
-    ``Menu`` instance as unique argument, if not given, the menu will be
-    retrieved with the ``get_admin_menu`` function.
-    """
-    if menu is None:
-        menu = get_admin_menu()
-
-    context.update({
-        'template': 'menu/css.html',
-        'css_files': menu.Media.css,
-        'media_url': settings.MEDIA_URL.rstrip('/'),
-    })
-    return context
-render_menu_css = tag_func(render_menu_css)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.