Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
What does it mean by object not reversible Django

I'm just trying to make a simple connection to another page using the url tag in Django. I'm getting a error of "'set' object is not reversible". After searching for a bit I've been unsuccessful in finding anything.

urls.py

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

APP_NAME = 'website'
urlpatterns = {
    url(r'^$', views.admin_view, name='adminview'),
    url(r'^eventview/$', views.event_view, name='eventview'),
}

admin_view.html

<!DOCTYPE html>
<html lang="en" >
<head>
{% load static %}
  {% block header%}
  {% include 'website/header.html' %}
  {% endblock %}

  <!-- Insert custom css here -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<!-- top navbar -->
  <nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">

      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">Vivid Fireworks</a>
      </div>

      <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-right">
          <li><a href="{% url adminview %}">Dashboard</a></li>
          <li><a href="{% url eventview %}">Add Show</a></li>
          <li><a href="#">Settings</a></li>
          <li><a href="#">Profile</a></li>
          <li><a href="#">Help</a></li>
        </ul>
      </div>
    </div>
  </nav>

I haven't ran into this problem before and it seems like it'll be a simple fix just something I'm over looking. Any help is appreciated.

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

urlpatterns should be a list [...]. You currently have a set {...}. It should be:

urlpatterns = [
    url(r'^$', views.admin_view, name='adminview'),
    url(r'^eventview/$', views.event_view, name='eventview'),
]

In the template, you should use quotes when the url pattern name is a string:

{% url 'adminview' %}
{% url 'eventview' %}

If you want to use namespaces, then app_name should be lowercase.

app_name = 'website'
url_patterns = [
    ...
]

You then need to include the namespace when you use the url tag

{% url 'website:adminview' %}
{% url 'website:eventview' %}
about 4 years ago · Santiago Trujillo Report

0

  • **Change url to path if you have django version 2.0 **
about 4 years ago · Santiago Trujillo Report

0

in URLpatterns, make the change from {} to [] that will solve

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!