-
Notifications
You must be signed in to change notification settings - Fork 10
YJDH-788 | Backend: Add organization type, job type & make business ID unique (+frontend translations) #3867
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-03 12:47 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("applications", "0044_remove_employersummervoucher_target_group_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="employersummervoucher", | ||
| name="job_type", | ||
| field=models.CharField( | ||
| blank=True, | ||
| choices=[ | ||
| ("sports_and_leisure", "Sports and leisure"), | ||
| ("maintenance_and_construction", "Maintenance and construction"), | ||
| ("restaurant_and_cafe", "Restaurant and cafe sector"), | ||
| ("retail", "Retail sector"), | ||
| ("office_and_media", "Office and media"), | ||
| ("gardening_and_agriculture", "Gardening and agricultural work"), | ||
| ("service", "Service sector"), | ||
| ("other", "Other"), | ||
| ], | ||
| max_length=64, | ||
| verbose_name="job type", | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="historicalemployersummervoucher", | ||
| name="job_type", | ||
| field=models.CharField( | ||
| blank=True, | ||
| choices=[ | ||
| ("sports_and_leisure", "Sports and leisure"), | ||
| ("maintenance_and_construction", "Maintenance and construction"), | ||
| ("restaurant_and_cafe", "Restaurant and cafe sector"), | ||
| ("retail", "Retail sector"), | ||
| ("office_and_media", "Office and media"), | ||
| ("gardening_and_agriculture", "Gardening and agricultural work"), | ||
| ("service", "Service sector"), | ||
| ("other", "Other"), | ||
| ], | ||
| max_length=64, | ||
| verbose_name="job type", | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-03 12:47 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("companies", "0006_alter_company_options"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="company", | ||
| name="organization_type", | ||
| field=models.CharField( | ||
| blank=True, | ||
| choices=[ | ||
| ("company", "Company"), | ||
| ("association", "Association"), | ||
| ("parish", "Parish"), | ||
| ("other", "Other"), | ||
| ], | ||
| max_length=64, | ||
| verbose_name="organization type", | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Generated by Django 5.1.15 on 2026-02-03 12:54 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("companies", "0007_company_organization_type"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="company", | ||
| name="business_id", | ||
| field=models.CharField( | ||
| max_length=64, unique=True, verbose_name="business id" | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,15 @@ | ||
| from django.db import models | ||
| from django.utils.translation import gettext_lazy as _ | ||
|
|
||
| from applications.enums import OrganizationType | ||
| from shared.models.abstract_models import UUIDModel | ||
|
|
||
|
|
||
| class Company(UUIDModel): | ||
| name = models.CharField(max_length=256, verbose_name=_("name")) | ||
| business_id = models.CharField(max_length=64, verbose_name=_("business id")) | ||
| business_id = models.CharField( | ||
| max_length=64, unique=True, verbose_name=_("business id") | ||
| ) | ||
| company_form = models.CharField( | ||
| max_length=64, blank=True, verbose_name=_("company form") | ||
| ) | ||
|
|
@@ -17,7 +20,20 @@ class Company(UUIDModel): | |
| ) | ||
| postcode = models.CharField(max_length=256, blank=True, verbose_name=_("postcode")) | ||
| city = models.CharField(max_length=256, blank=True, verbose_name=_("city")) | ||
|
|
||
| organization_type = models.CharField( | ||
| # Rationale for this field: | ||
| # | ||
| # Organization type is similar to company_form data which comes from VTJ, | ||
| # but has specific choices requested by product owner for reporting purposes. | ||
| # | ||
| # For example parish (i.e. seurakunta in Finnish) is a category which | ||
| # is at least not evidently mappable from company_form value, and thus | ||
| # needs to be asked from the user. | ||
| max_length=64, | ||
| verbose_name=_("organization type"), | ||
| blank=True, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note, that since NULL is not allowed, this blank string means that "question is seen, but left unanswered".
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here as in comment #3867 (comment) |
||
| choices=OrganizationType.choices, | ||
| ) | ||
| ytj_json = models.JSONField(blank=True, null=True, verbose_name=_("ytj json")) | ||
|
|
||
| class Meta: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note, that since NULL is not allowed, this blank string means that "question is seen, but left unanswered".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, intentionally allowed empty string. This helps with e.g. old data and with the current way of handling employer applications/summer vouchers in the employer UI & backend (it saves partial data so data can be not set).
Also it's Django's best practice not to allow null for CharFields:
The requirement can be handled at the UI level.