summaryrefslogtreecommitdiff
path: root/grades/views.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-03-20 11:12:52 +0530
committerGitHub2020-03-20 11:12:52 +0530
commite8573822d3ed25306d5d2faf946633f2c17997b0 (patch)
treec75b5d2730a74191f2c7e51a881e9404f5627c1d /grades/views.py
parent1dbaec7dd8098701e11713faa0c9040a315e5fac (diff)
parent36f43151ab26744cf9edc05d0df3f0fb901fcaaa (diff)
downloadonline_test-e8573822d3ed25306d5d2faf946633f2c17997b0.tar.gz
online_test-e8573822d3ed25306d5d2faf946633f2c17997b0.tar.bz2
online_test-e8573822d3ed25306d5d2faf946633f2c17997b0.zip
Merge pull request #655 from adityacp/bump_django
Bump django version to 3.0.3
Diffstat (limited to 'grades/views.py')
-rw-r--r--grades/views.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/grades/views.py b/grades/views.py
index 7403e4e..48cd8e3 100644
--- a/grades/views.py
+++ b/grades/views.py
@@ -1,6 +1,7 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.forms import inlineformset_factory
+from django.contrib import messages
from grades.forms import GradingSystemForm, GradeRangeForm
from grades.models import GradingSystem, GradeRange
@@ -30,12 +31,13 @@ def add_grading_system(request, system_id=None):
formset = GradeRangeFormSet(request.POST, instance=grading_system)
grade_form = GradingSystemForm(request.POST, instance=grading_system)
if grade_form.is_valid():
- system = grade_form.save(commit=False)
- system.creator = user
- system.save()
- system_id = system.id
- if formset.is_valid():
- formset.save()
+ grading_system = grade_form.save(commit=False)
+ grading_system.creator = user
+ grading_system.save()
+ system_id = grading_system.id
+ if formset.is_valid():
+ formset.save()
+ messages.success(request, "Grading system saved successfully")
if 'add' in request.POST:
GradeRangeFormSet = inlineformset_factory(
GradingSystem, GradeRange, GradeRangeForm, extra=1