marcuswhybrow / django-lineage Goto Github PK
View Code? Open in Web Editor NEWLightweight template tags for neater hierarchical navigation
Home Page: https://pypi.python.org/pypi/django-lineage/
License: BSD 3-Clause "New" or "Revised" License
Lightweight template tags for neater hierarchical navigation
Home Page: https://pypi.python.org/pypi/django-lineage/
License: BSD 3-Clause "New" or "Revised" License
pip installing django-lineage doesn't seem to work the same as it did in development. For some reason the ifanscestor
tag is no longer being loaded in correctly
There is problem with this line
re.match(path,current_path)
Will get match on 2 urls which are different:
/first/url/
/first/url/but/longer
Why not use path==current_path ?
I have a link in Django 1.4.13 which points to the reverse() of a CBV, called "jurisdiction_list."
<li class="{% ancestor jurisdiction_list %}"><a href="{% url jurisdiction_list %}"><i class="fa fa-globe fa-fw"></i> Jurisdictions</a></li>
It appears to error out at
/lineage/templatetags/lineage.py in get_path, line 85
if re.match('/', arg_output):
return arg_output
The variable arg_output is being resolved (somehow) as a queryset of model objects, although it is pointing to a ListView which should have the variable object_list
. That aside, one way to resolve this issue is to make sure you have a string before passing the result to the regex:
def get_path(self, context):
# If the singular argument was provided and starts with a forward
# slash, use it as the path
if self.arg is not None:
arg_output = self.arg.resolve(context)
if isinstance(arg_output, basestring):
if re.match('/', arg_output):
return arg_output
# Otherwise derive the path from the url tag approach
return self.url_node.render(context)
There may be something I am missing, and I am certainly confused as to how the result of the parsing of "jurisdiction_list" results in the object_list being returned.
My views.py has something similar to:
class JurisdictionList(ListView):
model = Jurisdiction
....
jurisdiction_list = JurisdictionList.as_view()
Then, my urls.py points to the name & view "jurisdiction_list."
Consider linking to https://bitbucket.org/schinckel/django-menus/overview as an alternative approach to marking the active link, and documenting what the differences are, to help out someone trying to decide which to use.
Maybe ancestor
should make a special case for the root URL (which is defined as an empty RegEx).
For instance, if we have url(r'^$', views.index, name='index')
, then {% ancestor 'index' %}
will always match, which is not desired.
As a workaround, I can use {% ancestor '/$' %}
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.