Skip to content

Commit

Permalink
Migrate common models to the new app
Browse files Browse the repository at this point in the history
  • Loading branch information
matti-lamppu committed Oct 2, 2024
1 parent 22b9c61 commit 62f916a
Show file tree
Hide file tree
Showing 289 changed files with 1,921 additions and 1,629 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def year_not_in_future(year: int | None) -> None:
from common.date_utils import DEFAULT_TIMEZONE
from utils.date_utils import DEFAULT_TIMEZONE

if year is None:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _

import common.fields.model
import utils.fields.model


def year_not_in_future(year: int | None) -> None:
from common.date_utils import DEFAULT_TIMEZONE
from utils.date_utils import DEFAULT_TIMEZONE

if year is None:
return
Expand Down Expand Up @@ -162,7 +162,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="applicationeventschedule",
name="allocated_day",
field=common.fields.model.IntChoiceField(
field=utils.fields.model.IntChoiceField(
blank=True,
enum=WeekdayChoice,
default=None,
Expand Down Expand Up @@ -369,7 +369,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="application",
name="applicant_type",
field=common.fields.model.StrChoiceField(enum=ApplicantTypeChoice, db_index=True, max_length=11, null=True),
field=utils.fields.model.StrChoiceField(enum=ApplicantTypeChoice, db_index=True, max_length=11, null=True),
),
migrations.AlterField(
model_name="application",
Expand Down Expand Up @@ -550,7 +550,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="applicationeventschedule",
name="day",
field=common.fields.model.IntChoiceField(
field=utils.fields.model.IntChoiceField(
enum=WeekdayChoice,
validators=[
django.core.validators.MinValueValidator(limit_value=0, message="Value must be between 0 and 6."),
Expand All @@ -566,7 +566,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="applicationeventschedule",
name="priority",
field=common.fields.model.IntChoiceField(
field=utils.fields.model.IntChoiceField(
blank=True,
enum=ReservationPriorityChoice,
default=300,
Expand Down Expand Up @@ -773,7 +773,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="organisation",
name="organisation_type",
field=common.fields.model.StrChoiceField(enum=OrganizationTypeChoice, default="COMPANY", max_length=24),
field=utils.fields.model.StrChoiceField(enum=OrganizationTypeChoice, default="COMPANY", max_length=24),
),
migrations.AlterField(
model_name="organisation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from django.contrib.postgres.operations import HStoreExtension
from django.db import migrations, models

import common.fields.model
import tilavarauspalvelu.utils.validators
import utils.fields.model


class WeekdayChoice(models.IntegerChoices):
Expand All @@ -33,7 +33,7 @@ class Migration(migrations.Migration):
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"weekday",
common.fields.model.IntChoiceField(
utils.fields.model.IntChoiceField(
enum=WeekdayChoice,
validators=[
django.core.validators.MinValueValidator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import django.db.models.deletion
from django.db import migrations, models

import common.fields.model
import utils.fields.model


class Weekday(models.TextChoices):
Expand Down Expand Up @@ -83,15 +83,15 @@ class Migration(migrations.Migration):
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"priority",
common.fields.model.StrChoiceField(
utils.fields.model.StrChoiceField(
choices=[("PRIMARY", "Primary"), ("SECONDARY", "Secondary")],
enum=Priority,
max_length=9,
),
),
(
"day_of_the_week",
common.fields.model.StrChoiceField(
utils.fields.model.StrChoiceField(
choices=[
("MONDAY", "Monday"),
("TUESDAY", "Tuesday"),
Expand Down Expand Up @@ -160,7 +160,7 @@ class Migration(migrations.Migration):
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"day_of_the_week",
common.fields.model.StrChoiceField(
utils.fields.model.StrChoiceField(
choices=[
("MONDAY", "Monday"),
("TUESDAY", "Tuesday"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from django.db import migrations

from common.date_utils import time_as_timedelta
from utils.date_utils import time_as_timedelta

logger = logging.getLogger(__name__)

Expand Down
9 changes: 0 additions & 9 deletions common/admin/__init__.py

This file was deleted.

63 changes: 0 additions & 63 deletions common/admin/banner_notification.py

This file was deleted.

190 changes: 0 additions & 190 deletions common/admin/request_log.py

This file was deleted.

Loading

0 comments on commit 62f916a

Please sign in to comment.