Created event-add page html with create view

parent 84f882ed
......@@ -14,7 +14,7 @@
{% endfor %}
</ul>
<button onclick="window.location.href='#';">
<button onclick="window.location.href='{% url 'calendar:event-add' %}';">
New Activity
</button>
......
+{% extends 'base.html' %}
{% load static %}
{% block title %} Add Activity {% endblock %}
{% block heading %}
<h1 class="subheader"> Add a new activity: </h1>
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
<div class="form-fields"> {{ form.as_p }} </div>
<div class="separator-bar"></div>
<input class="action-button" type="submit" value="Save New Activity">
</form>
{% endblock %}
\ No newline at end of file
+{% extends 'base.html' %}
{% load static %}
{% block title %} {{ event.activity }} {% endblock %}
{% block title %} {{ object.activity }} {% endblock %}
{% block heading %}
<p id="uppercase">
<span id="white">
{{ event.activity}}
{{ object.activity }}
</span>
</p>
{% endblock %}
{% block content %}
<div id="main">
{% for event in object.events.all %}
<p id="subheading"> {{ event.target_datetime }} </p>
<p> {{ event.estimated_hours }} </p>
<p> {{ event.course }} </p>
......
from django.urls import path
from .views import index, EventDetailView
from .views import index, EventDetailView, EventCreateView
urlpatterns = [
path('', index, name='index'),
path('calendar/', index, name='index'),
path('events/<int:pk>/details', EventDetailView.as_view(), name='user-details'),
path('events/add', EventCreateView.as_view(), name='forumpost-add'),
]
......
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
from .models import Event, Location
......@@ -13,3 +15,9 @@ def index(request):
class EventDetailView(DetailView):
model = Event
template_name = 'calendar/event-details.html'
class EventCreateView(CreateView):
model = Event
template_name = 'calendar/event-add.html'
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