Skip to content

Commit

Permalink
add comments for magic method of field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaudDauce committed Feb 6, 2024
1 parent 4f57d0a commit 54a36c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions udata/core/dataset/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class SchemaForm(ModelForm):
version = fields.StringField(_('Version of the schema'))

def validate_url(form, field):
'''
This method is auto called by WTForms for the URL
'''
if not field.data:
if form.name.data:
return
Expand All @@ -48,6 +51,9 @@ def validate_url(form, field):
raise validators.ValidationError(_('Having both name and URL is not allowed.'))

def validate_name(form, field):
'''
This method is auto called by WTForms for the name
'''
if not field.data:
if form.url.data:
return
Expand Down

0 comments on commit 54a36c2

Please sign in to comment.