Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Mar 8, 2025
1 parent de7fbd4 commit b93c75a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mesads/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ def validate_siret(value):
)


ADS_UNIQUE_ERROR_MESSAGE = "Une ADS avec ce numéro existe déjà. Supprimez l'ADS existante, ou utilisez un autre numéro."


@reversion.register
class ADS(SmartValidationMixin, CharFieldsStripperMixin, SoftDeleteMixin, models.Model):
"""Autorisation De Stationnement created by ADSManager."""
Expand All @@ -391,7 +394,7 @@ class Meta:
fields=["number", "ads_manager_id"],
condition=Q(deleted_at__isnull=True),
name="unique_ads_number",
violation_error_message="Une ADS avec ce numéro existe déjà. Supprimez l'ADS existante, ou utilisez un autre numéro.",
violation_error_message=ADS_UNIQUE_ERROR_MESSAGE,
),
models.CheckConstraint(
check=Q(ads_creation_date__isnull=True)
Expand Down
3 changes: 2 additions & 1 deletion mesads/app/views/ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
ADSLegalFile,
ADSManager,
ADSUser,
ADS_UNIQUE_ERROR_MESSAGE,
)
from ..reversion_diff import ModelHistory

Expand Down Expand Up @@ -273,7 +274,7 @@ def form_valid(self, form):
with transaction.atomic():
return super().form_valid(form)
except IntegrityError:
form.add_error("number", ADS.UNIQUE_ERROR_MSG)
form.add_error("number", ADS_UNIQUE_ERROR_MESSAGE)
return super().form_invalid(form)


Expand Down

0 comments on commit b93c75a

Please sign in to comment.