Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d7d3c57
added default expiration time to the qualification to make it as vers…
Aug 21, 2025
f6d940a
addind default expiration time field for QualificationForm
Aug 21, 2025
696c52f
added default expiratrion time for import
Aug 21, 2025
7a15c34
added regex for input validation
Aug 21, 2025
f92927a
adding translations for expiration time
Aug 21, 2025
36d67f6
adding template for relative time field
Sep 15, 2025
63641fd
adding widget for custom relative time fields
Sep 15, 2025
8e64c21
added relative time field
Sep 15, 2025
71305ae
added defaultexpirationtimefield and implemented to qualification model
Sep 15, 2025
aaeb3b0
Changed Option for expiration time
Sep 15, 2025
341b3e2
added translations for default expiration time
Sep 15, 2025
d427317
add labels
Sep 15, 2025
6827e7f
add hidding for unused fields
Sep 15, 2025
d8ff0d6
translation for labels of subwidgets
Sep 15, 2025
bdf2ac0
improved styling for mobile devices
Sep 15, 2025
da6225b
init commit for plugin
Oct 3, 2025
1622d7d
added own modelgroup for relative time types
Oct 8, 2025
314735c
refactored widget for variable use
Oct 8, 2025
0cabaf9
refactored fields for variable use
Oct 8, 2025
5a52f25
added plugin
Oct 13, 2025
7acd8d8
removed old plugin(name)
Oct 13, 2025
57aa11b
copied old templates
Oct 13, 2025
4d72127
added model from old plugin
Oct 13, 2025
219a339
added add view (only view, not save)
Oct 13, 2025
2e534a4
added views for own, all and add
Oct 13, 2025
91cf98c
added urls for own, all, add
Oct 13, 2025
877515e
added signals to add to settings
Oct 13, 2025
0b12fcd
added human readable names
Oct 15, 2025
23608d8
reentered which fields to show in the list view.
Oct 15, 2025
3b20b12
corrected views an added update view
Oct 15, 2025
c244add
added url for update view
Oct 15, 2025
1dee014
corrected tempaltes for list views
Oct 15, 2025
4943068
corrected templates
Oct 16, 2025
b36d3df
added user_comment to model
Oct 16, 2025
ffb2204
seperated form for checking
Oct 16, 2025
e157ef8
configured view for new form
Oct 16, 2025
d931e4d
changed names in urls
Oct 16, 2025
c1403bc
removed batch
Oct 19, 2025
83f71d3
added falsly deleted import
Oct 19, 2025
6e2e1c9
removed unused templates
Oct 21, 2025
784ecd9
removed unused fields in form of comments
Oct 21, 2025
41e9655
restructured templates
Oct 21, 2025
1181fc3
refactoring model and adding __str__ method
Oct 21, 2025
ac0f006
reworking form into multiple simpler forms
Oct 21, 2025
36ea6bb
corrected active state for nav items
Oct 21, 2025
124822a
added and corrected url names
Oct 21, 2025
de3558f
restructured add view and adding check and delete views
Oct 21, 2025
16a7207
added calculation for expiration date
Oct 25, 2025
387ea3e
corrected event observing
Oct 26, 2025
3e49074
added notifications
Oct 26, 2025
e303003
changed name
Oct 30, 2025
15bf226
rework field and widget to use fixed values and MultiValueField
jeriox Dec 4, 2025
fc85285
rework request to use consequence handler
jeriox Dec 5, 2025
9b863b3
implement other types
jeriox Dec 6, 2025
368c06b
Merge pull request #1 from ephios-dev/expiration-time-rewrite
samuelson-ben Dec 7, 2025
c75003f
Revert "simplify expiration handling"
samuelson-ben Dec 7, 2025
3530ede
Merge pull request #2 from samuelson-ben/revert-1-expiration-time-rew…
samuelson-ben Dec 7, 2025
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
31 changes: 30 additions & 1 deletion ephios/core/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from django.contrib.auth import get_user_model
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
from django.contrib.auth.models import Group, PermissionsMixin
from django.core.validators import RegexValidator
from django.db import models, transaction
from django.db.models import (
BooleanField,
Expand All @@ -30,6 +31,7 @@
)
from django.db.models.functions import Lower, TruncDate
from django.utils import timezone
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _

from ephios.extra.fields import EndOfDayDateTimeField
Expand Down Expand Up @@ -275,6 +277,16 @@ class QualificationManager(models.Manager):
def get_by_natural_key(self, qualification_uuid, *args):
return self.get(uuid=qualification_uuid)

expiration_format_validator = RegexValidator(
regex=(
r"^$|" # empty
r"^(?:\d{1,2}|0{1,2}|\+\d+)\." # day: 1–2 digits OR 0/00 OR +N
r"(?:\d{1,2}|0{1,2}|\+\d+)\." # month: 1–2 digits OR 0/00 OR +N
r"(?:\d{4}|0{1,2}|0000|\+\d+)$|" # year: 4 digits OR 0 OR 00 OR 0000 OR +N
r"^\+\d+$" # relative only: +N
),
message=_("Invalid format."),
)

class Qualification(Model):
uuid = models.UUIDField(unique=True, default=uuid.uuid4, verbose_name="UUID")
Expand All @@ -294,6 +306,24 @@ class Qualification(Model):
symmetrical=False,
blank=True,
)
default_expiration_time = models.CharField(
max_length=254,
verbose_name=_("Default expiration format"),
help_text=_(
"Allowed are:<br>"
"- leave empty<br>"
"- DD.MM.YYYY (e.g. 31.12.2025)<br>"
"- +N (relative years/months/days)<br>"
"- Mixed like 30.06.+2 or 0.6.+1<br>"
"- Fully relative like +1.+1.+1<br>"
"- Placeholders:<br>"
"&nbsp;&nbsp;• 0 or 00 for day/month<br>"
"&nbsp;&nbsp;• 0, 00 or 0000 for year"
Comment thread
samuelson-ben marked this conversation as resolved.
Outdated
),
null=True,
blank=True,
validators=[expiration_format_validator],
)
is_imported = models.BooleanField(verbose_name=_("imported"), default=True)

objects = QualificationManager()
Expand All @@ -317,7 +347,6 @@ def natural_key(self):

natural_key.dependencies = ["core.QualificationCategory"]


register_model_for_logging(
Qualification,
ModelFieldsLogConfig(),
Expand Down
Loading