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

[2.4] Migrate resource models to the new app #1344

Merged
merged 1 commit into from
Oct 1, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
from datetime import timedelta

from reservation_units.models import Equipment, EquipmentCategory, Purpose, Qualifier
from resources.enums import ResourceLocationType
from resources.models import Resource
from spaces.models import Space, Unit
from tilavarauspalvelu.enums import ServiceTypeChoices
from tilavarauspalvelu.models import Service
from tilavarauspalvelu.enums import ResourceLocationType, ServiceTypeChoices
from tilavarauspalvelu.models import Resource, Service

from .utils import weighted_choice, with_logs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
TaxPercentage,
)
from reservations.models import ReservationMetadataSet
from resources.models import Resource
from spaces.models import Unit
from tilavarauspalvelu.enums import TermsOfUseTypeChoices
from tilavarauspalvelu.models import Service, TermsOfUse
from tilavarauspalvelu.models import Resource, Service, TermsOfUse

from .create_seasonal_booking import _create_application_round_time_slots
from .utils import (
Expand Down
27 changes: 14 additions & 13 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ msgstr ""
#: reservation_units/models/equipment.py reservation_units/models/keyword.py
#: reservation_units/models/reservation_unit_type.py
#: reservations/admin/reservation/form.py
#: reservations/models/reservation_metadata.py resources/models.py
#: reservations/models/reservation_metadata.py
msgid "Name"
msgstr "Nimi"

Expand Down Expand Up @@ -1752,12 +1752,12 @@ msgid "Surface area"
msgstr "Pinta-ala"

#: reservation_units/admin/reservation_unit/form.py
#: reservations/admin/reservation/form.py resources/models.py
#: reservations/admin/reservation/form.py
msgid "Buffer time before"
msgstr "Tauko ennen varausta"

#: reservation_units/admin/reservation_unit/form.py
#: reservations/admin/reservation/form.py resources/models.py
#: reservations/admin/reservation/form.py
msgid "Buffer time after"
msgstr "Tauko varauksen jälkeen"

Expand Down Expand Up @@ -2837,16 +2837,6 @@ msgstr "Vaaditut kentät"
msgid "Reservation metadata sets"
msgstr "Varauslomakkeet"

#: resources/enums.py
msgctxt "ResourceLocationType"
msgid "Fixed"
msgstr "Kiinteä"

#: resources/enums.py
msgctxt "ResourceLocationType"
msgid "Movable"
msgstr "Siirrettävä"

#: spaces/admin/space.py
msgid "Search by name or unit name"
msgstr "Etsi nimellä tai toimipisteen nimellä"
Expand Down Expand Up @@ -3113,6 +3103,17 @@ msgctxt "OrderStatus"
msgid "Free"
msgstr "Maksuton"

#: tilavarauspalvelu/enums.py

msgctxt "ResourceLocationType"
msgid "Fixed"
msgstr "Kiinteä"

#: tilavarauspalvelu/enums.py
msgctxt "ResourceLocationType"
msgid "Movable"
msgstr "Siirrettävä"

#: tilavarauspalvelu/models/payment_accounting/model.py
msgid ""
"One of the following fields must be given: internal_order, profit_center, "
Expand Down
94 changes: 64 additions & 30 deletions locale/sv/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ msgstr ""
#: reservation_units/models/equipment.py reservation_units/models/keyword.py
#: reservation_units/models/reservation_unit_type.py
#: reservations/admin/reservation/form.py
#: reservations/models/reservation_metadata.py resources/models.py
#: reservations/models/reservation_metadata.py
msgid "Name"
msgstr ""

Expand Down Expand Up @@ -1700,12 +1700,12 @@ msgid "Surface area"
msgstr ""

#: reservation_units/admin/reservation_unit/form.py
#: reservations/admin/reservation/form.py resources/models.py
#: reservations/admin/reservation/form.py
msgid "Buffer time before"
msgstr ""

#: reservation_units/admin/reservation_unit/form.py
#: reservations/admin/reservation/form.py resources/models.py
#: reservations/admin/reservation/form.py
msgid "Buffer time after"
msgstr ""

Expand Down Expand Up @@ -2217,12 +2217,16 @@ msgid "Keyword group"
msgstr ""

#: reservation_units/models/reservation_unit.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation Unit"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservation_units/models/reservation_unit.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation Units"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservation_units/models/reservation_unit_cancellation_rule.py
msgid "Name for the rule"
Expand Down Expand Up @@ -2274,8 +2278,10 @@ msgid "Tax percentage"
msgstr ""

#: reservations/admin/reservation/admin.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Search by Reservation ID or name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/admin.py
#: reservations/admin/reservation/form.py
Expand Down Expand Up @@ -2340,16 +2346,22 @@ msgid "State"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation type"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Booking details"
msgid "Cancel details"
msgstr ""
msgstr "Uppgifter om bokningen"

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Booking details"
msgid "Handling details"
msgstr ""
msgstr "Uppgifter om bokningen"

#: reservations/admin/reservation/form.py
msgid "Handled at"
Expand Down Expand Up @@ -2392,12 +2404,16 @@ msgid "Reservee ID"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservee first name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservee last name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
msgid "Reservee email"
Expand All @@ -2408,8 +2424,10 @@ msgid "Reservee phone"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservee organisation name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
msgid "Reservee address street"
Expand Down Expand Up @@ -2444,8 +2462,10 @@ msgid "Billing last name"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Booking details"
msgid "Billing email"
msgstr ""
msgstr "Uppgifter om bokningen"

#: reservations/admin/reservation/form.py
msgid "Billing phone"
Expand Down Expand Up @@ -2512,8 +2532,10 @@ msgid "Reservation begin date and time"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation end date and time"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
msgid "When this reservation was handled"
Expand Down Expand Up @@ -2564,8 +2586,10 @@ msgid "Reservee's business or association identity code"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservee's first name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
msgid "Reservee's last name"
Expand All @@ -2580,8 +2604,10 @@ msgid "Reservee's phone number"
msgstr ""

#: reservations/admin/reservation/form.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservee's organisation name"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: reservations/admin/reservation/form.py
msgid "Reservee's street address"
Expand Down Expand Up @@ -2768,18 +2794,10 @@ msgid "Required fields"
msgstr ""

#: reservations/models/reservation_metadata.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation metadata sets"
msgstr ""

#: resources/enums.py
msgctxt "ResourceLocationType"
msgid "Fixed"
msgstr ""

#: resources/enums.py
msgctxt "ResourceLocationType"
msgid "Movable"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: spaces/admin/space.py
msgid "Search by name or unit name"
Expand Down Expand Up @@ -2880,8 +2898,10 @@ msgid "Value comes from the Merchant Experience API"
msgstr ""

#: tilavarauspalvelu/admin/payment_order/admin.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: tilavarauspalvelu/admin/payment_order/admin.py
msgid "Remote order ID"
Expand Down Expand Up @@ -2924,8 +2944,10 @@ msgid "Language"
msgstr ""

#: tilavarauspalvelu/admin/payment_order/admin.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation user UUID"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: tilavarauspalvelu/admin/payment_order/admin.py
msgid "Checkout URL"
Expand Down Expand Up @@ -3043,6 +3065,16 @@ msgctxt "OrderStatus"
msgid "Free"
msgstr ""

#: tilavarauspalvelu/enums.py
msgctxt "ResourceLocationType"
msgid "Fixed"
msgstr ""

#: tilavarauspalvelu/enums.py
msgctxt "ResourceLocationType"
msgid "Movable"
msgstr ""

#: tilavarauspalvelu/models/payment_accounting/model.py
msgid ""
"One of the following fields must be given: internal_order, profit_center, "
Expand Down Expand Up @@ -3092,8 +3124,10 @@ msgid "Preferred UI language"
msgstr ""

#: users/models.py
#, fuzzy
#| msgid "Reservation for %(name)s"
msgid "Reservation notification"
msgstr ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: users/models.py
msgid "Date of birth"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.1.1 on 2024-09-19 04:54

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("reservation_units", "0107_alter_reservationunit_payment_accounting_and_more"),
("tilavarauspalvelu", "0006_migrate_resources"),
]

operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.AlterField(
model_name="reservationunit",
name="resources",
field=models.ManyToManyField(
blank=True,
related_name="reservation_units",
to="tilavarauspalvelu.resource",
),
),
],
database_operations=[],
),
]
2 changes: 1 addition & 1 deletion reservation_units/models/reservation_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class ReservationUnit(SearchDocumentMixin, models.Model):
blank=True,
)
resources = models.ManyToManyField(
"resources.Resource",
"tilavarauspalvelu.Resource",
related_name="reservation_units",
blank=True,
)
Expand Down
2 changes: 1 addition & 1 deletion reservation_units/querysets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from common.date_utils import local_datetime
from common.db import ArrayUnnest, SubqueryArray
from reservation_units.utils.first_reservable_time_helper.first_reservable_time_helper import FirstReservableTimeHelper
from resources.models import Resource
from spaces.models import Space
from tilavarauspalvelu.models import Resource

if TYPE_CHECKING:
from collections.abc import Callable, Generator
Expand Down
21 changes: 0 additions & 21 deletions resources/admin.py

This file was deleted.

5 changes: 0 additions & 5 deletions resources/apps.py

This file was deleted.

Loading