diff options
author | adityacp | 2020-03-04 17:11:20 +0530 |
---|---|---|
committer | adityacp | 2020-03-04 17:11:20 +0530 |
commit | 674c81d9e1d3499e255e8995701fb65d1358a0ac (patch) | |
tree | 72a46393825b06607cc81cc0c8d3af1f50babbbf /grades/views.py | |
parent | f85fbae3c76595a8f2039a60c0e7051d39dfe643 (diff) | |
download | online_test-674c81d9e1d3499e255e8995701fb65d1358a0ac.tar.gz online_test-674c81d9e1d3499e255e8995701fb65d1358a0ac.tar.bz2 online_test-674c81d9e1d3499e255e8995701fb65d1358a0ac.zip |
Change settings
- Add messages in grading systems page
- Add password validator in settings
- Fix naming in templates
Diffstat (limited to 'grades/views.py')
-rw-r--r-- | grades/views.py | 14 |
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 |