django-validation Questions
4
I'm using Django 3, Python 3.8, and the Django Rest framework. Additionally, I'm using the address module from here -- https://github.com/furious-luke/django-address. I have built the following ser...
Jerricajerrie asked 30/7, 2020 at 22:2
11
Solved
I am storing a phone number in model like this:
phone_number = models.CharField(max_length=12)
The user would enter a phone number and I would use the phone number for SMS authentication. This app...
Cuttlefish asked 2/10, 2013 at 6:11
10
Solved
Django has various numeric fields available for use in models, e.g. DecimalField and PositiveIntegerField. Although the former can be restricted to the number of decimal places stored and the overa...
Vietnamese asked 11/5, 2009 at 17:29
4
I have a multi-file upload and want to limit users to 3 uploads each. My problem is that I need to know how many files a user has already created in the DB and how many they are currently uploading...
Mcfarlane asked 11/7, 2020 at 5:10
1
Solved
I have two models Product and Cart. Product model has maximum_order_quantity. While updating quantity in cart, I'll have to check whether quantity is greater than maximum_order_quantityat database ...
Hasp asked 5/3, 2023 at 4:17
1
Solved
I have a nested serializer field on a serializer which accepts Multipart/form-data (json + images).
The run_validation happens to remove the nested serializer field data from the QueryDict.
Here is...
Quasimodo asked 28/10, 2022 at 17:16
1
Passing a JSON + image data to a post endpoint, ends in converting part of request data to string. The part which is converted to string contains the file as well. Here is the input data:
data = {
...
Pteropod asked 25/10, 2022 at 10:28
1
Solved
I have a model in which I want to disallow the input of special characters(+,-,/,%, etc) in the title field:
class Article(models.Model):
title = models.CharField(max_length=100)
author = models....
Introspection asked 2/3, 2022 at 11:9
2
Solved
I have a form with KeywordInline. When I add new object using the form inlined formset has a js-link to add new form into formset. Newly added forms have a js-enabled delete button (x mark on the r...
Phan asked 26/9, 2011 at 9:27
2
Solved
In my model, I want to use a validator to analyze the content of a file, the thing I can not figure out is how to access the content of the file to parse through it as the file has not yet been sav...
Disenthrall asked 3/5, 2017 at 21:19
7
Solved
I'm just curious if anyone knows if there's good reason why django's orm doesn't call 'full_clean' on a model unless it is being saved as part of a model form.
Note that full_clean() will not b...
Murrelet asked 14/12, 2010 at 16:32
3
Solved
I have a very simple Django app in order to record the lectures given my colleagues.Since it is quite elementary,I am using the Django admin itself. Here is my models.py:
#models.py
from django.db...
Andrel asked 17/7, 2014 at 11:25
3
i use Django 1.9.2 with python 3.4.2.
In the first half of the development lifecycle i had this code:
class ModificationOrder(ERN):
...
san_amount = models.IntegerField(default=0, \
validators=...
Greatcoat asked 12/12, 2016 at 8:56
5
Solved
I am using Django's modelform and its really good. How can I highlight the actual text box (e.g. border:red ) if there is a validation error associated with it. Basically what i want is to add a cl...
Alleluia asked 31/1, 2011 at 5:32
4
Solved
I'm submitting a JSON to a django view with AJAX. The JSON looks like the following:
{
"code":"9910203040", // required
"name":"Abc", // required
"payments":[
{
"amount":300, // required
"na...
Francenefrances asked 20/5, 2017 at 11:7
2
Following is my model definition
class ProfessionalQualification(Log_Active_Owned_Model_Mixin):
PROF_TEACHER = 1
PROF_ENGINEER = 2
PROF_DOCTOR = 4
PROF_PROFESSOR = 8
PROF_MANAGER = 16
PROF_...
Inbreed asked 13/2, 2017 at 17:48
3
I have the following model:
class UserProfile(models.Model):
mobileNumber = models.BigIntegerField(primary_key=True)
authKey = models.CharField(max_length=300,null=False,blank=False)
creationDa...
Danielladanielle asked 25/3, 2014 at 12:8
2
Solved
I am quite a newbie understanding of how to catch exceptions in python. I have a question regarding those two types of ways of catching exceptions. I only found useful information about ValidationE...
Shearwater asked 8/2, 2019 at 13:20
3
Solved
Django does not respect the max_length attribute of TextField model field while validating a ModelForm.
So I define a LimitedTextField inherited from the models.TextField and added validation bits ...
Garnishment asked 8/7, 2010 at 18:46
1
Solved
I'm using Django 2.0 and trying to allow users to input a link to their website in a django ModelForm. I would like for my URLField to validate urls even when they have no scheme prefix.
I have r...
Fm asked 23/4, 2018 at 14:12
2
Solved
I have a model that uses different validation for its name field depending on whether the object was created by a user or by the system.
class Symbol(models.Model):
name = models.CharField(_('nam...
Angelicangelica asked 30/8, 2017 at 13:21
4
Solved
I've been doing things like this in the clean method:
if self.cleaned_data['type'].organized_by != self.cleaned_data['organized_by']:
raise forms.ValidationError('The type and organization do not...
Savoirvivre asked 22/1, 2010 at 12:6
1
I just started learning Django Rest Framework and I can't understand why DRF runs Model field validation before Own Validation I have a model which has a URLField and basically all I want to add ht...
Unison asked 24/10, 2017 at 11:40
1
Solved
I don't know how to access the size of the in the validator.
Here is my code
# serializers.py
class VideoSerializer(serializers.ModelSerializer):
""" Base serializer for Video model"""
video =...
Galactopoietic asked 29/4, 2016 at 21:36
1
Solved
I am currently creating an api based on DRF.I have a model which is like:
class Task(models.Model):
name = models.CharField(max_length = 255)
completed = models.BooleanField(default = False)
de...
Rosaline asked 16/11, 2015 at 16:20
1 Next >
© 2022 - 2025 — McMap. All rights reserved.