parent
b009ba692b
commit
9ee1975528
@ -264,7 +264,10 @@ class CategorisationRuleImportForm(ModelForm):
|
|||||||
|
|
||||||
class MultipleChoiceFieldAcceptAll(MultipleChoiceField):
|
class MultipleChoiceFieldAcceptAll(MultipleChoiceField):
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
pass
|
# check if each element is without "/"
|
||||||
|
for item in value:
|
||||||
|
if "/" in item:
|
||||||
|
raise ValidationError(_("The '/' character is not allowed."))
|
||||||
|
|
||||||
|
|
||||||
class EventForm(GroupFormMixin, ModelForm):
|
class EventForm(GroupFormMixin, ModelForm):
|
||||||
|
File diff suppressed because it is too large
Load Diff
25
src/agenda_culturel/migrations/0163_alter_tag_name.py
Normal file
25
src/agenda_culturel/migrations/0163_alter_tag_name.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Generated by Django 4.2.19 on 2025-04-03 19:36
|
||||||
|
|
||||||
|
import agenda_culturel.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("agenda_culturel", "0162_siteconfiguration_site_url"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="tag",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(
|
||||||
|
help_text="Tag name",
|
||||||
|
max_length=512,
|
||||||
|
unique=True,
|
||||||
|
validators=[agenda_culturel.models.no_slash_validator],
|
||||||
|
verbose_name="Name",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
@ -49,6 +49,7 @@ from django.db.models.expressions import RawSQL
|
|||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from solo.models import SingletonModel
|
from solo.models import SingletonModel
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
from .calendar import CalendarDay
|
from .calendar import CalendarDay
|
||||||
from .import_tasks.extractor import Extractor
|
from .import_tasks.extractor import Extractor
|
||||||
@ -64,6 +65,11 @@ logger = logging.getLogger(__name__)
|
|||||||
to_be_translated = [_("mean"), _("median"), _("maximum"), _("minimum"), _("stdev")]
|
to_be_translated = [_("mean"), _("median"), _("maximum"), _("minimum"), _("stdev")]
|
||||||
|
|
||||||
|
|
||||||
|
def no_slash_validator(value):
|
||||||
|
if "/" in value:
|
||||||
|
raise ValidationError(_("The '/' character is not allowed."))
|
||||||
|
|
||||||
|
|
||||||
class SiteConfiguration(SingletonModel):
|
class SiteConfiguration(SingletonModel):
|
||||||
site_name = models.CharField(
|
site_name = models.CharField(
|
||||||
verbose_name=_("Site name"), max_length=255, default="Pommes de lune"
|
verbose_name=_("Site name"), max_length=255, default="Pommes de lune"
|
||||||
@ -318,6 +324,7 @@ class Tag(models.Model):
|
|||||||
help_text=_("Tag name"),
|
help_text=_("Tag name"),
|
||||||
max_length=512,
|
max_length=512,
|
||||||
unique=True,
|
unique=True,
|
||||||
|
validators=[no_slash_validator],
|
||||||
)
|
)
|
||||||
|
|
||||||
description = CKEditor5Field(
|
description = CKEditor5Field(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user