Skip to content

Commit

Permalink
Edit company interest model to include more fields
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas de Luna Skulberg <jonasdls@gmail.com>
  • Loading branch information
Arash Farzaneh Taleghani and jonasdeluna committed Feb 21, 2023
1 parent a69de21 commit 1a10c79
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lego/apps/companies/action_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def handle_create(self, instance, **kwargs):
# reply is sent to them (and bedkom)
recipients.append(mail_context["mail"])
if mail_context["readme"]:
recipients.append(f"lederreadme@{settings.GSUITE_DOMAIN}")
# recipients.append(f"lederreadme@{settings.GSUITE_DOMAIN}")
recipients.append("redaktor@abakus.no")
send_email.delay(
to_email=recipients,
context=mail_context,
Expand Down
56 changes: 56 additions & 0 deletions lego/apps/companies/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,62 @@
COLLABORATION_REVUE_ANNIVERSARY: "Abakusrevy jubileum",
}

COMPANY_TYPES_SMALL_CONSULTANT = "company_types_small_consultant"
COMPANY_TYPES_MEDIUM_CONSULTANT = "company_types_medium_consultant"
COMPANY_TYPES_LARGE_CONSULTANT = "company_types_large_consultant"
COMPANY_TYPES_INHOUSE = "company_types_inhouse"
COMPANY_TYPES_OTHERS = "company_types_others"
COMPANY_TYPES_START_UP = "company_types_start_up"
COMPANY_TYPES_GOVERNMENTAL = "company_types_governmental"

COMPANY_TYPES = (
(COMPANY_TYPES_SMALL_CONSULTANT, COMPANY_TYPES_SMALL_CONSULTANT),
(COMPANY_TYPES_MEDIUM_CONSULTANT, COMPANY_TYPES_MEDIUM_CONSULTANT),
(COMPANY_TYPES_LARGE_CONSULTANT, COMPANY_TYPES_LARGE_CONSULTANT),
(COMPANY_TYPES_INHOUSE, COMPANY_TYPES_INHOUSE),
(COMPANY_TYPES_OTHERS, COMPANY_TYPES_OTHERS),
(COMPANY_TYPES_START_UP, COMPANY_TYPES_START_UP),
(COMPANY_TYPES_GOVERNMENTAL, COMPANY_TYPES_GOVERNMENTAL),
)

TRANSLATED_COMPANY_TYPES = {
COMPANY_TYPES_SMALL_CONSULTANT: "Liten konsulentbedrift",
COMPANY_TYPES_MEDIUM_CONSULTANT: "Medium konsulentbedrift",
COMPANY_TYPES_LARGE_CONSULTANT: "Stor konsulentbedrift",
COMPANY_TYPES_INHOUSE: "Inhouse bedrift",
COMPANY_TYPES_OTHERS: "Diverse/annet",
COMPANY_TYPES_START_UP: "Start-up bedrift",
COMPANY_TYPES_GOVERNMENTAL: "Statlig bedrift",
}

ACCOMMODATING_TRUE = "accommodating_true"
ACCOMMODATING_FALSE = "accommodating_false"

ACCOMMODATING = (
(ACCOMMODATING_TRUE, ACCOMMODATING_TRUE),
(ACCOMMODATING_FALSE, ACCOMMODATING_FALSE),
)

COMPANY_SURVEY_SECURITY = "company_survey_security"
COMPANY_SURVEY_AI = "company_survey_ai"
COMPANY_SURVEY_BIG_DATA = "company_survey_big_data"
COMPANY_SURVEY_FRONT_BACK_END = "company_survey_front_back_end"
COMPANY_SURVEY_IOT = "company_survey_iot"
COMPANY_SURVEY_GAMEDEV = "company_survey_gamedev"
COMPANY_SURVEY_SOFTSKILLS = "company_survey_softskills"
COMPANY_SURVEY_FINTECH = "company_survey_fintech"

COMPANY_SURVEY_OFFERS = (
(COMPANY_SURVEY_SECURITY, COMPANY_SURVEY_SECURITY),
(COMPANY_SURVEY_AI, COMPANY_SURVEY_AI),
(COMPANY_SURVEY_BIG_DATA, COMPANY_SURVEY_BIG_DATA),
(COMPANY_SURVEY_FRONT_BACK_END, COMPANY_SURVEY_FRONT_BACK_END),
(COMPANY_SURVEY_IOT, COMPANY_SURVEY_IOT),
(COMPANY_SURVEY_GAMEDEV, COMPANY_SURVEY_GAMEDEV),
(COMPANY_SURVEY_SOFTSKILLS, COMPANY_SURVEY_SOFTSKILLS),
(COMPANY_SURVEY_FINTECH, COMPANY_SURVEY_FINTECH),
)

CONTACT_IN_OSLO = "contact_in_oslo"
INTERESTED = "interested"
NOT_INTERESTED = "not_interested"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Generated by Django 4.0.9 on 2023-02-21 17:20

import django.contrib.postgres.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
(
"companies",
"0026_rename_second_comment_companyinterest_other_event_comment_and_more",
),
]

