All Questions
Tagged with django validation
1,100
questions
1
vote
0
answers
20
views
Custom email validation in django form
In my django Account app I have a model for Account
class Account(AbstractBaseUser):
wallet_value = models.DecimalField(max_digits=10, decimal_places=2, default=0.00)
first_name = models....
2
votes
1
answer
42
views
Django: Screening dangerous characters from text input [duplicate]
I have a Django app where a few of the forms support a text input with maximum lengths of either 50 or 250 characters. In all cases, the data entered will be stored in the backend DB and will be ...
-4
votes
0
answers
31
views
How to retrieve the mobile number linked to an any user Aadhaar card in python django
How to retrieve the mobile number linked to an any users Aadhaar card.
I want to validate user aadhaar card so I'll send OTP on aadhaar mobile number to validate, that's my approach.
So Any builtin ...
0
votes
1
answer
22
views
How to validate an enum in Django using serializers
I'm using serializers to validate my Post data. How can I validate an Enum?
I have a class like this:
class DataTypeEnum(StrEnum):
FLOAT = 'float'
INTEGER = 'integer'
BOOLEAN = 'boolean'
...
-3
votes
1
answer
61
views
Validating POST parameters with serializers in Django [closed]
I'm trying to implement a simple validator for my POST parameters
My input looks like this:
{
"gage_id": "01010000",
"forcing_source":"my_source",
"...
-1
votes
1
answer
43
views
How to validate Post arguments in Django
I've seen plenty of solutions on how to validate Form field parameters, but I am not using Django templates or implementing the front-end in Django at all. I'm looking purely for server-side backend ...
1
vote
2
answers
46
views
Model field "null together or not at all" constraint
I need a way to create either a validator or a constraint at model level to evaluate two or more fields to be able to be null/blank only if all of them are null/blank at the same time.
For example, in ...
0
votes
0
answers
23
views
Problem when styling django form fields upon errors [duplicate]
I have a bug I've been trying to fix for months but can't figure out.
I'm building a website with Django. The site has a form, that, among other fields, has a field to input the name (called "...
0
votes
1
answer
50
views
How to raise a ValidationError in the ModelForm's save method in Django?
I want my ModelForm error handler to show validation errors from the save() method just like they do in the clean() method - i.e. as a warning on the admin form, instead of generating a 500 page.
The ...
0
votes
0
answers
38
views
Django: Adding unique together errors to one of the involved fields
Note: I asked this question on the Django forum, but since I did not receive any answers there, I'm asking here, too.
I’m building an application with multi-tenancy, meaning that all data is ...
1
vote
1
answer
99
views
Pydantic, Django Ninja "Day is out of range for month"
2024-02-29 14:04:15 pydantic.error_wrappers.ValidationError: 1 validation error for NinjaResponseSchema
2024-02-29 14:04:15 response
2024-02-29 14:04:15 day is out of range for month (type=...
0
votes
0
answers
31
views
How to Design Django models with optional fields for use with ModelForm validation?
I have some models which I want to use in ModelForm.
There are some optional values in the model. Since in my use-case, blank value does not make sense for those fields, thus I set null=True but not ...
1
vote
0
answers
64
views
how to form validation unique
Please tell me. I created a form in which you can select more than 1 artist for one order. Somehow it was made so that if the user mistakenly selected the same artist several times when saving, the ...
-1
votes
1
answer
87
views
How to write unit test case for due date validation ? How to unit test DateField or DateTimeField validation?
Here main question is that how to write unittest cases for due date validation with DateField or DateTimeField we can do it through multiple methods & i will answer you those methods
So basically ...
1
vote
1
answer
54
views
DRF Serializer field's queryset not updating
I have a Django models:
class Author(Model):
name = CharField(max_length=256)
class Library(Model):
address = CharField(max_length=256)
books = ManyToManyField(Book)
class Book(Model):
name =...