Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 23, 2017 at 12:10 | history | edited | URL Rewriter Bot | replaced http://stackoverflow.com/ with https://stackoverflow.com/ | |
| Oct 9, 2010 at 6:34 | comment | added | SingleNegationElimination | If you use jinja2, just addreverse like thisenvironment.filters['url'] = django.core.urlresolvers.reverse and you can use it in your templates like so:{{ 'view-name'|url(arg1, arg2)|e }} (the "e" is needed to escape some characters for inclusion in HTML) | |
| Oct 9, 2010 at 6:29 | comment | added | SingleNegationElimination | you can use this in templates, too, as in{% url path.to.view.name arg1 arg2 %}docs.djangoproject.com/en/dev/ref/templates/builtins/… | |
| Jul 19, 2010 at 3:55 | comment | added | TM. | @skyl It's hardly "the only way to fly". I was at a Django dev sprint and Adrian Holovaty (one of the creators of Django) said he doesn't even use theurl tag... His stance is that urls shouldn't be changing anyway (if you want to be friendly to your users). | |
| Nov 1, 2009 at 9:04 | comment | added | Skylar Saveland | This shouldn't be a hidden feature, this is best practice and the only way to fly. | |
| Oct 13, 2009 at 17:28 | history | edited | Peter Mortensen | CC BY-SA 2.5 | Internal: transformed two URLs to another form. Minor edit: grammar/spelling/case/punctation/etc. |
| Sep 4, 2009 at 8:34 | comment | added | ricree | I agree 100% on this one. I started out using hard coded urls, and it bit me on a project when I changed the url format around a bit to accommodate some changes. I took the time to go back and dig through everything and replace hard coded urls. My only big complaint is that url tag errors kill the whole page while hard coded only messes up the individual link. | |
| Feb 18, 2009 at 22:00 | history | edited | hasen | CC BY-SA 2.5 | added 354 characters in body |
| Feb 17, 2009 at 19:34 | history | answered | hasen | CC BY-SA 2.5 |