Skip to content
Snippets Groups Projects
Commit 5a7efe1b authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'fix/double-validation-school-term' into 'master'

Remove double validation of school terms

See merge request !1564
parents e51bb4c9 45404b8d
No related branches found
No related tags found
1 merge request!1564Remove double validation of school terms
Pipeline #192232 passed with warnings
from django.core.exceptions import PermissionDenied, ValidationError
from django.utils.translation import gettext as _
from django.core.exceptions import PermissionDenied
from graphene_django import DjangoObjectType
......@@ -37,20 +36,6 @@ class SchoolTermBatchCreateMutation(BaseBatchCreateMutation):
permissions = ("core.create_school_term_rule",)
only_fields = ("id", "name", "date_start", "date_end")
@classmethod
def validate(cls, root, info, input, inputs): # noqa
for input in inputs: # noqa
date_start = input.get("date_start")
date_end = input.get("date_end")
if date_end < date_start:
raise ValidationError(_("The start date must be earlier than the end date."))
qs = SchoolTerm.objects.within_dates(date_start, date_end)
if qs.exists():
raise ValidationError(
_("There is already a school term for this time or a part of this time.")
)
class SchoolTermBatchDeleteMutation(BaseBatchDeleteMutation):
class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment