diff --git a/CodeReview/settings.py b/CodeReview/settings.py index 594a1ee..0057475 100644 --- a/CodeReview/settings.py +++ b/CodeReview/settings.py @@ -116,4 +116,5 @@ if DEBUG: '127.0.0.1' ] import mimetypes + mimetypes.add_type("text/javascript", '.js') diff --git a/Main/migrations/0001_initial.py b/Main/migrations/0001_initial.py index c1024c9..cfdf11d 100644 --- a/Main/migrations/0001_initial.py +++ b/Main/migrations/0001_initial.py @@ -1,13 +1,13 @@ # Generated by Django 3.2.7 on 2021-09-28 17:23 +import uuid + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import uuid class Migration(migrations.Migration): - initial = True dependencies = [ @@ -32,14 +32,19 @@ class Migration(migrations.Migration): fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('schoology_id', models.CharField(max_length=10, null=True)), - ('status', models.IntegerField(choices=[('0', 'Open'), ('1', 'Taken'), ('2', 'Completed')], default='0')), + ('status', + models.IntegerField(choices=[('0', 'Open'), ('1', 'Taken'), ('2', 'Completed')], default='0')), ('scores', models.CharField(default='', max_length=100)), ('additional_comments', models.TextField(blank=True, null=True)), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_completed', models.DateTimeField(blank=True, null=True)), - ('reviewer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reviewer', to=settings.AUTH_USER_MODEL)), - ('rubric', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_rubric', to='Main.rubric')), - ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL)), + ('reviewer', + models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reviewer', + to=settings.AUTH_USER_MODEL)), + ('rubric', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='source_rubric', + to='Main.rubric')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', + to=settings.AUTH_USER_MODEL)), ], options={ 'abstract': False, diff --git a/Main/migrations/0002_remove_rubric_max_score.py b/Main/migrations/0002_remove_rubric_max_score.py index 7472d71..d88d392 100644 --- a/Main/migrations/0002_remove_rubric_max_score.py +++ b/Main/migrations/0002_remove_rubric_max_score.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('Main', '0001_initial'), ] diff --git a/Main/migrations/0003_auto_20210930_1309.py b/Main/migrations/0003_auto_20210930_1309.py index 91fb3a5..2f1e603 100644 --- a/Main/migrations/0003_auto_20210930_1309.py +++ b/Main/migrations/0003_auto_20210930_1309.py @@ -1,12 +1,12 @@ # Generated by Django 3.2.7 on 2021-09-30 17:09 -from django.db import migrations, models -import django.db.models.deletion import uuid +import django.db.models.deletion +from django.db import migrations, models + class Migration(migrations.Migration): - dependencies = [ ('Main', '0002_remove_rubric_max_score'), ] diff --git a/Main/templates/base.html b/Main/templates/base.html index 48834d4..9a3648e 100644 --- a/Main/templates/base.html +++ b/Main/templates/base.html @@ -14,12 +14,12 @@ {% endblock %} - {# Navigation goes here #} - {# For now it'll be a list of links #} -

Test site

