Commit 364eae17 authored by Jose Gabriel L. Salas's avatar Jose Gabriel L. Salas

fixed formatting errors in views and urls.py

parent 32bda5ca
...@@ -3,9 +3,9 @@ from .views import (calendar, EventDetailView, EventCreateView, EventUpdateView) ...@@ -3,9 +3,9 @@ from .views import (calendar, EventDetailView, EventCreateView, EventUpdateView)
urlpatterns = [ urlpatterns = [
path('calendar/', calendar, name='calendar'), path('calendar/', calendar, name='calendar'),
path('calendar/events/<int:pk>/details/', EventDetailView, name='event-details'), path('calendar/events/<int:pk>/details/', EventDetailView.as_view(), name='event-details'),
path('calendar/events/add/', EventCreateView, name='event-add'), path('calendar/events/add/', EventCreateView.as_view(), name='event-add'),
path('calendar/events/<int:pk>/edit/', EventUpdateView, name='event-edit'), path('calendar/events/<int:pk>/edit/', EventUpdateView.as_view(), name='event-edit'),
] ]
# This might be needed, depending on your Django version # This might be needed, depending on your Django version
......
...@@ -7,20 +7,20 @@ from django.views.generic.edit import CreateView, UpdateView ...@@ -7,20 +7,20 @@ from django.views.generic.edit import CreateView, UpdateView
def index(request): def calendar(request):
activities = Event.objects.all() activities = Event.objects.all()
return render(request, 'calendar/calendar.html', {'activities':activities}) return render(request, 'widget_calendar/calendar.html', {'activities':activities})
class EventDetailView(DetailView): class EventDetailView(DetailView):
model = Event model = Event
template_name = "calendar/event-details.html" template_name = "widget_calendar/event-details.html"
class EventCreateView(CreateView): class EventCreateView(CreateView):
model = Event model = Event
fields = '__all__' fields = '__all__'
template_name = "calendar/event-add.html" template_name = "widget_calendar/event-add.html"
class EventUpdateView(UpdateView): class EventUpdateView(UpdateView):
model = Event model = Event
fields = '__all__' fields = '__all__'
template_name = 'calendar/event-edit.html' template_name = 'widget_calendar/event-edit.html'
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment