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

Follow bugs in django #1470

Merged
merged 5 commits into from
Dec 16, 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
60 changes: 39 additions & 21 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,11 @@ msgstr ""
"vaihtoehdot on hylätty tai lukittu. <br>%(rejected)s: Kaikki haetut "
"toistokerrat tälle hakemuksen osalle ovat lukittu tai hylätty. <br>"

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "External UUID"
msgstr "Ulkoinen UUID"

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "Number of persons"
Expand All @@ -724,6 +729,11 @@ msgstr "Varausten loppumispäivä"
msgid "Purpose"
msgstr "Käyttötarkoitus"

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "ID for external systems to use"
msgstr "Tunniste ulkoisten järjestelmien käyttöön"

#: tilavarauspalvelu/admin/application_section/form.py
msgid "Name that describes this section."
msgstr "Nimi joka kuvaa tätä hakeuksen osaa."
Expand Down Expand Up @@ -791,6 +801,10 @@ msgstr ""
"Onko ilmoitus luonnos. Luonnoksia ei näytetä käyttäjille, vaikka ne olisivat "
"aktiivisia."

#: tilavarauspalvelu/admin/bug_report/admin.py
msgid "Search by name or description"
msgstr "Etsi nimellä tai kuvauksella"

#: tilavarauspalvelu/admin/city/admin.py
msgid "Municipality"
msgstr "Kunta"
Expand Down Expand Up @@ -1188,10 +1202,6 @@ msgstr "Ei"
msgid "Paid reservation"
msgstr "Maksullinen varaus"

#: tilavarauspalvelu/admin/reservation/form.py
msgid "External UUID"
msgstr "Ulkoinen UUID"

#: tilavarauspalvelu/admin/reservation/form.py
#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid "SKU"
Expand Down Expand Up @@ -1352,10 +1362,6 @@ msgstr "Syy hylkäämiselle"
msgid "Reason for cancellation"
msgstr "Syy perumiselle"

#: tilavarauspalvelu/admin/reservation/form.py
msgid "ID for external systems to use"
msgstr "Tunniste ulkoisten järjestelmien käyttöön"

#: tilavarauspalvelu/admin/reservation/form.py
msgid "SKU for this particular reservation"
msgstr "Tämän varauksen SKU"
Expand Down Expand Up @@ -1560,6 +1566,19 @@ msgstr "Julkaisun tila"
msgid "Reservation state"
msgstr "Varattavuuden tila"

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid ""
"Additional search terms that will bring up this reservation unit when making "
"text searches in the customer UI. These terms should be added to make sure "
"search results using text search in links from external sources work "
"regardless of the UI language."
msgstr ""
"Ylimääräiset hakusanat, joilla tätä varausyksikköä on mahdollista hakea "
"tekstihaun kautta asiakaskäyttöliittymässä. Hakusanoja tulee lisätä tähän "
"listaan silloin kun halutaan taata, että järjestelmän ulkopuolelta tulevissa "
"linkeissä käytettävät hakusanat tuottavat oikeat hakutulokset "
"käyttöliittymän kielestä rippumatta."

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid "Description (Finnish)"
msgstr "Kuvaus (Suomeksi)"
Expand Down Expand Up @@ -1978,19 +1997,6 @@ msgstr "Maksujen kirjanpidon tiliöintitiedot"
msgid "Product used for payments"
msgstr "Tuote, jota käytetään maksuihin"

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid ""
"Additional search terms that will bring up this reservation unit when making "
"text searches in the customer UI. These terms should be added to make sure "
"search results using text search in links from external sources work "
"regardless of the UI language."
msgstr ""
"Ylimääräiset hakusanat, joilla tätä varausyksikköä on mahdollista hakea "
"tekstihaun kautta asiakaskäyttöliittymässä. Hakusanoja tulee lisätä tähän "
"listaan silloin kun halutaan taata, että järjestelmän ulkopuolelta tulevissa "
"linkeissä käytettävät hakusanat tuottavat oikeat hakutulokset "
"käyttöliittymän kielestä rippumatta."

#: tilavarauspalvelu/admin/space/admin.py
msgid "Search by name or unit name"
msgstr "Etsi nimellä tai toimipisteen nimellä"
Expand Down Expand Up @@ -3274,6 +3280,18 @@ msgstr ""
"'active_from' ja 'active_until' täytyy olla joko tyhjiä tai asetettuja. Jos "
"molemmat on asetettu, 'active_until' täytyy olla 'active_from' jälkeen."

#: tilavarauspalvelu/models/bug_report/model.py
msgid "Someone else, who?"
msgstr "Joku muu, kuka?"

#: tilavarauspalvelu/models/bug_report/model.py
msgid "bug report"
msgstr "virheilmoitus"

#: tilavarauspalvelu/models/bug_report/model.py
msgid "bug reports"
msgstr "virheilmoitukset"

#: tilavarauspalvelu/models/city/model.py
msgid "city"
msgstr "kotikunta"
Expand Down
50 changes: 34 additions & 16 deletions locale/sv/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,11 @@ msgid ""
"applied slots for this application section have been locked or rejected. <br>"
msgstr ""

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "External UUID"
msgstr ""

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "Number of persons"
Expand All @@ -698,6 +703,11 @@ msgstr ""
msgid "Purpose"
msgstr ""

#: tilavarauspalvelu/admin/application_section/form.py
#: tilavarauspalvelu/admin/reservation/form.py
msgid "ID for external systems to use"
msgstr ""

#: tilavarauspalvelu/admin/application_section/form.py
msgid "Name that describes this section."
msgstr ""
Expand Down Expand Up @@ -758,6 +768,10 @@ msgid ""
"would be active."
msgstr ""

