Commit 6b1f7ad6 authored by Deokhyun Lee's avatar Deokhyun Lee

now, edit view properly gets existing data and properly updates accordingly

parent 9dc25d9d
......@@ -4,6 +4,7 @@ from . import views
# url for assignments
urlpatterns = [
path('', views.assignments_view, name='assignment'),
path('<int:pk>/details', views.AssignmentDetailView.as_view(), name='assignment_details'),
path('add', views.AssignmentAddListView.as_view(), name="assignment_add" ),
path('<int:pk>/details', views.AssignmentDetailView.as_view(), name='assignment_details'),
path('<int:pk>/edit', views.AssignmentEditView.as_view(), name='assignment_edit'),
]
\ No newline at end of file
......@@ -29,11 +29,11 @@ class AssignmentAddListView(CreateView):
# pass the pk and redirect.
return redirect('assignment_details', pk = new_assignment.pk)
else:
return render(request, 'book_details.html', {'form': form})
return render(request, 'assignment_details.html', {'form': form})
# assignment for edditing CBV implementation.
class BookEditView(UpdateView):
model = Assignment()
class AssignmentEditView(UpdateView):
model = Assignment
form_class = AddAssignmentForm
template_name = 'assignment-edit.html'
......@@ -45,4 +45,4 @@ class BookEditView(UpdateView):
# pass the pk and redirect.
return redirect('assignment_details', pk = update_assignment.pk)
else:
return render(request, 'book_details.html', {'form': form})
\ No newline at end of file
return render(request, 'assignment_details.html', {'form': form})
\ 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