Edit Assignment Page has been created

parent 485821f3
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Assignment {% endblock %}
{% block content %}
<h1>Edit Assignment</h1>
<form action="" method="post">
{% csrf_token %}
{{ form }}
<input type="submit" value="Save Changes to Assignment">
</form>
{% endblock %}
\ No newline at end of file
from django.urls import path
from .views import (AssignmentView,
AssignmentsDetailView, AssignmentsCreateView)
AssignmentsDetailView, AssignmentsCreateView,
AssignmentsUpdateView)
urlpatterns = [
path('assignments/', AssignmentView, name="index"),
path('<pk>/details/', AssignmentsDetailView.as_view(), name='assignment-details'),
path('add/', AssignmentsCreateView.as_view(), name='assignment-add'),
path('<pk>/edit/', AssignmentsUpdateView.as_view(), name='assignment-edit')
]
app_name = "Assignments"
\ No newline at end of file
......@@ -19,18 +19,7 @@ class AssignmentsCreateView(CreateView):
fields = '__all__'
template_name = 'Assignments/assignment-add.html'
'''
def index(request):
head_string = "<h1>Widget's Assignment Page</h1>"
body_string = ""
for assignment in Assignment.objects.all():
body_string += '<p>Assignment Name: {}</br>'.format(assignment.name)
body_string += 'Description: {}</br>'.format(assignment.description)
body_string += 'Perfect Score: {}</br>'.format(assignment.perfect_score)
body_string += 'Passing Score: {}</br>'.format(assignment.passing_score)
body_string += 'Course/Section: {} {}-{}</br>'.format(assignment.course.code, assignment.course.title, assignment.course.section)
body_string += "</p>"
html_string = '<html><head>{}</head><body>{}</body></html>'.format(head_string, body_string)
return HttpResponse(html_string)
'''
\ No newline at end of file
class AssignmentsUpdateView(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