Open GoogleCodeExporter opened 9 years ago
Interesting suggestion. However, I'd prefer to take a more generic approach.
Adding a such a "URL template" field is already possible by extending the
MenuItem
model (see doc on extending/customizing). But it'd be good to be able to
deactivate
the "url" and "named_url" fields from the original model. Those 2 fields are not
intrinsically part of a menu item, really. So I've always felt a bit uneasy
about
having them in the MenuItem model.
Original comment by jpha...@gmail.com
on 14 Mar 2009 at 4:17
Here is a schema-breaking patch that replaces the `url` and `named_url` fields,
with
a `url_template` field. Along the way I made a very useful {%
render_as_template %}
tag (see http://www.djangosnippets.org/snippets/1373/) and did a little
refactoring.
This needs a schema migration script, but I don't have any old-style menu items
to
convert. Essentially, it needs to select one non-empty field of "url" and
"named_url", and put it in "url_template", except if it's "named_url", wrap it
in {%
url xxx %}.
Why don't you think URL is an intrinsic part of a menu item? Perhaps we should
supply
a "Tree" parent class, a "URLMenu" subclass (which has current functionality),
and a
"SelectedURLMenu" which implements the example in the manual.
Original comment by gregx10t...@gmail.com
on 14 Mar 2009 at 4:25
Attachments:
I've made a branch called url_templates where we can develop this idea...
Original comment by gregx10t...@gmail.com
on 14 Mar 2009 at 4:33
Original issue reported on code.google.com by
gregx10t...@gmail.com
on 14 Mar 2009 at 2:43