mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-20 17:50:16 -04:00
Merge branch 'master' into master
This commit is contained in:
commit
ea241d7242
38
Pipfile
38
Pipfile
|
@ -4,33 +4,33 @@ verify_ssl = true
|
||||||
name = "pypi"
|
name = "pypi"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
crispy-bootstrap5 = "~=0.6"
|
crispy-bootstrap5 = "~=0.7"
|
||||||
django = "~=3.2.13"
|
django = "~=3.2.18"
|
||||||
django-bootstrap-pagination = "~=1.7.1"
|
django-bootstrap-pagination = "~=1.7.1"
|
||||||
django-crispy-forms = "~=1.14.0"
|
django-crispy-forms = "~=1.14.0"
|
||||||
django-extensions = "~=3.1.5"
|
django-extensions = "~=3.2.1"
|
||||||
gunicorn = "~=20.1.0"
|
gunicorn = "~=20.1.0"
|
||||||
ipython = "~=8.2.0"
|
ipython = "~=8.10.0"
|
||||||
mistune = "~=2.0.2"
|
mistune = "~=2.0.5"
|
||||||
psycopg2 = "~=2.9.3"
|
psycopg2 = "~=2.9.5"
|
||||||
pygments = "~=2.11.2"
|
pygments = "~=2.14.0"
|
||||||
social-auth-app-django = "~=5.0.0"
|
social-auth-app-django = "~=5.0.0"
|
||||||
whitenoise = "~=6.0.0"
|
whitenoise = "~=6.4.0"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
autopep8 = "~=1.6.0"
|
autopep8 = "~=2.0.1"
|
||||||
black = "==22.3.0"
|
black = "~=23.1.0"
|
||||||
coverage = "~=6.3.2"
|
coverage = "~=7.2.1"
|
||||||
django-stubs = "~=1.9.0"
|
django-stubs = "~=1.15.0"
|
||||||
flake8 = "~=4.0.1"
|
flake8 = "~=6.0.0"
|
||||||
isort = "~=5.10.1"
|
isort = "~=5.12.0"
|
||||||
mypy = "~=0.942"
|
mypy = "~=1.0.1"
|
||||||
pylint = "~=2.13.7"
|
pylint = "~=2.16.2"
|
||||||
pylint-django = "~=2.5.3"
|
pylint-django = "~=2.5.3"
|
||||||
pyyaml = "~=6.0"
|
pyyaml = "~=6.0"
|
||||||
typed-ast = "~=1.5.3" # Required by black, but Pipenv doesn't pull it in correctly on 3.8
|
typed-ast = "~=1.5.4" # Required by black, but Pipenv doesn't pull it in correctly on 3.8
|
||||||
types-Markdown = "~=3.3.13" # To avoid CI failures
|
types-Markdown = "~=3.4.2.5" # To avoid CI failures
|
||||||
types-bleach = "~=5.0.2" # To avoid CI failures
|
types-bleach = "~=6.0.0.1" # To avoid CI failures
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.9"
|
python_version = "3.9"
|
||||||
|
|
925
Pipfile.lock
generated
925
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
2
pylintrc
2
pylintrc
|
@ -4,7 +4,7 @@ init-hook=import sys; sys.path.insert(0, 'tjdests/apps')
|
||||||
load-plugins=pylint_django
|
load-plugins=pylint_django
|
||||||
|
|
||||||
[MAIN]
|
[MAIN]
|
||||||
disable=missing-docstring,no-else-return,no-else-raise,bad-continuation,duplicate-code,too-many-branches,too-many-nested-blocks,too-many-locals,too-many-statements,too-many-public-methods
|
disable=missing-docstring,no-else-return,no-else-raise,duplicate-code,too-many-branches,too-many-nested-blocks,too-many-locals,too-many-statements,too-many-public-methods
|
||||||
max-line-length=100
|
max-line-length=100
|
||||||
ignore=media,migrations
|
ignore=media,migrations
|
||||||
ignore-patterns=secret*
|
ignore-patterns=secret*
|
||||||
|
|
|
@ -29,6 +29,7 @@ class TOSForm(forms.Form):
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = super().clean()
|
cleaned_data = super().clean()
|
||||||
|
assert cleaned_data is not None
|
||||||
password1 = cleaned_data.get("password")
|
password1 = cleaned_data.get("password")
|
||||||
password2 = cleaned_data.get("password_confirm")
|
password2 = cleaned_data.get("password_confirm")
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0002_initial"),
|
("authentication", "0002_initial"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0005_alter_decision_admission_status"),
|
("destinations", "0005_alter_decision_admission_status"),
|
||||||
("authentication", "0003_alter_user_publish_data"),
|
("authentication", "0003_alter_user_publish_data"),
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0004_auto_20210419_1713"),
|
("authentication", "0004_auto_20210419_1713"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0005_user_gpa"),
|
("authentication", "0005_user_gpa"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0006_alter_user_biography"),
|
("authentication", "0006_alter_user_biography"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0007_alter_user_gpa"),
|
("authentication", "0007_alter_user_gpa"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0008_alter_user_biography"),
|
("authentication", "0008_alter_user_biography"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0009_user_last_modified"),
|
("authentication", "0009_user_last_modified"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0010_user_nickname"),
|
("authentication", "0010_user_nickname"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0011_user_use_nickname"),
|
("authentication", "0011_user_use_nickname"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0012_user_preferred_name"),
|
("authentication", "0012_user_preferred_name"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("authentication", "0013_alter_user_gpa"),
|
("authentication", "0013_alter_user_gpa"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,7 +45,8 @@ def accept_tos_view(request: HttpRequest) -> HttpResponse:
|
||||||
form = TOSForm(request.POST)
|
form = TOSForm(request.POST)
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
request.user.accepted_terms = form.cleaned_data.get("accept_tos")
|
accept_tos = form.cleaned_data.get("accept_tos")
|
||||||
|
request.user.accepted_terms = accept_tos
|
||||||
request.user.set_password(form.cleaned_data.get("password"))
|
request.user.set_password(form.cleaned_data.get("password"))
|
||||||
request.user.save()
|
request.user.save()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0001_initial"),
|
("destinations", "0001_initial"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0002_decision_admitted"),
|
("destinations", "0002_decision_admitted"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0003_alter_decision_admitted"),
|
("destinations", "0003_alter_decision_admitted"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0004_rename_admitted_decision_admission_status"),
|
("destinations", "0004_rename_admitted_decision_admission_status"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0005_alter_decision_admission_status"),
|
("destinations", "0005_alter_decision_admission_status"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0006_alter_college_ceeb_code"),
|
("destinations", "0006_alter_college_ceeb_code"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0007_alter_decision_admission_status"),
|
("destinations", "0007_alter_decision_admission_status"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0008_alter_decision_admission_status"),
|
("destinations", "0008_alter_decision_admission_status"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0009_alter_decision_admission_status"),
|
("destinations", "0009_alter_decision_admission_status"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0010_alter_college_options"),
|
("destinations", "0010_alter_college_options"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0011_auto_20210423_2357"),
|
("destinations", "0011_auto_20210423_2357"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,6 @@ from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("destinations", "0012_alter_decision_options"),
|
("destinations", "0012_alter_decision_options"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from unittest.mock import mock_open, patch
|
from unittest.mock import mock_open, patch
|
||||||
|
|
||||||
from django.core.management import CommandError, call_command
|
from django.core.management import CommandError, call_command
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from ...test import TJDestsTestCase
|
from ...test import TJDestsTestCase
|
||||||
|
@ -15,6 +16,7 @@ class DestinationsTest(TJDestsTestCase):
|
||||||
# Test as an unauthenticated user.
|
# Test as an unauthenticated user.
|
||||||
response = self.client.get(reverse("destinations:students"))
|
response = self.client.get(reverse("destinations:students"))
|
||||||
self.assertEqual(302, response.status_code)
|
self.assertEqual(302, response.status_code)
|
||||||
|
assert isinstance(response, HttpResponseRedirect)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
reverse("authentication:login")
|
reverse("authentication:login")
|
||||||
+ f"?next={reverse('destinations:students')}",
|
+ f"?next={reverse('destinations:students')}",
|
||||||
|
@ -191,6 +193,7 @@ class DestinationsTest(TJDestsTestCase):
|
||||||
|
|
||||||
response = self.client.get(reverse("destinations:colleges"))
|
response = self.client.get(reverse("destinations:colleges"))
|
||||||
self.assertEqual(302, response.status_code)
|
self.assertEqual(302, response.status_code)
|
||||||
|
assert isinstance(response, HttpResponseRedirect)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
reverse("authentication:login")
|
reverse("authentication:login")
|
||||||
+ f"?next={reverse('destinations:colleges')}",
|
+ f"?next={reverse('destinations:colleges')}",
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ProfilePublishForm(forms.ModelForm):
|
||||||
if data.get("biography"):
|
if data.get("biography"):
|
||||||
data["biography"] = data["biography"].replace("\r", "")
|
data["biography"] = data["biography"].replace("\r", "")
|
||||||
self.instance.biography = data["biography"]
|
self.instance.biography = data["biography"]
|
||||||
|
assert self.fields["biography"].max_length is not None
|
||||||
if len(data["biography"]) <= self.fields["biography"].max_length:
|
if len(data["biography"]) <= self.fields["biography"].max_length:
|
||||||
if self.errors.get("biography"):
|
if self.errors.get("biography"):
|
||||||
del self.errors["biography"]
|
del self.errors["biography"]
|
||||||
|
@ -37,6 +38,8 @@ class ProfilePublishForm(forms.ModelForm):
|
||||||
self.data = data
|
self.data = data
|
||||||
cleaned_data = super().clean()
|
cleaned_data = super().clean()
|
||||||
|
|
||||||
|
assert cleaned_data is not None
|
||||||
|
|
||||||
# Check the GPA: 0.0 <= GPA <= 5.0
|
# Check the GPA: 0.0 <= GPA <= 5.0
|
||||||
if cleaned_data.get("GPA"):
|
if cleaned_data.get("GPA"):
|
||||||
gpa = cleaned_data.get("GPA")
|
gpa = cleaned_data.get("GPA")
|
||||||
|
@ -74,6 +77,7 @@ class DecisionForm(forms.ModelForm):
|
||||||
|
|
||||||
def clean(self) -> Dict[str, Any]:
|
def clean(self) -> Dict[str, Any]:
|
||||||
cleaned_data = super().clean()
|
cleaned_data = super().clean()
|
||||||
|
assert cleaned_data is not None
|
||||||
|
|
||||||
# Ensure that the college is not a duplicate for this user
|
# Ensure that the college is not a duplicate for this user
|
||||||
# Yes, this is weird. Basically: if we are not editing
|
# Yes, this is weird. Basically: if we are not editing
|
||||||
|
@ -143,6 +147,7 @@ class TestScoreForm(forms.ModelForm):
|
||||||
|
|
||||||
def clean(self) -> Dict[str, Any]:
|
def clean(self) -> Dict[str, Any]:
|
||||||
cleaned_data = super().clean()
|
cleaned_data = super().clean()
|
||||||
|
assert cleaned_data is not None
|
||||||
|
|
||||||
exam_type = str(cleaned_data.get("exam_type"))
|
exam_type = str(cleaned_data.get("exam_type"))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from tjdests.apps.authentication.models import User
|
from tjdests.apps.authentication.models import User
|
||||||
|
@ -16,6 +17,7 @@ class ProfileTest(TJDestsTestCase):
|
||||||
# Test as an unauthenticated user.
|
# Test as an unauthenticated user.
|
||||||
response = self.client.get(reverse("profile:index"))
|
response = self.client.get(reverse("profile:index"))
|
||||||
self.assertEqual(302, response.status_code)
|
self.assertEqual(302, response.status_code)
|
||||||
|
assert isinstance(response, HttpResponseRedirect)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
reverse("authentication:login") + f"?next={reverse('profile:index')}",
|
reverse("authentication:login") + f"?next={reverse('profile:index')}",
|
||||||
response.url,
|
response.url,
|
||||||
|
@ -25,6 +27,7 @@ class ProfileTest(TJDestsTestCase):
|
||||||
self.login(accept_tos=False, make_student=True)
|
self.login(accept_tos=False, make_student=True)
|
||||||
response = self.client.get(reverse("profile:index"))
|
response = self.client.get(reverse("profile:index"))
|
||||||
self.assertEqual(302, response.status_code)
|
self.assertEqual(302, response.status_code)
|
||||||
|
assert isinstance(response, HttpResponseRedirect)
|
||||||
self.assertEqual(reverse("authentication:tos"), response.url)
|
self.assertEqual(reverse("authentication:tos"), response.url)
|
||||||
|
|
||||||
# Test as a user that has accepted TOS
|
# Test as a user that has accepted TOS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user