Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit company interest model to include more fields #3226

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

recipients.append("redaktor@abakus.no")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
recipients.append("redaktor@abakus.no")
recipients.append("redaktor@{settings.GSUITE_DOMAIN}")

not that it matters much

send_email.delay(
to_email=recipients,
context=mail_context,
Expand Down
24 changes: 24 additions & 0 deletions lego/apps/companies/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.db import models

SPRING = "spring"
AUTUMN = "autumn"

Expand Down Expand Up @@ -83,6 +85,28 @@
COLLABORATION_REVUE_ANNIVERSARY: "Abakusrevy jubileum",
}


class COMPANY_TYPES(models.TextChoices):
SMALL_CONSULTANT = "company_types_small_consultant"
MEDIUM_CONSULTANT = "company_types_medium_consultant"
LARGE_CONSULTANT = "company_types_large_consultant"
INHOUSE = "company_types_inhouse"
TYPES_OTHERS = "company_types_others"
START_UP = "company_types_start_up"
GOVERNMENTAL = "company_types_governmental"


class COMPANY_COURSE_THEMES(models.TextChoices):
SECURITY = "company_survey_security"
AI = "company_survey_ai"
DATA = "company_survey_big_data"
END = "company_survey_front_back_end"
IOT = "company_survey_iot"
GAMEDEV = "company_survey_gamedev"
SOFTSKILLS = "company_survey_softskills"
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,87 @@
# Generated by Django 4.0.9 on 2023-02-21 23:22

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="bedex_comment",
field=models.TextField(blank=True),
),
migrations.AddField(
model_name="companyinterest",
name="company_course_themes",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(
choices=[
("company_survey_security", "Security"),
("company_survey_ai", "Ai"),
("company_survey_big_data", "Data"),
("company_survey_front_back_end", "End"),
("company_survey_iot", "Iot"),
("company_survey_gamedev", "Gamedev"),
("company_survey_softskills", "Softskills"),
("company_survey_fintech", "Fintech"),
],
max_length=64,
),
blank=True,
null=True,
size=None,
),
),
migrations.AddField(
model_name="companyinterest",
name="company_presentation_comment",
field=models.TextField(blank=True),
),
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", "Small Consultant"),
("company_types_medium_consultant", "Medium Consultant"),
("company_types_large_consultant", "Large Consultant"),
("company_types_inhouse", "Inhouse"),
("company_types_others", "Types Others"),
("company_types_start_up", "Start Up"),
("company_types_governmental", "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="office_in_trondheim",
field=models.BooleanField(blank=True, default=False),
),
migrations.AddField(
model_name="companyinterest",
name="startup_comment",
field=models.TextField(blank=True),
),
]
26 changes: 24 additions & 2 deletions lego/apps/companies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
from .constants import (
AUTUMN,
COLLABORATIONS,
COMPANY_COURSE_THEMES,
COMPANY_EVENTS,
COMPANY_TYPES,
OTHER_OFFERS,
SEMESTER,
SEMESTER_STATUSES,
Expand Down Expand Up @@ -61,12 +63,12 @@ class Meta:
permission_handler = CompanyPermissionHandler()

@property
def content_target(self):
def content_target(self) -> str:
return "{0}.{1}-{2}".format(
self._meta.app_label, self._meta.model_name, self.pk
)

def __str__(self):
def __str__(self) -> str:
return self.name


Expand Down Expand Up @@ -139,13 +141,28 @@ 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.choices, blank=True
)
company_course_themes = ArrayField(
models.CharField(max_length=64, choices=COMPANY_COURSE_THEMES.choices),
null=True,
blank=True,
)
office_in_trondheim = models.BooleanField(default=False, 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 +206,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,
}
10 changes: 9 additions & 1 deletion lego/apps/companies/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Meta:
model = CompanyContact
fields = ("id", "name", "role", "mail", "phone", "mobile")

def create(self, validated_data):
def create(self, validated_data) -> any:
company = Company.objects.get(pk=self.context["view"].kwargs["company_pk"])
validated_data["company"] = company
return super().create(validated_data)
Expand Down 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_course_themes",
"office_in_trondheim",
)

def update_company_interest_bdb(self, company_interest):
Expand Down