Reverse for 'registration_register' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
<p>I am trying to make a link in the sidebar of my Person model as persons. For that I made a templatetags folder where my member_template_tags.py:</p>

<pre><code>from django import template
from member.models import Person
register = template.Library()

@register.inclusion_tag('member/person_list.html')
def get_person_list():
     persons= Person.objects.all(),
     return {'persons': persons}
</code></pre>

<p>and my view file: </p>

<pre><code>class PersonListView(generic.ListView):
    model = Person
    context_object_name = 'persons'
</code></pre>

<p>my person_list.html:</p>

<pre><code>{% extends 'member/base.html' %}

{% block content %}
    &lt;h2&gt;Members&lt;/h2&gt;
    &lt;table&gt;

        &lt;tr&gt;
            &lt;th&gt;sl.&lt;/th&gt;
            &lt;th&gt;Name and Position&lt;/th&gt;
            &lt;th&gt;Photo&lt;/th&gt;
            &lt;th&gt;Organisation &amp; Address&lt;/th&gt;
            &lt;th&gt;Contact&lt;/th&gt;
        &lt;/tr&gt;
        {% for person in object_list %}
        &lt;tr&gt;
            &lt;td&gt;{{forloop.counter}}.&lt;/td&gt;
            &lt;td&gt;{{person.name}}&lt;br&gt;
            {{person.present_position}}
&lt;/td&gt;
            &lt;td&gt;&lt;a href="{% url 'member:person-list' %}"&gt;
            &lt;img src="{{ person.photo_url|default_if_none:'#'}}" class="img-responsive"&gt;
        &lt;/a&gt;&lt;/td&gt;
            &lt;td&gt;
            {{person.organization}}&lt;br&gt;
           {{person.address}}
            &lt;/td&gt;
            &lt;td&gt;
             {{person.tele_land}}&lt;br&gt;
             {{person.tele_cell}}&lt;br&gt;
             {{person.email}}
            &lt;/td&gt;
        &lt;/tr&gt;


    &lt;/table&gt;
{% endblock %}
</code></pre>

<p>and in base.html, sidebar code is:</p>

<pre><code>&lt;div class="col-sm-3 col-md-2 sidebar"&gt;
            {% block sidebar_block %}
                {% get_person_list %}
            {% endblock %}
        &lt;/div&gt;
</code></pre>

<p>When I tried it gives following traceback:
Template error:</p>

<pre><code>In template /home/ohid/test_venv/alumni/member/templates/member/person_list.html, error at line 0
   Reverse for 'registration_register' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []   
1 : {% extends 'member/base.html' %}
       2 : 
       3 : 
       4 : 
       5 :     &lt;h2&gt;Members&lt;/h2&gt;
       6 :     &lt;table&gt;
       7 : 
       8 :         &lt;tr&gt;
       9 :             &lt;th&gt;sl.&lt;/th&gt;
       10 :             &lt;th&gt;Name and Position&lt;/th&gt;

Traceback:

    File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
      507.                               current_app=current_app)

    File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/urlresolvers.py" in reverse
      600.     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))

    File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
      508.                              (lookup_view_s, args, kwargs, len(patterns), patterns))

    During handling of the above exception (Reverse for 'alumni.registration_register' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []), another exception occurred:

    File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
      174.                     response = self.process_exception_by_middleware(e, request)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  172.                     response = response.render()

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/response.py" in render
  160.             self.content = self.rendered_content

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/response.py" in rendered_content
  137.         content = template.render(context, self._request)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  326.                 return nodelist.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  513.                         six.reraise(*exc_info)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/utils/six.py" in reraise
  686.         raise value

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/defaulttags.py" in render
  499.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/urlresolvers.py" in reverse
  600.     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
  508.                              (lookup_view_s, args, kwargs, len(patterns), patterns))
</code></pre>

<p>Exception Type: NoReverseMatch at /person/</p>

<p><strong>Edit:</strong></p>

<p>When I use </p>

<pre><code>&lt;div class="col-sm-3 col-md-2 sidebar"&gt;
            {% block sidebar_block %}
                {% get_person_list persons %}
            {% endblock %}
        &lt;/div&gt;
