- shared-moduuli: DomainError, EmailAddress, UnitOfWork, tapahtumat, TimestampedModel, daisyUI-lomakerenderöinti ja yhteiset pohjat - users-moduuli Clean Architecture -kerroksin: oma käyttäjämalli (AUTH_USER_MODEL), roolit ja oikeudet, harjoittelija-, vastuuhenkilö- ja viimeisen pääkäyttäjän säännöt - kirjautuminen sähköpostilla, yritysten rajoitus, "muista minut", istunnon katkaisu kun tunnus poistetaan käytöstä tai harjoittelu päättyy - kertakäyttöiset salasanalinkit (72 h / 60 min, uusi mitätöi vanhan), salasanasääntö ja create_admin-komento - käyttäjähallinta: lista (HTMX-haku), lomakkeet ja kopioitava linkki - Tailwind 4 + daisyUI 5 + HTMX + Alpine npm-buildilla, suomennokset - testit: domain, application (fakeilla), integraatio ja selaintestit (axe, vaalea/tumma, 1920/320 px); ruff, mypy ja import-linter - dokumentit päivitetty toteutuksen mukaisiksi Co-Authored-By: Claude Opus 5.5 <[email protected]>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""Translated display names and error messages of the users module."""
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from apps.users.domain.enums import Role
|
|
|
|
ROLE_LABELS = {
|
|
Role.ADMIN: _("Admin"),
|
|
Role.MANAGEMENT: _("Management"),
|
|
Role.EMPLOYEE: _("Employee"),
|
|
Role.INTERN: _("Intern"),
|
|
Role.SUBCONTRACTOR: _("Subcontractor"),
|
|
}
|
|
|
|
ROLE_CHOICES = [(role.value, label) for role, label in ROLE_LABELS.items()]
|
|
|
|
ERROR_MESSAGES = {
|
|
"invalid_name": _("Enter a name (at most 150 characters)."),
|
|
"invalid_email": _("Enter a valid email address."),
|
|
"email_taken": _("A user with this email address already exists."),
|
|
"intern_requires_end_date": _("An intern must have an end date."),
|
|
"intern_requires_supervisor": _("An intern must have a supervisor."),
|
|
"invalid_supervisor": _("The supervisor must be an active management or employee user."),
|
|
"last_active_admin": _(
|
|
"This is the last active admin. It cannot be deactivated or moved to another role."
|
|
),
|
|
"supervisor_has_interns": _(
|
|
"This user supervises active interns. Change their supervisor first."
|
|
),
|
|
"user_not_found": _("The user was not found."),
|
|
"*": _("The change could not be saved."),
|
|
}
|