Is there any way to disable throwing NoReverseMatch
exceptions from url
tags in Django templates (just make it silently fail, return an empty string or smth... temporarily, for development, of course)?
(I'm working on a Django project that is kind of a mess as far as things are organized (bunch of remote-workers, contractors plus the local team with lots of overlapping tasks assigned to different people and even front-end and back-end work tends to get mixed as part of the same task...) and I really need to just ignore/hide/disable the NoReverseMatch
thrown by template url
tags in order to efficiently do my part of the job and not end up doing other peoples' jobs in order to be able to do mine...)
An alternative is using {% url ... as var %}
, which doesn't raise the exception (as explained in the documentation), but doesn't render the url inline either.
You'll need to replace this:
<a href="{% url somepage %}">
with this:
{% url somepage as var %}
<a href="{{ var }}">
Depending on how many templates you've got to work with, this may or may not be the better solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With