From 13bbc5b1c08c731db240900fafa491b700fe5648 Mon Sep 17 00:00:00 2001
From: "piotr.atyjaszyk" <piotrmk1@gmail.com>
Date: Wed, 11 Jan 2017 11:36:37 +0100
Subject: [PATCH] fixed a bug where editing a subject would duplicate it, fixed
 titles and headers in .html file

---
 smash/web/templates/subjects/edit.html | 6 +++---
 smash/web/views.py                     | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/smash/web/templates/subjects/edit.html b/smash/web/templates/subjects/edit.html
index 9f3ea88a..5acfa49e 100644
--- a/smash/web/templates/subjects/edit.html
+++ b/smash/web/templates/subjects/edit.html
@@ -7,9 +7,9 @@
   <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
 {% endblock styles %}
 
-{% block page_title %}'newsubject'{% endblock page_title %}
-{% block page_header %}New subject{% endblock page_header %}
-{% block page_description %}adding{% endblock page_description %}
+{% block page_title %}'editsubject'{% endblock page_title %}
+{% block page_header %}Edit subject{% endblock page_header %}
+{% block page_description %}editing{% endblock page_description %}
 
 {% block breadcrumb %}
 			  <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
diff --git a/smash/web/views.py b/smash/web/views.py
index 8d2163da..d3872684 100644
--- a/smash/web/views.py
+++ b/smash/web/views.py
@@ -73,7 +73,7 @@ def subjectdet(request, ids):
 def subjectedit(request, ids):
     SubjectFormSet = modelformset_factory(Subject , fields='__all__')
     if request.method == 'POST':
-        formset = SubjectEditForm(request.POST, request.FILES)
+        formset = SubjectEditForm(request.POST, request.FILES, instance=Subject.objects.get(id=ids))
         if formset.is_valid():
 			formset.save()
 			return redirect(subjects)
-- 
GitLab