Hi everyone,
I'm facing an issue with my Django project and I could really use some help. I've been getting the following error:
php
Copy code
Exception Type: TypeError at /tasks/add
Exception Value: 'set' object is not reversible
Here are the details of my setup:
tasks/urls.py:
python
Copy code
from django.urls import path
from . import views
app_name = "tasks"
urlpatterns = [
path("", views.index, name="index"),
path("add", views.add, name="add")
]
tasks/views.py:
python
Copy code
from django.shortcuts import render
tasks = ["foo", "bar", "baz"]
def index(request):
return render(request, "tasks/index.html", {
"tasks": tasks
})
def add(request):
return render(request, "tasks/add.html")
tasks/templates/tasks/index.html:
html
Copy code
{% extends "tasks/layout.html" %}
{% block body %}
{% for task in tasks %}
- {{ task }}
{% endfor %}
Add a New Task
{% endblock %}
tasks/templates/tasks/add.html:
html
Copy code
{% extends "tasks/layout.html" %}
{% block body %}
Add a new task
View Tasks
{% endblock %}
tasks/templates/tasks/layout.html:
html
Copy code
Tasks
{% block body %}{% endblock %}
Project URLs (project/urls.py):
python
Copy code
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('tasks/', include('tasks.urls')),
]
Django Version: 5.0.7
Python Version: 3.10.12
I've tried checking all my URL configurations and template paths, but the error persists. Any insights or suggestions on what might be causing this 'set' object is not reversible error would be greatly appreciated.
Thanks in advance for your help!