Commit 791103a2 authored by Nate Brevin A. Que's avatar Nate Brevin A. Que

Implemented the 'Add New Assignment Page'

parent 99e2be94
{% extends 'base.html' %}
{% block title %}Add Assigment{% endblock %}
{% block content %}
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save New Assigment">
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
\ No newline at end of file
......@@ -10,7 +10,7 @@
</h3>
{% endblock %}
{% block scripts %}
<input type="submit" value="New Assignment"><br><br>
<a href="/assignments/add"><input type="submit" value="New Assignment"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/announcement">Announcements</a><br>
<a href="/forum">Forum</a><br>
......
from django.contrib import admin
from django.urls import path
from .views import index, AssignmentDetailView
from .views import index, AssignmentDetailView, AssignmentCreateView
urlpatterns = [
path('', index, name='index'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-details'),
path('add/', AssignmentCreateView.as_view(), name='add-assignment'),
]
app_name = "assignments"
\ No newline at end of file
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from .models import Assignment
......@@ -13,3 +14,9 @@ class AssignmentDetailView(DetailView):
def get(self, request, pk):
return render(request, 'assignments/assignment-details.html', {'assignment': self.model.objects.get(pk=pk)})
class AssignmentCreateView(CreateView):
model = Assignment
fields = '__all__'
template_name = 'assignments/assignment-add.html'
\ 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