git.ithinksw.org
/
philo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4277b56
)
Corrected shipherd Navigation cache clearing and made grappelli attribute inline...
author
Stephen Burrows
<stephen.r.burrows@gmail.com>
Tue, 11 Jan 2011 14:13:54 +0000
(09:13 -0500)
committer
Stephen Burrows
<stephen.r.burrows@gmail.com>
Tue, 11 Jan 2011 16:28:29 +0000
(11:28 -0500)
contrib/shipherd/models.py
patch
|
blob
|
history
contrib/shipherd/templatetags/shipherd.py
patch
|
blob
|
history
templates/admin/philo/edit_inline/grappelli_tabular_attribute.html
patch
|
blob
|
history
diff --git
a/contrib/shipherd/models.py
b/contrib/shipherd/models.py
index
e43e8d9
..
72bd775
100644
(file)
--- a/
contrib/shipherd/models.py
+++ b/
contrib/shipherd/models.py
@@
-111,7
+111,7
@@
class NavigationManager(TreeManager):
"""
if navigation is None:
self.__class__._cache.clear()
"""
if navigation is None:
self.__class__._cache.clear()
- el
s
e:
+ el
if self.db in self.__class__._cach
e:
cache = self.__class__._cache[self.db]
for pk, qs in cache.items():
if navigation in qs:
cache = self.__class__._cache[self.db]
for pk, qs in cache.items():
if navigation in qs:
diff --git
a/contrib/shipherd/templatetags/shipherd.py
b/contrib/shipherd/templatetags/shipherd.py
index
fec700b
..
8adef3e
100644
(file)
--- a/
contrib/shipherd/templatetags/shipherd.py
+++ b/
contrib/shipherd/templatetags/shipherd.py
@@
-17,9
+17,9
@@
class RecurseNavigationNode(RecurseTreeNode):
bits = []
context.push()
for child in node.get_children():
bits = []
context.push()
for child in node.get_children():
- context['n
ode
'] = child
+ context['n
avigation
'] = child
bits.append(self._render_node(context, child, request))
bits.append(self._render_node(context, child, request))
- context['n
ode
'] = node
+ context['n
avigation
'] = node
context['children'] = mark_safe(u''.join(bits))
context['active'] = node.is_active(request)
rendered = self.template_nodes.render(context)
context['children'] = mark_safe(u''.join(bits))
context['active'] = node.is_active(request)
rendered = self.template_nodes.render(context)
@@
-41,17
+41,17
@@
class RecurseNavigationNode(RecurseTreeNode):
@register.tag
def recursenavigation(parser, token):
"""
@register.tag
def recursenavigation(parser, token):
"""
- Based on django-mptt's recursetree templatetag. In addition to {{ n
ode
}} and {{ children }},
+ Based on django-mptt's recursetree templatetag. In addition to {{ n
avigation
}} and {{ children }},
sets {{ active }} in the context.
sets {{ active }} in the context.
- Note that the tag takes one variable,
navigation, which is a Navigation
instance.
+ Note that the tag takes one variable,
which is a Node
instance.
Usage:
<ul>
Usage:
<ul>
- {% recursenavigation n
avigation
%}
+ {% recursenavigation n
ode
%}
<li{% if active %} class='active'{% endif %}>
<li{% if active %} class='active'{% endif %}>
- {{ n
ode.name
}}
- {% if not n
ode
.is_leaf_node %}
+ {{ n
avigation.text
}}
+ {% if not n
avigation
.is_leaf_node %}
<ul>
{{ children }}
</ul>
<ul>
{{ children }}
</ul>
@@
-69,4
+69,9
@@
def recursenavigation(parser, token):
template_nodes = parser.parse(('endrecursenavigation',))
parser.delete_first_token()
template_nodes = parser.parse(('endrecursenavigation',))
parser.delete_first_token()
- return RecurseNavigationNode(template_nodes, instance_var)
\ No newline at end of file
+ return RecurseNavigationNode(template_nodes, instance_var)
+
+
+@register.filter
+def has_navigation(node):
+ return bool(Navigation.objects.closest_navigation(node).count())
\ No newline at end of file
diff --git
a/templates/admin/philo/edit_inline/grappelli_tabular_attribute.html
b/templates/admin/philo/edit_inline/grappelli_tabular_attribute.html
index
4760397
..
ea95b2c
100644
(file)
--- a/
templates/admin/philo/edit_inline/grappelli_tabular_attribute.html
+++ b/
templates/admin/philo/edit_inline/grappelli_tabular_attribute.html
@@
-3,7
+3,7
@@
<!-- group -->
<div class="group tabular{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}-group" >
<!-- group -->
<div class="group tabular{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}-group" >
- <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
+ <h2
class="collapse-handler"
>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
<ul class="tools">
<li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Another' %}"> </a></li>
</ul>
<ul class="tools">
<li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Another' %}"> </a></li>
</ul>