Commit 1fa802ca authored by Nate Brevin A. Que's avatar Nate Brevin A. Que

Implemented the 'Edit Assignment Page'

parent 897d7c6b
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
</h3> </h3>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<input type="submit" value="Edit Assignment"> <a href="/assignments/{{ assignment.pk }}/edit"><input type="submit" value="Edit Assignment"></a>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Changes to Assignment">
</form>
{% endblock %}
{% block scripts %}
{% endblock %}
\ No newline at end of file
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from .views import index, AssignmentDetailView, AssignmentCreateView from .views import index, AssignmentDetailView, AssignmentCreateView, AssignmentUpdateView
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-details'), path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-details'),
path('add/', AssignmentCreateView.as_view(), name='add-assignment'), path('add/', AssignmentCreateView.as_view(), name='add-assignment'),
path('<int:pk>/edit', AssignmentUpdateView.as_view(), name='edit-assignment'),
] ]
app_name = "assignments" app_name = "assignments"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView from django.views.generic.edit import CreateView, UpdateView
from .models import Assignment from .models import Assignment
...@@ -20,3 +20,9 @@ class AssignmentCreateView(CreateView): ...@@ -20,3 +20,9 @@ class AssignmentCreateView(CreateView):
model = Assignment model = Assignment
fields = '__all__' fields = '__all__'
template_name = 'assignments/assignment-add.html' template_name = 'assignments/assignment-add.html'
class AssignmentUpdateView(UpdateView):
model = Assignment
fields = '__all__'
template_name = 'assignments/assignment-edit.html'
\ No newline at end of file
No preview for this file type
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