Django 1.6.5: __init__() got an unexpected keyword argument 'legacy_view_name'

Question:

I have a PY file with code:

class URLSystemNode(URLNode):
  ...
  def render(self, context):
    ...
    if not self.legacy_view_name:
      view_name = view_name.resolve(context)
    ...
  ...
 def url_system(parser, token):
   ...
   return URLSystemNode(view_name, args, kwargs, asvar, legacy_view_name=True)

This worked fine in Django 1.4.5. After I’ve migrated to Django 1.6.5 I am receiving an error:

__init__() got an unexpected keyword argument 'legacy_view_name'

The line that causing this is:

return URLSystemNode(view_name, args, kwargs, asvar, legacy_view_name=True)

Question: may be someone can help me find out why there is an error in Django 1.6.5?

The URLSystemNode doesn’t have the __init__ function. May be it is mandatory for Django 1.6.5?

Asked By: 0leg

||

Answers:

legacy_view_name was an argument that was introduced to deal with the move from the old {% url view_name %} syntax to the new {% url 'view_name' %}. Since the latter is now the only accepted syntax, the argument has been dropped. Just remove it from that line altogether.

Answered By: Daniel Roseman
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.