Skip to content
27 changes: 27 additions & 0 deletions applications/migrations/0058_auto_20250511_1425.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 3.2.23 on 2025-05-11 14:25

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('applications', '0057_auto_20250203_2145'),
]

operations = [
migrations.AddField(
model_name='hackerapplication',
name='dubious_type',
field=models.CharField(choices=[('OK', 'Not dubious'), ('INVALID_CV', 'Invalid CV'), ('LATE_GRAD', 'Invalid graduation year'), ('NOT_STUDENT', 'Not a student'), ('INVALID_SCHOOL', 'Invalid school')], default='OK', max_length=300),
),
migrations.AddField(
model_name='hackerapplication',
name='dubioused_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dubioused_by', to=settings.AUTH_USER_MODEL),
),
]
19 changes: 19 additions & 0 deletions applications/migrations/0059_auto_20250511_1520.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.23 on 2025-05-11 15:20

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('applications', '0058_auto_20250511_1425'),
]

operations = [
migrations.AddField(
model_name='hackerapplication',
name='dubious_comment',
field=models.TextField(blank=True, max_length=500, null=True),
),
]
19 changes: 19 additions & 0 deletions applications/migrations/0060_auto_20250511_1649.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.23 on 2025-05-11 16:49

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('applications', '0059_auto_20250511_1520'),
]

operations = [
migrations.AlterField(
model_name='hackerapplication',
name='dubious_type',
field=models.CharField(choices=[('OK', 'Not dubious'), ('INVALID_CV', 'Invalid CV'), ('LATE_GRAD', 'Invalid graduation year'), ('NOT_STUDENT', 'Not a student'), ('INVALID_SCHOOL', 'Invalid school'), ('OTHER', 'Other')], default='OK', max_length=300),
),
]
16 changes: 16 additions & 0 deletions applications/models/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,19 @@
DEFAULT_YEAR = datetime.now().year + 1

ENGLISH_LEVEL = [(i, str(i)) for i in range(1, 5 + 1)]

DUBIOUS_NONE = 'OK'
DUBIOUS_CV = 'INVALID_CV'
DUBIOUS_GRADUATION_YEAR = 'LATE_GRAD'
DUBIOUS_NOT_STUDENT = 'NOT_STUDENT'
DUBIOUS_SCHOOL = 'INVALID_SCHOOL'
DUBIOUS_OTHER = 'OTHER'

DUBIOUS_TYPES = [
(DUBIOUS_NONE, 'Not dubious'),
(DUBIOUS_CV, 'Invalid CV'),
(DUBIOUS_GRADUATION_YEAR, 'Invalid graduation year'),
(DUBIOUS_NOT_STUDENT, 'Not a student'),
(DUBIOUS_SCHOOL, 'Invalid school'),
(DUBIOUS_OTHER, 'Other')
]
12 changes: 11 additions & 1 deletion applications/models/hacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class HackerApplication(
projects = models.TextField(max_length=500, blank=True, null=True)

# META
dubious_type = models.CharField(max_length=300, choices=DUBIOUS_TYPES, default=DUBIOUS_NONE) # Type of dubious application
dubioused_by = models.ForeignKey(User, related_name='dubioused_by', blank=True, null=True,
on_delete=models.SET_NULL) # User who marked this application as dubious
dubious_comment = models.TextField(max_length=500, blank=True, null=True) # Comment for dubious application
contacted = models.BooleanField(default=False) # If a dubious application has been contacted yet
contacted_by = models.ForeignKey(User, related_name='contacted_by', blank=True, null=True,
on_delete=models.SET_NULL)
Expand Down Expand Up @@ -75,10 +79,13 @@ def invalidate(self):
self.status = APP_INVALID
self.save()

def set_dubious(self):
def set_dubious(self, user, dubious_type, dubious_comment_text):
self.status = APP_DUBIOUS
self.contacted = False
self.status_update_date = timezone.now()
self.dubioused_by = user
self.dubious_type = dubious_type
self.dubious_comment = dubious_comment_text
self.vote_set.all().delete()
if hasattr(self, 'acceptedresume'):
self.acceptedresume.delete()
Expand All @@ -87,6 +94,9 @@ def set_dubious(self):
def unset_dubious(self):
self.status = APP_PENDING
self.status_update_date = timezone.now()
self.dubioused_by = None
self.dubious_type = DUBIOUS_NONE
self.dubious_comment = None
self.save()

def set_contacted(self, user):
Expand Down
Loading