[Django] #34735: About form validation

16 views
Skip to first unread message

Django

unread,
Jul 24, 2023, 3:52:54 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-----------------------------------------+------------------------
Reporter: mrtemp2 | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Greeting i'm trying to customise the ValidationError message i got this
"veuillez renseigner ce champ" as a toolip under the input field my web
site is in other language and already setup in settings.py this is my
forms.py
{{{
class OrganismForm(forms.ModelForm):

class Meta:
model = Organism
fields = ['code', 'name', 'parent', 'region']
exclude = []
widgets = {
'code': forms.TextInput(attrs={'class': 'form-control form-
control-outline',
'placeholder':'Placeholder' ,
'data-listener-
added_b000d9d8':'true'}),
'name': forms.TextInput(attrs={'class': 'form-control form-
control-outline',
'placeholder':'Placeholder' ,
'data-listener-
added_b000d9d8':'true'}),
'parent': forms.Select(attrs={'class': 'select select2-hidden-
accessible',
}),
'region': forms.Select(attrs={'class': 'select select2-hidden-
accessible',
}),
}
localized_fields = None
labels = {}
help_texts = {}
error_messages = {}

def __init__(self, *args, **kwargs):
return super(OrganismForm, self).__init__(*args, **kwargs)

def is_valid(self):
return super(OrganismForm, self).is_valid()

def full_clean(self):
return super(OrganismForm, self).full_clean()

def clean_code(self):
code = self.cleaned_data.get("code", None)
return code

def clean_name(self):
name = self.cleaned_data.get("name", None)
if not name:
raise ValidationError('custom text message.')
return name

def clean_parent(self):
parent = self.cleaned_data.get("parent", None)
return parent

def clean_region(self):
region = self.cleaned_data.get("region", None)
return region

def clean(self):
return super(OrganismForm, self).clean()

def validate_unique(self):
return super(OrganismForm, self).validate_unique()

def save(self, commit=True):
return super(OrganismForm, self).save(commit)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34735>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 24, 2023, 3:53:52 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------

Reporter: mrtemp2 | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 4.2
Severity: Normal | Resolution:
Keywords: forms | Triage Stage:
ValidationError | Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mrtemp2):

* cc: mrtemp2 (added)
* keywords: => forms ValidationError
* component: Uncategorized => Forms


--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:1>

Django

unread,
Jul 24, 2023, 3:54:20 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------
Reporter: mrtemp2 | Owner: mrtemp2
Type: Uncategorized | Status: assigned

Component: Forms | Version: 4.2
Severity: Normal | Resolution:
Keywords: forms | Triage Stage:
ValidationError | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mrtemp2):

* cc: mrtemp2 (removed)
* owner: nobody => mrtemp2
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:2>

Django

unread,
Jul 24, 2023, 3:56:00 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------
Reporter: Anis | Owner: Anis
Type: Uncategorized | Status: closed
Component: Forms | Version: 4.2
Severity: Normal | Resolution: invalid

Keywords: forms | Triage Stage:
ValidationError | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: assigned => closed
* resolution: => invalid


Comment:

Please don't use Trac as a support channel. If you're having trouble
understanding how Django works, see
TicketClosingReasons/UseSupportChannels for ways to get help.

--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:3>

Django

unread,
Jul 24, 2023, 4:46:50 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------
Reporter: Anis | Owner: Anis
Type: | Status: closed
Cleanup/optimization |

Component: Forms | Version: 4.2
Severity: Normal | Resolution: invalid
Keywords: forms | Triage Stage:
ValidationError | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Anis):

* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:4>

Django

unread,
Jul 24, 2023, 4:47:13 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------
Reporter: Anis | Owner: Anis
Type: | Status: new

Cleanup/optimization |
Component: Forms | Version: 4.2
Severity: Normal | Resolution:
Keywords: forms | Triage Stage:
ValidationError | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Anis):

* status: closed => new
* resolution: invalid =>


--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:5>

Django

unread,
Jul 24, 2023, 4:48:06 AM7/24/23
to django-...@googlegroups.com
#34735: About form validation
-------------------------------------+-------------------------------------
Reporter: Anis | Owner: Anis
Type: | Status: closed

Cleanup/optimization |
Component: Forms | Version: 4.2
Severity: Normal | Resolution: invalid

Keywords: forms | Triage Stage:
ValidationError | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Anis, please don't reopen closed tickets.

--
Ticket URL: <https://code.djangoproject.com/ticket/34735#comment:6>

Reply all
Reply to author
Forward
0 new messages