From 29f93bce956af26e1b3ffe5ffc04e02c9f32de59 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Thu, 2 Jan 2020 15:34:18 +0530
Subject: Change UI in add grades template
---
grades/forms.py | 33 +++++++++++-
grades/models.py | 3 ++
grades/templates/add_grades.html | 97 +++++++++++++++++++++++++++--------
grades/templates/grading_systems.html | 46 ++++++++++++++++-
grades/views.py | 6 +--
5 files changed, 159 insertions(+), 26 deletions(-)
(limited to 'grades')
diff --git a/grades/forms.py b/grades/forms.py
index 130659d..4f9c9a7 100644
--- a/grades/forms.py
+++ b/grades/forms.py
@@ -1,8 +1,39 @@
-from grades.models import GradingSystem
+from grades.models import GradingSystem, GradeRange
from django import forms
class GradingSystemForm(forms.ModelForm):
+
+ def __init__(self, *args, **kwargs):
+ super(GradingSystemForm, self).__init__(*args, **kwargs)
+ self.fields['name'].widget.attrs.update(
+ {'class': "form-control", 'placeholder': 'Grading Name'}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': "form-control",
+ 'placeholder': 'Grading description'}
+ )
class Meta:
model = GradingSystem
fields = ['name', 'description']
+
+
+class GradeRangeForm(forms.ModelForm):
+ def __init__(self, *args, **kwargs):
+ super(GradeRangeForm, self).__init__(*args, **kwargs)
+ self.fields['lower_limit'].widget.attrs.update(
+ {'class': "form-control", 'placeholder': 'Lower limit'}
+ )
+ self.fields['upper_limit'].widget.attrs.update(
+ {'class': "form-control", 'placeholder': 'Upper limit'}
+ )
+ self.fields['grade'].widget.attrs.update(
+ {'class': "form-control", 'placeholder': 'Grade'}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': "form-control",
+ 'placeholder': 'Description'}
+ )
+ class Meta:
+ model = GradeRange
+ fields = "__all__"
diff --git a/grades/models.py b/grades/models.py
index fcea510..b395a24 100644
--- a/grades/models.py
+++ b/grades/models.py
@@ -44,3 +44,6 @@ class GradeRange(models.Model):
upper_limit = models.FloatField()
grade = models.CharField(max_length=10)
description = models.CharField(max_length=127, null=True, blank=True)
+
+ def __str__(self):
+ return self.system.name.title()
diff --git a/grades/templates/add_grades.html b/grades/templates/add_grades.html
index a3f52da..d05a9bb 100644
--- a/grades/templates/add_grades.html
+++ b/grades/templates/add_grades.html
@@ -1,9 +1,51 @@
{% extends "manage.html" %}
+{% load custom_filters %}
+{% block title %} Add/Edit Grading {% endblock %}
{% block main %}
- Back to Grading Systems
-
-
Note: For grade range lower limit is inclusive and upper limit is exclusive
+
+
+
+
+ Note: For grade range lower limit is inclusive and upper limit is exclusive
+
{% if not system_id %}
{% endblock %}
diff --git a/grades/templates/grading_systems.html b/grades/templates/grading_systems.html
index 3a71ebf..8129c72 100644
--- a/grades/templates/grading_systems.html
+++ b/grades/templates/grading_systems.html
@@ -1,8 +1,50 @@
{% extends "manage.html" %}
+{% block title %} View Grading Systems {% endblock %}
{% block main %}
- Add a Grading System
- Back to Courses
+
+
+
+
+ Add a Grading System
+
Available Grading Systems:
diff --git a/grades/views.py b/grades/views.py
index 67844bd..7403e4e 100644
--- a/grades/views.py
+++ b/grades/views.py
@@ -1,7 +1,7 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.forms import inlineformset_factory
-from grades.forms import GradingSystemForm
+from grades.forms import GradingSystemForm, GradeRangeForm
from grades.models import GradingSystem, GradeRange
@@ -21,7 +21,7 @@ def add_grading_system(request, system_id=None):
if system_id is not None:
grading_system = GradingSystem.objects.get(id=system_id)
GradeRangeFormSet = inlineformset_factory(GradingSystem, GradeRange,
- fields='__all__', extra=0)
+ GradeRangeForm, extra=0)
grade_form = GradingSystemForm(instance=grading_system)
is_default = (grading_system is not None and
grading_system.name == 'default')
@@ -38,7 +38,7 @@ def add_grading_system(request, system_id=None):
formset.save()
if 'add' in request.POST:
GradeRangeFormSet = inlineformset_factory(
- GradingSystem, GradeRange, fields='__all__', extra=1
+ GradingSystem, GradeRange, GradeRangeForm, extra=1
)
formset = GradeRangeFormSet(instance=grading_system)
--
cgit
From eb05d4b0bc3fd0e2ce5160f30251bd9b939ccef6 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Thu, 2 Jan 2020 15:56:43 +0530
Subject: Show the grading ranges in a single line
---
grades/templates/add_grades.html | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
(limited to 'grades')
diff --git a/grades/templates/add_grades.html b/grades/templates/add_grades.html
index d05a9bb..97c3c47 100644
--- a/grades/templates/add_grades.html
+++ b/grades/templates/add_grades.html
@@ -60,21 +60,24 @@
{% endfor %}
{{ formset.management_form }}
-
+
{% for form in formset %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
Grade Range {{forloop.counter}}.
-
- {% for field in form.visible_fields %}
- {% if field.field.widget|is_checkbox %}
- {{field.label}}
- {% endif %}
- {{ field }}
-
- {% endfor %}
-
+
+
+ {% for field in form.visible_fields %}
+
+ {% if field.field.widget|is_checkbox %}
+ {{ field.label_tag }}
+ {% endif %}
+ {{ field }}
+
+ {% endfor %}
+
+
{% endfor %}
--
cgit
From 664fa46ba041ebdc5912a3bf125056bbc52b1f95 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Fri, 3 Jan 2020 11:17:04 +0530
Subject: Remove unncessary break html tags and add bootstrap custom file input
---
grades/templates/add_grades.html | 6 +++++-
grades/templates/grading_systems.html | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
(limited to 'grades')
diff --git a/grades/templates/add_grades.html b/grades/templates/add_grades.html
index 97c3c47..6a9dec9 100644
--- a/grades/templates/add_grades.html
+++ b/grades/templates/add_grades.html
@@ -1,9 +1,9 @@
{% extends "manage.html" %}
{% load custom_filters %}
{% block title %} Add/Edit Grading {% endblock %}
+{% block pagetitle %} Add/Edit Grading {% endblock %}
{% block main %}
-
+
+ View Grading Systems
+
+
Note: For grade range lower limit is inclusive and upper limit is exclusive
diff --git a/grades/templates/grading_systems.html b/grades/templates/grading_systems.html
index 8129c72..0b26e8e 100644
--- a/grades/templates/grading_systems.html
+++ b/grades/templates/grading_systems.html
@@ -1,8 +1,8 @@
{% extends "manage.html" %}
{% block title %} View Grading Systems {% endblock %}
+{% block pagetitle %} View Grading Systems {% endblock %}
{% block main %}
-
--
cgit
From d0c08efb57d0b83845ebccf67df09e798791c6e3 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Tue, 11 Feb 2020 15:12:49 +0530
Subject: Change templates, urls, views
- Remove separate tab for allotted courses in moderator dashboard
- Remove separate tab for enrolled courses in student dashboard
- Increase pagination items for courses
- Remove view function for allotted courses
---
grades/templates/grading_systems.html | 5 -----
1 file changed, 5 deletions(-)
(limited to 'grades')
diff --git a/grades/templates/grading_systems.html b/grades/templates/grading_systems.html
index 0b26e8e..8102230 100644
--- a/grades/templates/grading_systems.html
+++ b/grades/templates/grading_systems.html
@@ -11,11 +11,6 @@
My Courses
- -
-
- Allotted Courses
-
-
-
Add New Course
--
cgit
From 687a1a676eadbda5c57f3387fbaa8dd3e9359511 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Wed, 12 Feb 2020 14:20:23 +0530
Subject: Fix views tests
---
grades/templates/add_grades.html | 5 -----
1 file changed, 5 deletions(-)
(limited to 'grades')
diff --git a/grades/templates/add_grades.html b/grades/templates/add_grades.html
index 6a9dec9..59a344d 100644
--- a/grades/templates/add_grades.html
+++ b/grades/templates/add_grades.html
@@ -12,11 +12,6 @@
My Courses
- -
-
- Allotted Courses
-
-
-
Add New Course
--
cgit
From fcfd868e44f0c768d05ef0dd58c72e46f9cbee61 Mon Sep 17 00:00:00 2001
From: adityacp
Date: Wed, 19 Feb 2020 12:13:38 +0530
Subject: Fix pep style and add test case in test_models
---
grades/forms.py | 1 +
1 file changed, 1 insertion(+)
(limited to 'grades')
diff --git a/grades/forms.py b/grades/forms.py
index 4f9c9a7..745abff 100644
--- a/grades/forms.py
+++ b/grades/forms.py
@@ -34,6 +34,7 @@ class GradeRangeForm(forms.ModelForm):
{'class': "form-control",
'placeholder': 'Description'}
)
+
class Meta:
model = GradeRange
fields = "__all__"
--
cgit