#: tilavarauspalvelu/admin/bug_report/admin.py
msgid "Search by name or description"
msgstr ""

#: tilavarauspalvelu/admin/city/admin.py
msgid "Municipality"
msgstr ""
Expand Down Expand Up @@ -1145,10 +1159,6 @@ msgstr ""
msgid "Paid reservation"
msgstr ""

#: tilavarauspalvelu/admin/reservation/form.py
msgid "External UUID"
msgstr ""

#: tilavarauspalvelu/admin/reservation/form.py
#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid "SKU"
Expand Down Expand Up @@ -1309,10 +1319,6 @@ msgstr ""
msgid "Reason for cancellation"
msgstr ""

#: tilavarauspalvelu/admin/reservation/form.py
msgid "ID for external systems to use"
msgstr ""

#: tilavarauspalvelu/admin/reservation/form.py
msgid "SKU for this particular reservation"
msgstr ""
Expand Down Expand Up @@ -1517,6 +1523,14 @@ msgstr ""
msgid "Reservation state"
msgstr ""

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid ""
"Additional search terms that will bring up this reservation unit when making "
"text searches in the customer UI. These terms should be added to make sure "
"search results using text search in links from external sources work "
"regardless of the UI language."
msgstr ""

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid "Description (Finnish)"
msgstr ""
Expand Down Expand Up @@ -1921,14 +1935,6 @@ msgstr ""
msgid "Product used for payments"
msgstr ""

#: tilavarauspalvelu/admin/reservation_unit/form.py
msgid ""
"Additional search terms that will bring up this reservation unit when making "
"text searches in the customer UI. These terms should be added to make sure "
"search results using text search in links from external sources work "
"regardless of the UI language."
msgstr ""

#: tilavarauspalvelu/admin/space/admin.py
msgid "Search by name or unit name"
msgstr ""
Expand Down Expand Up @@ -3203,6 +3209,18 @@ msgid ""
"are set, 'active_until' must be after 'active_from'."
msgstr ""

#: tilavarauspalvelu/models/bug_report/model.py
msgid "Someone else, who?"
msgstr ""

#: tilavarauspalvelu/models/bug_report/model.py
msgid "bug report"
msgstr ""

#: tilavarauspalvelu/models/bug_report/model.py
msgid "bug reports"
msgstr ""

#: tilavarauspalvelu/models/city/model.py
msgid "city"
msgstr ""
Expand Down
13 changes: 12 additions & 1 deletion tests/test_admin/test_django_admin_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
from django.urls import reverse

from tilavarauspalvelu.enums import EmailType
from tilavarauspalvelu.models import RequestLog, Reservation, SQLLog
from tilavarauspalvelu.models import BugReport, RequestLog, Reservation, SQLLog
from tilavarauspalvelu.models.bug_report.model import BugReportPhaseChoice, BugReportUserChoice
from tilavarauspalvelu.tasks import create_or_update_reservation_statistics
from tilavarauspalvelu.utils.verkkokauppa.verkkokauppa_api_client import VerkkokauppaAPIClient
from utils.date_utils import local_datetime

from tests import factories
from tests.helpers import patch_method
Expand Down Expand Up @@ -46,6 +48,12 @@ def create_all_models():
duration_ns=123,
stack_info="stack_info",
)
BugReport.objects.create(
name="Example",
phase=BugReportPhaseChoice.PULL_REQUEST,
found_by=BugReportUserChoice.MATTI,
found_at=local_datetime(),
)

create_or_update_reservation_statistics(Reservation.objects.values_list("pk", flat=True))

Expand Down Expand Up @@ -78,6 +86,9 @@ def test_django_admin_site__pages_load__model_admins(create_all_models):
# Edit & Delete views
elif url_pattern.lookup_str.endswith((".change_view", ".delete_view")):
first_object = model.objects.first()
if first_object is None:
pytest.fail(f"Did not find any objects for model '{model}'")

admin_url = reverse(f"admin:{url_pattern.name}", args=[first_object.pk])

assert client.get(admin_url).status_code == 200, admin_url
Expand Down
2 changes: 2 additions & 0 deletions tilavarauspalvelu/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .application_round.admin import ApplicationRoundAdmin
from .application_section.admin import ApplicationSectionAdmin
from .banner_notification.admin import BannerNotificationAdmin
from .bug_report.admin import BugReportAdmin
from .city.admin import CityAdmin
from .equipment.admin import EquipmentAdmin
from .equipment_category.admin import EquipmentCategoryAdmin
Expand Down Expand Up @@ -53,6 +54,7 @@
"ApplicationRoundAdmin",
"ApplicationSectionAdmin",
"BannerNotificationAdmin",
"BugReportAdmin",
"CityAdmin",
"EquipmentAdmin",
"EquipmentCategoryAdmin",
Expand Down
Empty file.
50 changes: 50 additions & 0 deletions tilavarauspalvelu/admin/bug_report/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from __future__ import annotations

from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from import_export.admin import ExportMixin
from import_export.formats.base_formats import CSV

from tilavarauspalvelu.models import BugReport


@admin.register(BugReport)
class BugReportAdmin(ExportMixin, admin.ModelAdmin):
# Functions
search_fields = [
"name",
"description",
]
search_help_text = _("Search by name or description")
formats = [CSV]

# List
list_display = [
"name",
"found_at",
"fixed_at",
]
list_filter = [
"phase",
"was_real_issue",
"found_by",
"fixed_by",
]

# Form
fields = [
"name",
"description",
"phase",
"was_real_issue",
"found_by",
"found_at",
"fixed_by",
"fixed_at",
"created_at",
"updated_at",
]
readonly_fields = [
"created_at",
"updated_at",
]
Loading
Loading