Commit ee2a8d9e authored by Angelo Alvarez's avatar Angelo Alvarez

Added Feature: Edit Activity

parent feb3c692
......@@ -10,7 +10,7 @@
<b>Mode: </b>{{ object.location.mode }} <br>
<b>Venue: </b>{{ object.location|urlize }} <br>
<form action="../events/edit">
<form action="../edit">
<button type="Submit">Edit Activity</button>
</form>
......
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Activity {% endblock %}
{% block content %}
<h1>Edit Activity</h1>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button type="Submit">Save New Activity</button>
</form>
{% endblock %}
\ No newline at end of file
# <appname>/urls.py
from django.urls import path
from .views import calendar, EventDetailView, EventCreateView
from .views import calendar, EventDetailView, EventCreateView, EventUpdateView
urlpatterns = [
path('', calendar, name='calendar'),
path('events/<int:pk>/details/', EventDetailView.as_view(), name='events-details'),
path('events/add/', EventCreateView.as_view(), name='add-event'),
path('events/<int:pk>/edit/', EventUpdateView.as_view(), name='edit-event'),
]
app_name = "calendar_app"
\ No newline at end of file
......@@ -3,7 +3,7 @@ from django.http import HttpResponse
from .models import Event
from django.utils import timezone
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.views.generic.edit import CreateView, UpdateView
# Create your views here.
......@@ -21,3 +21,8 @@ class EventCreateView(CreateView):
template_name = 'calendar_app/event-add.html'
model = Event
fields = ['activity', 'target_datetime', 'estimated_hours', 'location', 'course']
class EventUpdateView(UpdateView):
template_name = 'calendar_app/event-edit.html'
model = Event
fields = ['activity', 'target_datetime', 'estimated_hours', 'location', 'course']
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