Skip to content

Commit f501808

Browse files
authored
Move wants_thursday_event to custom field (#3807)
1 parent d7e95c1 commit f501808

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

lego/apps/companies/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
ITDAGENE: "Stand på itDAGENE",
6464
LABAMBA_SPONSOR: "Sponsing av LaBamba",
6565
SOCIAL_MEDIA: "Profilering på sosiale medier",
66-
THURSDAY_EVENT: "Ønsker arrangement torsdag",
6766
}
6867

6968
COLLABORATION_ONLINE = "collaboration_online"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 4.2.16 on 2025-03-26 17:33
2+
3+
from django.db import migrations, models
4+
5+
6+
def migrate_thursday_event(apps, schema_editor):
7+
CompanyInterest = apps.get_model("companies", "CompanyInterest")
8+
company_interests = CompanyInterest.objects.filter(
9+
other_offers__contains=["thursday_event"]
10+
)
11+
for company_interest in company_interests:
12+
company_interest.other_offers.remove("thursday_event")
13+
company_interest.wants_thursday_event = True
14+
company_interest.save()
15+
16+
17+
class Migration(migrations.Migration):
18+
19+
dependencies = [
20+
("companies", "0033_alter_companyinterest_other_offers"),
21+
]
22+
23+
operations = [
24+
migrations.AddField(
25+
model_name="companyinterest",
26+
name="wants_thursday_event",
27+
field=models.BooleanField(blank=True, default=False),
28+
),
29+
migrations.RunPython(migrate_thursday_event),
30+
]

lego/apps/companies/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ class CompanyInterest(PersistentModel, TimeStampModel):
158158
blank=True,
159159
)
160160
office_in_trondheim = models.BooleanField(default=False, blank=True)
161+
wants_thursday_event = models.BooleanField(default=False, blank=True)
161162

162163
target_grades = ArrayField(models.PositiveIntegerField(), null=True, blank=True)
163164
participant_range_start = models.IntegerField(null=True, blank=True)

lego/apps/companies/serializers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ class Meta:
299299
"bedex_comment",
300300
"company_course_themes",
301301
"office_in_trondheim",
302+
"wants_thursday_event",
302303
)
303304

304305
def update_company_interest_bdb(self, company_interest):

lego/apps/companies/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def csv(self, *args, **kwargs):
196196
"Bedriftstype",
197197
"Relevante temaer",
198198
"Kontorer i Trondheim for besøk",
199+
"Ønsker torsdagsarrangement",
199200
"Klassetrinn",
200201
"Antall deltagere",
201202
"Faglig arrangement kommentar",
@@ -278,6 +279,11 @@ def csv(self, *args, **kwargs):
278279
if companyInterest.office_in_trondheim
279280
else ""
280281
)
282+
wants_thursday_event = (
283+
companyInterest.wants_thursday_event
284+
if companyInterest.wants_thursday_event
285+
else ""
286+
)
281287
writer.writerow(
282288
[
283289
company_name,
@@ -292,6 +298,7 @@ def csv(self, *args, **kwargs):
292298
company_type,
293299
company_course_themes,
294300
office_in_trondheim,
301+
wants_thursday_event,
295302
target_grades,
296303
f"{participant_range_start} - {participant_range_end}",
297304
companyInterest.course_comment,

0 commit comments

Comments
 (0)