operations = [
migrations.AddField(
model_name="companyinterest",
name="accommodating",
field=models.CharField(
blank=True,
choices=[
("accommodating_true", "accommodating_true"),
("accommodating_false", "accommodating_false"),
],
max_length=64,
),
),
migrations.AddField(
model_name="companyinterest",
name="bedex_comment",
field=models.TextField(blank=True),
),
migrations.AddField(
model_name="companyinterest",
name="company_presentation_comment",
field=models.TextField(blank=True),
),
migrations.AddField(
model_name="companyinterest",
name="company_survey_offers",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(
choices=[
("company_survey_security", "company_survey_security"),
("company_survey_ai", "company_survey_ai"),
("company_survey_big_data", "company_survey_big_data"),
(
"company_survey_front_back_end",
"company_survey_front_back_end",
),
("company_survey_iot", "company_survey_iot"),
("company_survey_gamedev", "company_survey_gamedev"),
("company_survey_softskills", "company_survey_softskills"),
("company_survey_fintech", "company_survey_fintech"),
],
max_length=64,
),
blank=True,
null=True,
size=None,
),
),
migrations.AddField(
model_name="companyinterest",
name="company_to_company_comment",
field=models.TextField(blank=True),
),
migrations.AddField(
model_name="companyinterest",
name="company_type",
field=models.CharField(
blank=True,
choices=[
(
"company_types_small_consultant",
"company_types_small_consultant",
),
(
"company_types_medium_consultant",
"company_types_medium_consultant",
),
(
"company_types_large_consultant",
"company_types_large_consultant",
),
("company_types_inhouse", "company_types_inhouse"),
("company_types_others", "company_types_others"),
("company_types_start_up", "company_types_start_up"),
("company_types_governmental", "company_types_governmental"),
],
max_length=64,
null=True,
),
),
migrations.AddField(
model_name="companyinterest",
name="lunch_presentation_comment",
field=models.TextField(blank=True),
),
migrations.AddField(
model_name="companyinterest",
name="startup_comment",
field=models.TextField(blank=True),
),
]
25 changes: 25 additions & 0 deletions lego/apps/companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
from lego.utils.models import BasisModel, PersistentModel, TimeStampModel

from .constants import (
ACCOMMODATING,
AUTUMN,
COLLABORATIONS,
COMPANY_EVENTS,
COMPANY_SURVEY_OFFERS,
COMPANY_TYPES,
OTHER_OFFERS,
SEMESTER,
SEMESTER_STATUSES,
Expand Down Expand Up @@ -139,13 +142,30 @@ class CompanyInterest(PersistentModel, TimeStampModel):
collaborations = ArrayField(
models.CharField(max_length=64, choices=COLLABORATIONS), null=True, blank=True
)
company_type = models.CharField(
max_length=64, null=True, choices=COMPANY_TYPES, blank=True
)
company_survey_offers = ArrayField(
models.CharField(max_length=64, choices=COMPANY_SURVEY_OFFERS),
null=True,
blank=True,
)
accommodating = models.CharField(
max_length=64, null=False, choices=ACCOMMODATING, blank=True
)

target_grades = ArrayField(models.PositiveIntegerField(), null=True, blank=True)
participant_range_start = models.IntegerField(null=True, blank=True)
participant_range_end = models.IntegerField(null=True, blank=True)
comment = models.TextField(blank=True)
course_comment = models.TextField(blank=True)
breakfast_talk_comment = models.TextField(blank=True)
other_event_comment = models.TextField(blank=True)
startup_comment = models.TextField(blank=True)
company_to_company_comment = models.TextField(blank=True)
lunch_presentation_comment = models.TextField(blank=True)
company_presentation_comment = models.TextField(blank=True)
bedex_comment = models.TextField(blank=True)

class Meta:
permission_handler = CompanyInterestPermissionHandler()
Expand Down Expand Up @@ -189,5 +209,10 @@ def generate_mail_context(self):
"course_comment": self.course_comment,
"breakfast_talk_comment": self.breakfast_talk_comment,
"other_event_comment": self.other_event_comment,
"startup_comment": self.startup_comment,
"company_to_company_comment": self.company_to_company_comment,
"lunch_presentation_comment": self.lunch_presentation_comment,
"company_presentation_comment": self.company_presentation_comment,
"bedex_comment": self.bedex_comment,
"readme": readme,
}
8 changes: 8 additions & 0 deletions lego/apps/companies/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,21 @@ class Meta:
"events",
"other_offers",
"collaborations",
"company_type",
"target_grades",
"participant_range_start",
"participant_range_end",
"comment",
"course_comment",
"breakfast_talk_comment",
"other_event_comment",
"startup_comment",
"company_to_company_comment",
"lunch_presentation_comment",
"company_presentation_comment",
"bedex_comment",
"company_survey_offers",
"accommodating",
)

def update_company_interest_bdb(self, company_interest):
Expand Down

0 comments on commit 1a10c79

Please sign in to comment.