- {% block mainContent %} +{# Navigation goes here #} +{# For now it'll be a list of links #} +

Test site

+{% block mainContent %} - {% endblock %} - {# Footer goes here #} +{% endblock %} +{# Footer goes here #} \ No newline at end of file diff --git a/Main/templates/widgets/attrs.html b/Main/templates/widgets/attrs.html index de4712e..3f0368b 100644 --- a/Main/templates/widgets/attrs.html +++ b/Main/templates/widgets/attrs.html @@ -1,3 +1,2 @@ - {% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}"{% endif %}{% endif %}{% endfor %} \ No newline at end of file diff --git a/Main/templates/widgets/create_rubric.html b/Main/templates/widgets/create_rubric.html index 961d5fd..5795f1a 100644 --- a/Main/templates/widgets/create_rubric.html +++ b/Main/templates/widgets/create_rubric.html @@ -2,8 +2,8 @@ value="{{ widget.value|default_if_none:"{}" }}" {% include "widgets/attrs.html" %}/> - - + +
CategoryScoresCategoryScores
diff --git a/Main/templatetags/rubric_tags.py b/Main/templatetags/rubric_tags.py index 7dfdd3c..4bd3b15 100644 --- a/Main/templatetags/rubric_tags.py +++ b/Main/templatetags/rubric_tags.py @@ -1,4 +1,3 @@ from django import template -from django.template.loader import render_to_string register = template.Library() diff --git a/Main/views.py b/Main/views.py index 299e933..d32dc70 100644 --- a/Main/views.py +++ b/Main/views.py @@ -1,6 +1,7 @@ -from django.shortcuts import redirect, render, get_object_or_404 from typing import Union + from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import redirect, render, get_object_or_404 from . import models, forms diff --git a/README.md b/README.md index 80b5a96..e61d7d3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,32 @@ [![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/made-with-javascript.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/powered-by-black-magic.svg)](https://forthebadge.com) -# CodeReview + +# CodeReview + Code Review Workflow for IT Programming at BCTC West -## Abstract -### Flow -Through this web interface, students will be able to request a code reviews and enter them into a bounty-like system. Seniors will then be notified of this post and a senior can claim a review. After the review has concluded the senior then fills out a rubric and enters their additional notes/comments. Finally, the instructor will then be able to take that data and enter the grades into another grading system accordingly. + +## Abstract + +### Flow + +Through this web interface, students will be able to request a code reviews and enter them into a bounty-like system. +Seniors will then be notified of this post and a senior can claim a review. After the review has concluded the senior +then fills out a rubric and enters their additional notes/comments. Finally, the instructor will then be able to take +that data and enter the grades into another grading system accordingly. + ### UI -Basic material design layout and UI with primary, secondary, and accent colors. -## Technical -Using active directory, users will log in to post request for reviews, on posting an email will be sent to seniors and the instructor. Once a senior accepts the review, the instructor will receive an email. Upon completion of the code review, the instructor will get a final email with the notes the senior has given. -### Environment Variables + +Basic material design layout and UI with primary, secondary, and accent colors. + +## Technical + +Using active directory, users will log in to post request for reviews, on posting an email will be sent to seniors and +the instructor. Once a senior accepts the review, the instructor will receive an email. Upon completion of the code +review, the instructor will get a final email with the notes the senior has given. + +### Environment Variables + - DEV_STAGE: The current stage of development options are: Dev, Prod, and GitHub - PRODUCTION_HOST: The host to use in production - SECRET_KEY: Key to use in production as the django secret key @@ -21,26 +37,36 @@ Using active directory, users will log in to post request for reviews, on postin - DB_NAME: The name for the db we'll use - DB_PASS: The password for the db we'll use - LDAP_URL: The url of the ActiveDirectory Server we want to use for auth -- LDAP_USER: The username of the LDAP admin we want to login as -- LDAP_PASS: The password of the LDAP admin we want to login as -### Services Used -- [Python](https://www.python.org/) -- [Django](https://www.djangoproject.com/) +- LDAP_USER: The username of the LDAP admin we want to log in as +- LDAP_PASS: The password of the LDAP admin we want to log in as + +### Services Used + +- [Python](https://www.python.org/) +- [Django](https://www.djangoproject.com/) - [ActiveDirectory](https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/virtual-dc/active-directory-domain-services-overview) - [lapd3](https://pypi.org/project/ldap3/) - [Jquery](https://jquery.com/) - [FontAwesome](https://fontawesome.com/) -## Running -### Development + +## Running + +### Development + First, install all requirements in requirements.txt Then, simply run the django run command: ```python manage.py runserver YOUR_HOST:8080``` Development is insecure and inefficient, only use when testing + ### Production -Will require an SQL server to connect to, an ActiveDirectory server, an email to send notifications from, and a webserver to run the django code on. + +Will require an SQL server to connect to, an ActiveDirectory server, an email to send notifications from, and a +webserver to run the django code on. Set up your webserver and then point it to ```CodeReview/wsgi.py```. This will require [environment variables](#Environment-Variables) + ### Tests + Tests are available through the normal django interface, simply run ``` python manage.py runtests ``` diff --git a/Users/admin.py b/Users/admin.py index 8c38f3f..846f6b4 100644 --- a/Users/admin.py +++ b/Users/admin.py @@ -1,3 +1 @@ -from django.contrib import admin - # Register your models here. diff --git a/Users/migrations/0001_initial.py b/Users/migrations/0001_initial.py index ca130c9..2e5eab8 100644 --- a/Users/migrations/0001_initial.py +++ b/Users/migrations/0001_initial.py @@ -1,14 +1,14 @@ # Generated by Django 3.2.7 on 2021-09-09 18:31 +import uuid + import django.contrib.auth.models import django.contrib.auth.validators -from django.db import migrations, models import django.utils.timezone -import uuid +from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -21,17 +21,32 @@ class Migration(migrations.Migration): fields=[ ('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')), + ('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=150, 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')), + ('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')), ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), - ('groups', 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')), - ('user_permissions', 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')), + ('groups', 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')), + ('user_permissions', 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')), ], options={ 'verbose_name': 'user', diff --git a/Users/migrations/0002_user_reviewer.py b/Users/migrations/0002_user_reviewer.py index 554be01..f2ae3f4 100644 --- a/Users/migrations/0002_user_reviewer.py +++ b/Users/migrations/0002_user_reviewer.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('Users', '0001_initial'), ] diff --git a/Users/migrations/0003_rename_reviewer_user_is_reviewer.py b/Users/migrations/0003_rename_reviewer_user_is_reviewer.py index ac70b98..759f7b2 100644 --- a/Users/migrations/0003_rename_reviewer_user_is_reviewer.py +++ b/Users/migrations/0003_rename_reviewer_user_is_reviewer.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('Users', '0002_user_reviewer'), ] diff --git a/Users/models.py b/Users/models.py index 7f53a34..b695edb 100644 --- a/Users/models.py +++ b/Users/models.py @@ -1,10 +1,10 @@ from uuid import uuid4 -from django.db import models from django.contrib.auth.models import AbstractUser +from django.db import models -class User (AbstractUser): +class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid4) is_reviewer = models.BooleanField(default=False) diff --git a/Users/tests.py b/Users/tests.py index 7ce503c..a39b155 100644 --- a/Users/tests.py +++ b/Users/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # Create your tests here. diff --git a/Users/urls.py b/Users/urls.py index 6f9e00e..47c78e7 100644 --- a/Users/urls.py +++ b/Users/urls.py @@ -1,5 +1,3 @@ -from django.urls import path - urlpatterns = [ -] \ No newline at end of file +] diff --git a/Users/views.py b/Users/views.py index 91ea44a..60f00ef 100644 --- a/Users/views.py +++ b/Users/views.py @@ -1,3 +1 @@ -from django.shortcuts import render - # Create your views here. diff --git a/tests/test_rubric.py b/tests/test_rubric.py index 7feb784..d47bea4 100644 --- a/tests/test_rubric.py +++ b/tests/test_rubric.py @@ -1,8 +1,8 @@ -from Main.models import Rubric, RubricRow, RubricCell -from Main.forms import RubricForm - from django.test import TestCase +from Main.forms import RubricForm +from Main.models import Rubric, RubricRow, RubricCell + class RubricValidation(TestCase):