Skip to content

Commit a72368f

Browse files
authored
Merge pull request #395 from hackupc/flag_cv
Flag cv
2 parents 355892c + 56cb96a commit a72368f

File tree

4 files changed

+129
-3
lines changed

4 files changed

+129
-3
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Generated by Django 3.2.23 on 2025-10-12 17:33
2+
3+
import django.core.validators
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('applications', '0057_auto_20250203_2145'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='hackerapplication',
16+
name='cv_flagged',
17+
field=models.BooleanField(default=False),
18+
),
19+
migrations.AlterField(
20+
model_name='hackerapplication',
21+
name='diet',
22+
field=models.CharField(choices=[('', '- Select a diet -'), ('None', 'No requirements'), ('Vegetarian', 'Vegetarian'), ('Vegan', 'Vegan'), ('Gluten-free', 'Gluten-free'), ('Others', 'Others')], default='None', max_length=300),
23+
),
24+
migrations.AlterField(
25+
model_name='hackerapplication',
26+
name='lennyface',
27+
field=models.CharField(default='-.-', max_length=20),
28+
),
29+
migrations.AlterField(
30+
model_name='hackerapplication',
31+
name='phone_number',
32+
field=models.CharField(blank=True, max_length=16, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+#########'. Up to 16 digits allowed.", regex='^\\+?1?\\d{9,15}$')]),
33+
),
34+
migrations.AlterField(
35+
model_name='hackerapplication',
36+
name='tshirt_size',
37+
field=models.CharField(choices=[('', '- Select a t-shirt size -'), ('XS', 'Unisex - XS'), ('S', 'Unisex - S'), ('M', 'Unisex - M'), ('L', 'Unisex - L'), ('XL', 'Unisex - XL'), ('XXL', 'Unisex - XXL'), ('XXXL', 'Unisex - XXXL')], default='', max_length=300),
38+
),
39+
migrations.AlterField(
40+
model_name='mentorapplication',
41+
name='diet',
42+
field=models.CharField(choices=[('', '- Select a diet -'), ('None', 'No requirements'), ('Vegetarian', 'Vegetarian'), ('Vegan', 'Vegan'), ('Gluten-free', 'Gluten-free'), ('Others', 'Others')], default='None', max_length=300),
43+
),
44+
migrations.AlterField(
45+
model_name='mentorapplication',
46+
name='lennyface',
47+
field=models.CharField(default='-.-', max_length=20),
48+
),
49+
migrations.AlterField(
50+
model_name='mentorapplication',
51+
name='phone_number',
52+
field=models.CharField(blank=True, max_length=16, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+#########'. Up to 16 digits allowed.", regex='^\\+?1?\\d{9,15}$')]),
53+
),
54+
migrations.AlterField(
55+
model_name='mentorapplication',
56+
name='tshirt_size',
57+
field=models.CharField(choices=[('', '- Select a t-shirt size -'), ('XS', 'Unisex - XS'), ('S', 'Unisex - S'), ('M', 'Unisex - M'), ('L', 'Unisex - L'), ('XL', 'Unisex - XL'), ('XXL', 'Unisex - XXL'), ('XXXL', 'Unisex - XXXL')], default='', max_length=300),
58+
),
59+
migrations.AlterField(
60+
model_name='sponsorapplication',
61+
name='diet',
62+
field=models.CharField(choices=[('', '- Select a diet -'), ('None', 'No requirements'), ('Vegetarian', 'Vegetarian'), ('Vegan', 'Vegan'), ('Gluten-free', 'Gluten-free'), ('Others', 'Others')], default='None', max_length=300),
63+
),
64+
migrations.AlterField(
65+
model_name='sponsorapplication',
66+
name='tshirt_size',
67+
field=models.CharField(choices=[('', '- Select a t-shirt size -'), ('XS', 'Unisex - XS'), ('S', 'Unisex - S'), ('M', 'Unisex - M'), ('L', 'Unisex - L'), ('XL', 'Unisex - XL'), ('XXL', 'Unisex - XXL'), ('XXXL', 'Unisex - XXXL')], default='', max_length=300),
68+
),
69+
migrations.AlterField(
70+
model_name='volunteerapplication',
71+
name='lennyface',
72+
field=models.CharField(default='-.-', max_length=20),
73+
),
74+
migrations.AlterField(
75+
model_name='volunteerapplication',
76+
name='phone_number',
77+
field=models.CharField(blank=True, max_length=16, null=True, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+#########'. Up to 16 digits allowed.", regex='^\\+?1?\\d{9,15}$')]),
78+
),
79+
migrations.AlterField(
80+
model_name='volunteerapplication',
81+
name='tshirt_size',
82+
field=models.CharField(choices=[('', '- Select a t-shirt size -'), ('XS', 'Unisex - XS'), ('S', 'Unisex - S'), ('M', 'Unisex - M'), ('L', 'Unisex - L'), ('XL', 'Unisex - XL'), ('XXL', 'Unisex - XXL'), ('XXXL', 'Unisex - XXXL')], default='', max_length=300),
83+
),
84+
]

applications/models/hacker.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class HackerApplication(BaseApplication):
7474
hardware = models.CharField(max_length=300, null=True, blank=True)
7575

7676
cvs_edition = models.BooleanField(default=False)
77+
cv_flagged = models.BooleanField(default=False)
7778

7879
resume = models.FileField(
7980
upload_to=resume_path_hackers,
@@ -112,7 +113,15 @@ def unset_dubious(self):
112113
self.status = APP_PENDING
113114
self.status_update_date = timezone.now()
114115
self.save()
115-
116+
117+
def set_flagged_cv(self):
118+
"""Sets the CV as flagged for review. If there was an accepted
119+
resume, deletes it so it can be reviewed."""
120+
self.cv_flagged = True
121+
if hasattr(self, 'acceptedresume'):
122+
self.acceptedresume.delete()
123+
self.save()
124+
116125
def set_contacted(self, user):
117126
if not self.contacted:
118127
self.contacted = True

organizers/templates/application_detail.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@ <h3>Personal</h3>
4343
{% include 'include/field.html' with desc='Under age (-18)' value=app.under_age|yesno:'Yes,No,Maybe' %}
4444
{% if app.resume %}
4545
<dt>Resume</dt>
46-
<dd><a href="{% url 'app_resume' app.uuid %}" target="_blank">{{ app.resume.name }}</a></dd>
46+
<dd>
47+
<a href="{% url 'app_resume' app.uuid %}" target="_blank">{{ app.resume.name }}</a>
48+
{% if app.cv_flagged %}
49+
<p class="text-danger" style="margin-top:5px;">CV already flagged for review</p>
50+
{% else %}
51+
<form action="" method="post" style="margin-top:8px;">
52+
{% csrf_token %}
53+
<input type="hidden" name="app_id" value="{{ app.pk }}"/>
54+
<button name="set_flagged_cv" class="btn btn-warning btn-sm btn-block" value="set_flagged_cv"
55+
onclick="return confirm('Are you sure you want set this application as Flagged?')">
56+
Flag CV for Review
57+
</button>
58+
</form>
59+
{% endif %}
60+
</dd>
4761

4862
{% endif %}
4963
<hr>

organizers/views.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,19 @@
7373

7474

7575
def add_vote(application, user, tech_rat, pers_rat):
76+
"""
77+
Save the vote of the application and
78+
if the number of votes is >= 5 and the CV is not flagged, create an AcceptedResume
79+
"""
7680
v = models.Vote()
7781
v.user = user
7882
v.application = application
7983
v.tech = tech_rat
8084
v.personal = pers_rat
8185
v.save()
86+
votes_count = application.vote_set.count()
87+
if votes_count >= 5 and not application.cv_flagged:
88+
AcceptedResume.objects.update_or_create(application=application, defaults={'accepted': True})
8289
return v
8390

8491

@@ -368,6 +375,10 @@ def post(self, request, *args, **kwargs):
368375
self.slack_invite(application)
369376
elif request.POST.get("set_dubious") and request.user.is_organizer:
370377
application.set_dubious()
378+
elif request.POST.get("set_flagged_cv") and request.user.is_organizer:
379+
application.set_flagged_cv()
380+
elif request.POST.get("unset_flagged_cv") and request.user.is_organizer:
381+
application.unset_flagged_cv()
371382
elif request.POST.get("contact_user") and request.user.has_dubious_access:
372383
application.set_contacted(request.user)
373384
elif request.POST.get("unset_dubious") and request.user.has_dubious_access:
@@ -512,6 +523,10 @@ def post(self, request, *args, **kwargs):
512523
application.set_dubious()
513524
elif request.POST.get("unset_dubious"):
514525
application.unset_dubious()
526+
elif request.POST.get("set_flagged_cv") and request.user.is_organizer:
527+
application.set_flagged_cv()
528+
elif request.POST.get("unset_flagged_cv") and request.user.is_organizer:
529+
application.unset_flagged_cv()
515530
elif request.POST.get("set_blacklist") and request.user.is_organizer:
516531
application.set_blacklist()
517532
elif (
@@ -611,6 +626,10 @@ def post(self, request, *args, **kwargs):
611626
application.set_dubious()
612627
elif request.POST.get("unset_dubious"):
613628
application.unset_dubious()
629+
elif request.POST.get("set_flagged_cv") and request.user.is_organizer:
630+
application.set_flagged_cv()
631+
elif request.POST.get("unset_flagged_cv") and request.user.is_organizer:
632+
application.unset_flagged_cv()
614633
elif request.POST.get("set_blacklist") and request.user.is_organizer:
615634
application.set_blacklist()
616635
elif (
@@ -1053,7 +1072,7 @@ def get_context_data(self, **kwargs):
10531072
context = super().get_context_data(**kwargs)
10541073
app = (
10551074
models.HackerApplication.objects.filter(
1056-
acceptedresume__isnull=True, cvs_edition=True
1075+
acceptedresume__isnull=True, cv_flagged=True, resume__isnull=False
10571076
)
10581077
.exclude(status__in=[APP_DUBIOUS, APP_BLACKLISTED])
10591078
.first()

0 commit comments

Comments
 (0)