[Django]-Django transforming an old url to new syntax

2👍

Since that application is in use in production (in which we used Django 1.4) I cannot patch the application to make it compatible with Django 1.5+. But there is a pull-request that I kept open for such a situation. Here it is: https://github.com/s1n4/django-favorite/pull/1 It might solve the problem.

2👍

The URL has no arguments:

url(r'^add-or-remove$', 'add_or_remove'),

and neither does that view:

def add_or_remove(request):

The URL tag in the HTML there also has no arguments:

{% url favorite.views.add_or_remove %}

To convert that to the new syntax it would be:

{% url 'favorite.views.add_or_remove' %}

After that you can use the template tag as described in the README:

{% load favorite_tags %}

{% for comment in post.comments %}
  {% favorite_button comment %}
{% endfor %}

Leave a comment