Re: How to access the value of a field that failed validation

2023-01-15 Thread Clive Bruton
If you print: dir(form_instance) You'll get the methods available to the form. From memory, amongst these you will find "data" and "initial", I think that "data" contains the information submitted in the form action. So, to show that: print(form.data) -- Clive On 2 Jan 2023, at 00

Re: How to access the value of a field that failed validation

2023-01-03 Thread Jason
you'll need to implement custom validators to override the default `ValidationError` message for the fields. some fields include this functionality by default, ie DecimalField ( https://github.com/django/django/blob/main/django/forms/fields.py#L419-L428), others don't On Monday, January 2, 202

Re: How to access the value of a field that failed validation

2023-01-02 Thread Noel Duffy
On 3/01/23 02:21, Alex Sonar wrote: Hi Noel! Have you looked at the problem in context CSRF Protection? Please check it out - How to use Django’s CSRF protection https://docs.djangoproject.com/en/4.1/howto/csrf/ It might be as a solution... I don't see how this helps. I want to access

Re: How to access the value of a field that failed validation

2023-01-02 Thread Alex Sonar
Hi Noel! Have you looked at the problem in context CSRF Protection? Please check it out - How to use Django’s CSRF protection https://docs.djangoproject.com/en/4.1/howto/csrf/ It might be as a solution... On Monday, January 2, 2023 at 3:27:01 AM UTC+3 Noel Duffy wrote: > I'm new to Dj

How to access the value of a field that failed validation

2023-01-01 Thread Noel Duffy
I'm new to Django, though not to programming. I'm using Django 4.1.4 on AlmaLinux 9. My question is this. Is it possible to access a ModelForm field's value if that form field failed validation? I'm writing a small ticketing system for a helpdesk to handle spam reports. Users submit spam mes