</code></pre>

<p>The same code gives 'get_person_list' received too many positional arguments errors. The new traceback:</p>

<pre><code>Template error:
In template /home/ohid/test_venv/alumni/member/templates/member/base.html, error at line 57
   'get_person_list' received too many positional arguments   47 : 
   48 :         &lt;/nav&gt;
   49 :       &lt;/div&gt;
   50 : 
   51 :     &lt;/nav&gt;
   52 : 
   53 :     &lt;div class="container-fluid"&gt;
   54 :       &lt;div class="row"&gt;
   55 :         &lt;div class="col-sm-3 col-md-2 sidebar"&gt;
   56 :             {% block sidebar_block %}
   57 :                  {% get_person_list persons %} 
   58 :             {% endblock %}
   59 :         &lt;/div&gt;
   60 :         &lt;div class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 main"&gt;
   61 :          {% block body_block %}{% endblock %}
   62 : 
   63 : 
   64 :         &lt;/div&gt;
   65 :       &lt;/div&gt;
   66 :     &lt;/div&gt;
   67 : 


Traceback:

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/library.py" in parse_bits
  296.                     unhandled_params.pop(0)

During handling of the above exception (pop from empty list), another exception occurred:

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  174.                     response = self.process_exception_by_middleware(e, request)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  172.                     response = response.render()

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/response.py" in render
  160.             self.content = self.rendered_content

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/response.py" in rendered_content
  137.         content = template.render(context, self._request)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loader_tags.py" in render
  151.         compiled_parent = self.get_parent(context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loader_tags.py" in get_parent
  148.         return self.find_template(parent, context)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loader_tags.py" in find_template
  128.             template_name, skip=history,

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/engine.py" in find_template
  157.                         name, template_dirs=dirs, skip=skip,

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loaders/base.py" in get_template
  46.                     contents, origin, origin.template_name, self.engine,

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in __init__
  189.         self.nodelist = self.compile_nodelist()

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in compile_nodelist
  231.             return parser.parse()

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in parse
  516.                     raise self.error(token, e)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in parse
  514.                     compiled_result = compile_func(self, token)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/loader_tags.py" in do_block
  241.     nodelist = parser.parse(('endblock',))

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in parse
  516.                     raise self.error(token, e)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/base.py" in parse
  514.                     compiled_result = compile_func(self, token)

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/library.py" in compile_func
  163.                     takes_context, function_name,

File "/home/ohid/test_venv/lib/python3.5/site-packages/django/template/library.py" in parse_bits
  301.                             name)

Exception Type: TemplateSyntaxError at /person/
Exception Value: 'get_person_list' received too many positional arguments
</code></pre>

<p>How do I fix this error and make link in the sidebar so that it gives the full view of person_list template?</p>

<p>Any help will be much appreciated.</p>

<p>There are too many issues with your code to correctly identify what is the problem.</p>

<ol>
<li><p>You have an extra comma in your custom tag:</p>

<pre><code>@register.inclusion_tag('member/person_list.html')
def get_person_list():
    persons= Person.objects.all(), # &lt;-- remove this comma
    return {'persons': persons}
</code></pre></li>
<li><p>Your context variable is called <code>persons</code>, yet you are using <code>object_list</code> in your template, this needs to be corrected.</p></li>
<li><p>Your template has a for loop, but its missing a <code>endfor</code></p></li>
<li><p>You have <code>{% url 'member:person-list' %}</code> this is a <a href="https://docs.djangoproject.com/en/1.10/topics/http/urls/#url-namespaces" rel="nofollow">namespaced URL</a>. Make you have <a href="https://docs.djangoproject.com/en/1.10/intro/tutorial03/#namespacing-url-names" rel="nofollow">set it up correctly</a> in your <code>urls.py</code>.</p></li>
<li><p>Your tag doesn't take any arguments, yet you are passing it a context variable in <code>{% get_person_list persons %}</code>.</p></li>
</ol>

<p>Once you solve all these, you have to figure out where the actual error is coming from. Chances are, it is in your base template which you are inheriting as its obvious you don't have a <code>registration_register</code> url tag in the code you have posted.</p>

python django