How to create a view in a Django project with Python? I’m having errors

Asked

Viewed 125 times

2

I’m a beginner in Django.

I’m continuing a ready-made project in Django. I’m looking to add a schedule to the project using Full Calendar.

For this I already developed the template with the html file, I added the css and js file in Static, the same way it is done in the rest of the project.

To open this agenda, in the sidebar that exists in my project, inside templates, in the base file for all screens, I do so:

<li>
     <a href="{% url 'agenda:agendaview' %}">
          <i class="material-icons">&#xE878;</i>
          <span>Agenda</span>
     </a>
</li>

In my file Settings.py added the agenda app:

INSTALLED_APPS = [
     ...
    'djangosige.apps.agenda',
]

My agenda.html file, within templates > agenda is like this:

{%extends 'base/base.html'%}

{%block title%}Agenda{%endblock%}
{%block content%}

<div id='calendar'></div>

{%endblock%}

Inside the apps folder, I created a calendar folder, in the.py urls file I did this:

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

from djangosige.configs import DEBUG

app_name = 'agenda'
urlpatterns = [
    url(r'^$', views.IndexView.as_view(), name='agendaview'),
    ]

if DEBUG:
    urlpatterns += [
         url(r'^404/$', views.handler404),
         url(r'^500/$', views.handler500),
    ]

Now I need to create the view file, but I’m not knowing how, I’ve done several searches but I could not understand.

In short, I have a sidebar with several options (registrations, stock) and I want to add an agenda, this agenda is already working when I insert it on the program’s home page, now I want to create an agenda option only for it. With the files I’ve already created I’m getting the following error:

'agenda' is not a registered namespace

What am I doing wrong?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.