diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..997aced --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +bin/ +build/ +develop-eggs/ +dist/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject + +# Rope +.ropeproject + +# Django stuff: +*.log +*.pot +*.sqlite3 +# Sphinx documentation +docs/_build/ \ No newline at end of file diff --git a/django_school/classroom/__pycache__/__init__.cpython-36.pyc b/django_school/classroom/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 1457f58..0000000 Binary files a/django_school/classroom/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/__init__.cpython-37.pyc b/django_school/classroom/__pycache__/__init__.cpython-37.pyc index 6570383..325f1dc 100644 Binary files a/django_school/classroom/__pycache__/__init__.cpython-37.pyc and b/django_school/classroom/__pycache__/__init__.cpython-37.pyc differ diff --git a/django_school/classroom/__pycache__/admin.cpython-36.pyc b/django_school/classroom/__pycache__/admin.cpython-36.pyc deleted file mode 100644 index 361d2c6..0000000 Binary files a/django_school/classroom/__pycache__/admin.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/admin.cpython-37.pyc b/django_school/classroom/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000..3c9a0d5 Binary files /dev/null and b/django_school/classroom/__pycache__/admin.cpython-37.pyc differ diff --git a/django_school/classroom/__pycache__/decorators.cpython-36.pyc b/django_school/classroom/__pycache__/decorators.cpython-36.pyc deleted file mode 100644 index 7b34c9d..0000000 Binary files a/django_school/classroom/__pycache__/decorators.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/decorators.cpython-37.pyc b/django_school/classroom/__pycache__/decorators.cpython-37.pyc index 85063f8..79f1ff4 100644 Binary files a/django_school/classroom/__pycache__/decorators.cpython-37.pyc and b/django_school/classroom/__pycache__/decorators.cpython-37.pyc differ diff --git a/django_school/classroom/__pycache__/forms.cpython-36.pyc b/django_school/classroom/__pycache__/forms.cpython-36.pyc deleted file mode 100644 index da8b2e2..0000000 Binary files a/django_school/classroom/__pycache__/forms.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/forms.cpython-37.pyc b/django_school/classroom/__pycache__/forms.cpython-37.pyc index 0a6ffc4..f2de822 100644 Binary files a/django_school/classroom/__pycache__/forms.cpython-37.pyc and b/django_school/classroom/__pycache__/forms.cpython-37.pyc differ diff --git a/django_school/classroom/__pycache__/models.cpython-36.pyc b/django_school/classroom/__pycache__/models.cpython-36.pyc deleted file mode 100644 index 3e8103e..0000000 Binary files a/django_school/classroom/__pycache__/models.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/models.cpython-37.pyc b/django_school/classroom/__pycache__/models.cpython-37.pyc index dc88bfa..4f640b7 100644 Binary files a/django_school/classroom/__pycache__/models.cpython-37.pyc and b/django_school/classroom/__pycache__/models.cpython-37.pyc differ diff --git a/django_school/classroom/__pycache__/urls.cpython-36.pyc b/django_school/classroom/__pycache__/urls.cpython-36.pyc deleted file mode 100644 index 275080f..0000000 Binary files a/django_school/classroom/__pycache__/urls.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/__pycache__/urls.cpython-37.pyc b/django_school/classroom/__pycache__/urls.cpython-37.pyc index bacdcab..c76a41a 100644 Binary files a/django_school/classroom/__pycache__/urls.cpython-37.pyc and b/django_school/classroom/__pycache__/urls.cpython-37.pyc differ diff --git a/django_school/classroom/admin.py b/django_school/classroom/admin.py index 44e3a69..59fbd94 100644 --- a/django_school/classroom/admin.py +++ b/django_school/classroom/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from classroom.models import User, Subject, Quiz, Question, Answer, Student, TakenQuiz, StudentAnswer +from classroom.models import User, Subject, Quiz, Question, Answer, Student, TakenQuiz, StudentAnswer, Selected_lists, Placement admin.site.register(User) admin.site.register(Subject) @@ -9,3 +9,5 @@ admin.site.register(Student) admin.site.register(TakenQuiz) admin.site.register(StudentAnswer) +admin.site.register(Placement) +admin.site.register(Selected_lists) diff --git a/django_school/classroom/forms.py b/django_school/classroom/forms.py index c7bdc0c..6f214fa 100644 --- a/django_school/classroom/forms.py +++ b/django_school/classroom/forms.py @@ -8,8 +8,12 @@ class TeacherSignUpForm(UserCreationForm): + first_name = forms.CharField(max_length=30, required=False) + last_name = forms.CharField(max_length=30, required=False) + email = forms.EmailField(max_length=254) class Meta(UserCreationForm.Meta): model = User + fields = ('email', 'username', 'first_name', 'last_name') def save(self, commit=True): user = super().save(commit=False) @@ -20,6 +24,9 @@ def save(self, commit=True): class StudentSignUpForm(UserCreationForm): + first_name = forms.CharField(max_length=30, required=False) + last_name = forms.CharField(max_length=30, required=False) + email = forms.EmailField(max_length=254) interests = forms.ModelMultipleChoiceField( queryset=Subject.objects.all(), widget=forms.CheckboxSelectMultiple, @@ -28,6 +35,7 @@ class StudentSignUpForm(UserCreationForm): class Meta(UserCreationForm.Meta): model = User + fields = ('email', 'username', 'first_name', 'last_name') @transaction.atomic def save(self): diff --git a/django_school/classroom/migrations/0001_initial.py b/django_school/classroom/migrations/0001_initial.py deleted file mode 100644 index eb439f8..0000000 --- a/django_school/classroom/migrations/0001_initial.py +++ /dev/null @@ -1,144 +0,0 @@ -# Generated by Django 2.0.1 on 2019-03-14 12:41 - -from django.conf import settings -import django.contrib.auth.models -import django.contrib.auth.validators -from django.db import migrations, models -import django.db.models.deletion -import django.utils.timezone - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('auth', '0009_alter_user_last_name_max_length'), - ] - - operations = [ - migrations.CreateModel( - name='User', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('is_student', models.BooleanField(default=False)), - ('is_teacher', models.BooleanField(default=False)), - ], - options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, - }, - managers=[ - ('objects', django.contrib.auth.models.UserManager()), - ], - ), - migrations.CreateModel( - name='Answer', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('text', models.CharField(max_length=255, verbose_name='Answer')), - ('is_correct', models.BooleanField(default=False, verbose_name='Correct answer')), - ], - ), - migrations.CreateModel( - name='Question', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('text', models.CharField(max_length=255, verbose_name='Question')), - ], - ), - migrations.CreateModel( - name='Quiz', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ], - ), - migrations.CreateModel( - name='StudentAnswer', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='classroom.Answer')), - ], - ), - migrations.CreateModel( - name='Subject', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=30)), - ('color', models.CharField(default='#007bff', max_length=7)), - ], - ), - migrations.CreateModel( - name='TakenQuiz', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('score', models.FloatField()), - ('date', models.DateTimeField(auto_now_add=True)), - ('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taken_quizzes', to='classroom.Quiz')), - ], - ), - migrations.CreateModel( - name='Student', - fields=[ - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)), - ('interests', models.ManyToManyField(related_name='interested_students', to='classroom.Subject')), - ], - ), - migrations.AddField( - model_name='quiz', - name='owner', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quizzes', to=settings.AUTH_USER_MODEL), - ), - migrations.AddField( - model_name='quiz', - name='subject', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quizzes', to='classroom.Subject'), - ), - migrations.AddField( - model_name='question', - name='quiz', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='classroom.Quiz'), - ), - migrations.AddField( - model_name='answer', - name='question', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='classroom.Question'), - ), - migrations.AddField( - model_name='user', - name='groups', - field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'), - ), - migrations.AddField( - model_name='user', - name='user_permissions', - field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'), - ), - migrations.AddField( - model_name='takenquiz', - name='student', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='taken_quizzes', to='classroom.Student'), - ), - migrations.AddField( - model_name='studentanswer', - name='student', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='quiz_answers', to='classroom.Student'), - ), - migrations.AddField( - model_name='student', - name='quizzes', - field=models.ManyToManyField(through='classroom.TakenQuiz', to='classroom.Quiz'), - ), - ] diff --git a/django_school/classroom/migrations/__pycache__/0001_initial.cpython-36.pyc b/django_school/classroom/migrations/__pycache__/0001_initial.cpython-36.pyc deleted file mode 100644 index 67651a5..0000000 Binary files a/django_school/classroom/migrations/__pycache__/0001_initial.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/migrations/__pycache__/0001_initial.cpython-37.pyc b/django_school/classroom/migrations/__pycache__/0001_initial.cpython-37.pyc index a4ef560..7a02be5 100644 Binary files a/django_school/classroom/migrations/__pycache__/0001_initial.cpython-37.pyc and b/django_school/classroom/migrations/__pycache__/0001_initial.cpython-37.pyc differ diff --git a/django_school/classroom/migrations/__pycache__/__init__.cpython-36.pyc b/django_school/classroom/migrations/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9e543e2..0000000 Binary files a/django_school/classroom/migrations/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/django_school/classroom/migrations/__pycache__/__init__.cpython-37.pyc b/django_school/classroom/migrations/__pycache__/__init__.cpython-37.pyc index aa4dd03..cb7c0e9 100644 Binary files a/django_school/classroom/migrations/__pycache__/__init__.cpython-37.pyc and b/django_school/classroom/migrations/__pycache__/__init__.cpython-37.pyc differ diff --git a/django_school/classroom/models.py b/django_school/classroom/models.py index 31fa36d..876ddf7 100644 --- a/django_school/classroom/models.py +++ b/django_school/classroom/models.py @@ -30,6 +30,13 @@ class Quiz(models.Model): def __str__(self): return self.name +class Placement(models.Model): + owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='placements') + company_name = models.CharField(max_length=255) + package = models.FloatField() + + def __str__(self): + return self.company_name class Question(models.Model): quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE, related_name='questions') @@ -38,7 +45,14 @@ class Question(models.Model): def __str__(self): return self.text +class Selected_lists(models.Model): + placement = models.ForeignKey(Placement, on_delete=models.CASCADE, related_name='selected_lists') + roll_no = models.CharField(max_length=10) + name = models.CharField(max_length=255) + def __str__(self): + return self.name + class Answer(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='answers') text = models.CharField('Answer', max_length=255) diff --git a/django_school/classroom/templates/classroom/teachers/Charts/chartjs.html b/django_school/classroom/templates/classroom/teachers/Charts/chartjs.html new file mode 100644 index 0000000..b5b44d0 --- /dev/null +++ b/django_school/classroom/templates/classroom/teachers/Charts/chartjs.html @@ -0,0 +1,62 @@ +{% extends 'base_teacher.html' %} +{% load static%} + + +
+ + {% block content %} +{{order}}
+ + {% endif %} +{% endblock %} diff --git a/django_school/classroom/templates/classroom/teachers/Placement/placement_add_form.html b/django_school/classroom/templates/classroom/teachers/Placement/placement_add_form.html new file mode 100644 index 0000000..0205dc1 --- /dev/null +++ b/django_school/classroom/templates/classroom/teachers/Placement/placement_add_form.html @@ -0,0 +1,23 @@ +{% extends 'base_teacher.html' %} + +{% load crispy_forms_tags %} + +{% block content %} + +You haven't added any list yet. Go ahead and add the placement list.
+| Company Name | +Package | +Applied Students | +Selected Students | + +|
|---|---|---|---|---|
| {{ placement.company_name }} | +{{ placement.package}} | ++ | {{ placement.selected_count }} | +|
| You haven't had any placement yet. | +||||
Are you sure you want to delete the placement "{{ placement.company_name }}"? There is no going back.
+ +{% endblock %} diff --git a/django_school/classroom/templates/classroom/teachers/Placement/student_change_form.html b/django_school/classroom/templates/classroom/teachers/Placement/student_change_form.html new file mode 100644 index 0000000..b50bd8b --- /dev/null +++ b/django_school/classroom/templates/classroom/teachers/Placement/student_change_form.html @@ -0,0 +1,64 @@ +{% extends 'base_teacher.html' %} + +{% load crispy_forms_tags crispy_forms_filters %} + +{% block content %} + +Are you sure you want to delete the student "{{ selected.name }} with roll no. {{selected.roll_no}} "? There is no going back.
+ +{% endblock %} diff --git a/django_school/classroom/urls.py b/django_school/classroom/urls.py index 078c5fb..09f154e 100644 --- a/django_school/classroom/urls.py +++ b/django_school/classroom/urls.py @@ -13,13 +13,21 @@ ], 'classroom'), namespace='students')), path('teachers/', include(([ - path('', teachers.QuizListView.as_view(), name='quiz_change_list'), + path('', teachers.dashboard, name='dashboard'), + path('charts/', teachers.charts, name='charts'), + path('placement/', teachers.PlacementListView.as_view(), name='placement_change_list'), + path('list/', teachers.QuizListView.as_view(), name='quiz_change_list'), + path('placement/add/', teachers.PlacementCreateView.as_view(), name='placement_add'), path('quiz/add/', teachers.QuizCreateView.as_view(), name='quiz_add'), + path('placement/