[Django]-DJango URL Reverse Error: argument to reversed() must be a sequence

6👍

✅

You don’t have a URL called “index”, you have one called “Index”.

And in your common/urls, you are using {} instead of [] to wrap the patterns.

In future, please post each question separately.

2👍

Query-1 Solution:

You have Index defined as the reverse name for the HomePage view in the urls but you are using index as the reverse name for the url in your template.
Change index to Index and your code will work.

<a class="btn btn-default-ar" href="{% url 'common:Index' %}">

Index will default to application namespace i.e common so accessing the reversed url by common namespace.

You can even do the opposite that is changing the reverse name in your urls to index without any change in the template. It will work.

Query-2 Solution:

Urlpatterns defined in the urls.py file should be a list of patterns. As Gocht mentioned in the comment, try changing the urlpatterns defined in common app urls to a list [].

common/urls.py

from django.conf.urls import url
from .views import QuerySchoolView

urlpatterns = [
    url(r'^querySchool/(?P<q>[a-z]*)$', QuerySchoolView.as_view(), name='querySchool'),
]

Leave a comment