Skip to content

Commit

Permalink
Merge pull request #296 from City-of-Turku/feature/unit-connections-n…
Browse files Browse the repository at this point in the history
…ew-types-and-tag-field

Feature/unit connections new types and tag field
  • Loading branch information
juuso-j committed Aug 4, 2023
2 parents fc4998e + afe893a commit c7ed645
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 1 deletion.
32 changes: 32 additions & 0 deletions services/migrations/0096_alter_unitconnection_section_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.1.7 on 2023-07-21 07:02

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("services", "0095_exclusionrule"),
]

operations = [
migrations.AlterField(
model_name="unitconnection",
name="section_type",
field=models.PositiveSmallIntegerField(
choices=[
(1, "PHONE_OR_EMAIL"),
(2, "LINK"),
(3, "TOPICAL"),
(4, "OTHER_INFO"),
(5, "OPENING_HOURS"),
(6, "SOCIAL_MEDIA_LINK"),
(7, "OTHER_ADDRESS"),
(8, "HIGHLIGHT"),
(9, "ESERVICE_LINK"),
(10, "PRICE"),
],
null=True,
),
),
]
33 changes: 33 additions & 0 deletions services/migrations/0097_update_unitconnection_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.1.7 on 2023-07-21 07:07

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("services", "0096_alter_unitconnection_section_type"),
]

operations = [
migrations.AlterField(
model_name="unitconnection",
name="name",
field=models.CharField(max_length=2100),
),
migrations.AlterField(
model_name="unitconnection",
name="name_en",
field=models.CharField(max_length=2100, null=True),
),
migrations.AlterField(
model_name="unitconnection",
name="name_fi",
field=models.CharField(max_length=2100, null=True),
),
migrations.AlterField(
model_name="unitconnection",
name="name_sv",
field=models.CharField(max_length=2100, null=True),
),
]
33 changes: 33 additions & 0 deletions services/migrations/0098_alter_unitconnection_section_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.1.7 on 2023-07-21 07:09

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("services", "0097_update_unitconnection_names"),
]

operations = [
migrations.AlterField(
model_name="unitconnection",
name="section_type",
field=models.PositiveSmallIntegerField(
choices=[
(1, "PHONE_OR_EMAIL"),
(2, "LINK"),
(3, "TOPICAL"),
(4, "OTHER_INFO"),
(5, "OPENING_HOURS"),
(6, "SOCIAL_MEDIA_LINK"),
(7, "OTHER_ADDRESS"),
(8, "HIGHLIGHT"),
(9, "ESERVICE_LINK"),
(10, "PRICE"),
(11, "SUBGROUP"),
],
null=True,
),
),
]
24 changes: 24 additions & 0 deletions services/migrations/0099_unitconnection_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 4.1.7 on 2023-07-21 07:13

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


class Migration(migrations.Migration):

dependencies = [
("services", "0098_alter_unitconnection_section_type"),
]

operations = [
migrations.AddField(
model_name="unitconnection",
name="tags",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=200),
default=list,
null=True,
size=None,
),
),
]
34 changes: 34 additions & 0 deletions services/migrations/0100_alter_unitconnection_section_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.1.7 on 2023-07-21 07:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("services", "0099_unitconnection_tags"),
]

operations = [
migrations.AlterField(
model_name="unitconnection",
name="section_type",
field=models.PositiveSmallIntegerField(
choices=[
(1, "PHONE_OR_EMAIL"),
(2, "LINK"),
(3, "TOPICAL"),
(4, "OTHER_INFO"),
(5, "OPENING_HOURS"),
(6, "SOCIAL_MEDIA_LINK"),
(7, "OTHER_ADDRESS"),
(8, "HIGHLIGHT"),
(9, "ESERVICE_LINK"),
(10, "PRICE"),
(11, "SUBGROUP"),
(12, "OPENING_HOUR_OBJECT"),
],
null=True,
),
),
]
10 changes: 9 additions & 1 deletion services/models/unit_connection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib.postgres.fields import ArrayField
from django.db import models

from .unit import Unit
Expand All @@ -13,6 +14,9 @@ class UnitConnection(models.Model):
OTHER_ADDRESS_TYPE = 7
HIGHLIGHT_TYPE = 8
ESERVICE_LINK_TYPE = 9
PRICE_TYPE = 10
SUBGROUP_TYPE = 11
OPENING_HOUR_OBJECT = 12

SECTION_TYPES = (
(PHONE_OR_EMAIL_TYPE, "PHONE_OR_EMAIL"),
Expand All @@ -24,18 +28,22 @@ class UnitConnection(models.Model):
(OTHER_ADDRESS_TYPE, "OTHER_ADDRESS"),
(HIGHLIGHT_TYPE, "HIGHLIGHT"),
(ESERVICE_LINK_TYPE, "ESERVICE_LINK"),
(PRICE_TYPE, "PRICE"),
(SUBGROUP_TYPE, "SUBGROUP"),
(OPENING_HOUR_OBJECT, "OPENING_HOUR_OBJECT"),
)

unit = models.ForeignKey(
Unit, db_index=True, related_name="connections", on_delete=models.CASCADE
)
name = models.CharField(max_length=600)
name = models.CharField(max_length=2100)
www = models.URLField(null=True, max_length=400)
section_type = models.PositiveSmallIntegerField(choices=SECTION_TYPES, null=True)
email = models.EmailField(max_length=100, null=True)
phone = models.CharField(max_length=50, null=True)
contact_person = models.CharField(max_length=80, null=True)
order = models.PositiveSmallIntegerField(default=0)
tags = ArrayField(models.CharField(max_length=200), null=True, default=list)

class Meta:
ordering = ["order"]

0 comments on commit c7ed645

Please sign in to comment.