Streamlining Model validation of ForeignKeys

2024-05-10 Thread Shaheed Haque
total. The instances of Input number in the millions, and may be loaded from external files/network endpoints. When Input instances are created, we perform normal Django validation processing, involving form.is_valid()/form.errors. As we know, Django 5.x does something like: 1. Form field

django form validation error massage not showing. please help me out

2023-09-15 Thread Mohammad Shahidullah
models.py class Position(models.Model): title = models.CharField(max_length=50) def __str__(self): return self.title class Department(models.Model): title = models.CharField(max_length=50) def __str__(self): return self.title class Employee(models.Model): fu

Re: Multitenant app // Validation / constraints for related fields

2023-01-19 Thread ASAMOAH EMMANUEL
One other approach you could consider is using Django's built-in form and model validation. You could create a custom form class that inherits from the built-in Django `ModelForm` and override the `clean` method to perform your tenant check. For example: class BlogPostForm(forms.Mode

Multitenant app // Validation / constraints for related fields

2023-01-19 Thread Abeed Visram
Hi there, Long-time lurker / Django user; first-time poster. Ask: Any other ideas for ensuring that ForeignKey relationships are valid? Context / background: I'm working on a multitenant app, and looking at ways of ensuring the integrity of the data in the system. Specifically, I want to ensur

Re: Admin validation activated just once after final call to save_model()

2023-01-18 Thread David Wallace
sults. > This ensures that the user can't accidentally try to set two results as > first place, for example. > > 2. The change list page ModelFormSet validation - The Django admin change > list page uses a ModelFormSet for list_editable. You can override the > formset[a] and

Admin validation activated just once after final call to save_model()

2023-01-15 Thread David Wallace
nged in order of result. 1 on the top row and N on the Nth row. The over-ride of save_model() achieves nothing functional but is merely an effort to discover something using print() calls about the validation and save sequence. It seems to indicate to me that there is a separate and individual c

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

2023-01-15 Thread Clive Bruton
data) -- Clive On 2 Jan 2023, at 00:12, Noel Duffy wrote: 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

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
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

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 report

Re: ModelMultipleChoiceField - override validation

2021-11-22 Thread Earl Lapus
I was able to resolve this by overriding `clean()` instead of `to_python()`. In there, I've the set correct queryset to use for validation. I still could not explain why `to_python()` is not called. On Saturday, November 20, 2021 at 8:38:47 AM UTC+8 Earl Lapus wrote: > Hi, >

ModelMultipleChoiceField - override validation

2021-11-19 Thread Earl Lapus
g into an error during submit - validation error. An example error I get is: *"Select a valid choice. 4 is not one of the available choices." *This is expected since I've set the queryset to be empty, so values will match during validation. Where should I override the

Re: Problem re-rendering ClearableFileInput on validation error

2021-10-08 Thread Jesus Antonio Sv
lank file input. Is there a case where FileField.bound_data() > should return anything else than the initial value? > > > > On Fri, Dec 11, 2020 at 10:36 AM Michael Goffioul > wrote: > >> When a form containing a ClearableFileInput is re-rendered (e.g. due to >> vali

Re: Allow field validation in ajax.

2021-06-17 Thread Ayush Bisht
If you specifically trying to validate the form on the basis of empty input field, then simply include *required* attribute in you input field ** and for more validation , you just validate all the thing in HTML only using django template tags... here I am including a descent approach

Re: Allow field validation in ajax.

2021-06-17 Thread Eugene TUYIZERE
ully save the records in the database >> without page loading. But what I want is to validate the fields first >> before saving. The codes do not validate the empty field. How can I include >> that validation ? please help >> >> >> $(".submit_btn")

Re: Allow field validation in ajax.

2021-06-12 Thread Nikeet NA
idate the empty field. How can I include that > validation ? please help > > > $(".submit_btn").click(function(){ > var form=new FormData($("#ReportForm")[0]); > //AJAX CODE > var xhr=new XMLHttpRequest(); > xhr.onreadystatechange=function(){ > if(xhr.sta

Allow field validation in ajax.

2021-06-12 Thread Eugene TUYIZERE
Friends, The ajax codes below successfully save the records in the database without page loading. But what I want is to validate the fields first before saving. The codes do not validate the empty field. How can I include that validation ? please help $(".submit_btn").click(function()

Re: Problem re-rendering ClearableFileInput on validation error

2020-12-11 Thread Michael Goffioul
at 10:36 AM Michael Goffioul < michael.goffi...@gmail.com> wrote: > When a form containing a ClearableFileInput is re-rendered (e.g. due to > validation error of some other field), and the clear checkbox was checked > on the first submit, the widget is rendered without initial

Problem re-rendering ClearableFileInput on validation error

2020-12-11 Thread Michael Goffioul
When a form containing a ClearableFileInput is re-rendered (e.g. due to validation error of some other field), and the clear checkbox was checked on the first submit, the widget is rendered without initial value, as empty file input. For instance, let's says there's a model with Imag

Re: Date validation in javascript

2020-12-03 Thread Avi shah
Hi , Check this out https://www.youtube.com/watch?v=cBOyVNR2Seg On Thu, Dec 3, 2020 at 6:48 PM Eugene TUYIZERE wrote: > Dear Team, > > In my project, I have the date format MM. How to validate that the MM > part cannot exceed 12? I think this can be done in javascript but don't > know how.

Date validation in javascript

2020-12-03 Thread Eugene TUYIZERE
Dear Team, In my project, I have the date format MM. How to validate that the MM part cannot exceed 12? I think this can be done in javascript but don't know how. Assist please. Thank you -- *TUYIZERE Eugene* *Msc Degree in Mathematical Science* *African Institute for Mathematical Scien

Validation always True for CharField but not with DateField in FormSet

2020-06-05 Thread Rookie
StackOverflow: https://stackoverflow.com/questions/62206149/validation-always-true-blank-false-for-charfield-but-not-with-datefield I have an inlineformset_factory containing a field. When this field is a CharField (blank=False) and I run is_valid() on the formset, True is always returned even

General Question Regarding Django Password Validation differences

2020-04-19 Thread Ahmed Khairy
I have used UserCreationForm and got this result below with no validations regarding the password while there are other Usercreationforms with password validations. I am using Django 2.2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: How to do validation on a form which is opened by clicking a button

2020-03-01 Thread Sunil BK
Hey Guys Thanks for your reply!! I finally managed to get the code running. The reason for no showing up the validation messages was, that I my action within the form action method was set to POST. When I have switched that to GET, everything worked as expected. Thanks Sunil Am Freitag, 28

Re: How to do validation on a form which is opened by clicking a button

2020-02-28 Thread Naveen Arora
mple form which can be opened using a button. It > should offer some fields which should be further process after validation. > And there is exactly my issue. When I write some data into the fields and > click the submit button. the validation error is NOT displayed below the > screen

Re: How to do validation on a form which is opened by clicking a button

2020-02-27 Thread 'rossm6' via Django users
trying to build a simple form which can be opened using a button. It > should offer some fields which should be further process after validation. > And there is exactly my issue. When I write some data into the fields and > click the submit button. the validation error is NOT displayed

How to do validation on a form which is opened by clicking a button

2020-02-27 Thread Sunil BK
Hello community I am trying to build a simple form which can be opened using a button. It should offer some fields which should be further process after validation. And there is exactly my issue. When I write some data into the fields and click the submit button. the validation error is NOT

Re: Django Validation error

2020-01-09 Thread Soumen Khatua
eld(max_length=10,unique = True, >>> blank=False,default = uuid.uuid4().hex[:8]) >>> first_name = models.CharField(_('first name'), max_length=30)last_name >>> = models.CharField(_('last name'), max_length=30, blank=True)is_acti

Re: Django Validation error

2020-01-09 Thread Wesley Montcho
max_length=30, blank=True)is_active >> = models.BooleanField(_('active'), default=True)is_staff = >> models.BooleanField(_('staff status'),default=False)date_joined = >> models.DateTimeField(_('date joined'), default=timezone.now)* &g

Re: Dajgo Validation error

2020-01-09 Thread Suraj Thapa FC
e > = models.BooleanField(_('active'), default=True)is_staff = > models.BooleanField(_('staff status'),default=False)date_joined = > models.DateTimeField(_('date joined'), default=timezone.now)* > > > I already did that but I want to rai

Re: Dajgo Validation error

2020-01-08 Thread Soumen Khatua
'), max_length=30, blank=True)is_active = models.BooleanField(_('active'), default=True)is_staff = models.BooleanField(_('staff status'),default=False)date_joined = models.DateTimeField(_('date joined'), default=timezone.now)* I already did that but I wa

Re: Dajgo Validation error

2020-01-08 Thread Suraj Thapa FC
For email you can set email field in model as unique=True and the password should be stored in hash.. On Wed, 8 Jan 2020, 9:37 pm Soumen Khatua, wrote: > Hi Folk, > > What is the process to validate fields in django rest framework? > like email and phone number should be unique and password sho

Dajgo Validation error

2020-01-08 Thread Soumen Khatua
Hi Folk, What is the process to validate fields in django rest framework? like email and phone number should be unique and password should be alphanumeric character only. Where i need to write the logic inside serializers or views part and how i can do that? Thank you in advance Regards, Soumen

Re: For validation not working for UserCreationForm

2019-08-29 Thread Shakil Ahmmed
;].widget.attrs['class'] = 'form-control' > self.fields['password1'].widget.attrs['class'] = 'form-control' > self.fields['password2'].widget.attrs['class'] = 'form-control' > > I have also attached the HTML

Re: For validation not working for UserCreationForm

2019-08-28 Thread 'Amitesh Sahay' via Django users
Hey Kean,  I am already working on some Djago user authentication . Below are my codes, may be they would help you. views.py from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login, logout from django.contrib import messages from django.contrib.auth.forms

For validation not working for UserCreationForm

2019-08-28 Thread Kean
Hi, New to Django. I've created a registration form which inherits from a User form. The issue is none of the validators are working. e.g reporting to user password miss-match, or any other error if user enters data incorrect to validation. The form simply validates with errors and red

Re: forms - switch off the validation

2019-07-29 Thread Aldian Fazrihady
You probably can extend the form class and override the is_valid method. Make the new is_valid to always return True. On Tue, Jul 30, 2019 at 11:42 AM Kai Kobschätzki wrote: > Heiho, > > I wrote a form in forms.py with some validation stuff, especially with > def clean_field(). All

forms - switch off the validation

2019-07-29 Thread Kai Kobschätzki
Heiho, I wrote a form in forms.py with some validation stuff, especially with def clean_field(). All fine. But in some usecases I would prefare to switch off at least some of the validation. For example it make no sense to check for a double id when I want to delete a reccord. Is it possible to

Re: New user question: Where to put non-form validation code?

2019-07-25 Thread Matt Zand
: > On 25/07/2019 1:03 pm, Jim Illback wrote: > > I had a slight variation on this thread - where to put some M2M field > > validation/deletion logic. > > > > I have a purely model-based form where a checkbox’s value determines > > whether another field (it’s a M2M fie

Re: New user question: Where to put non-form validation code?

2019-07-24 Thread Mike Dewhirst
On 25/07/2019 1:03 pm, Jim Illback wrote: I had a slight variation on this thread - where to put some M2M field validation/deletion logic. I have a purely model-based form where a checkbox’s value determines whether another field (it’s a M2M field) in the form should be NULL or keep its

Re: New user question: Where to put non-form validation code?

2019-07-24 Thread Mike Dewhirst
On 25/07/2019 1:03 pm, Jim Illback wrote: I had a slight variation on this thread - where to put some M2M field validation/deletion logic. I have a purely model-based form where a checkbox’s value determines whether another field (it’s a M2M field) in the form should be NULL or keep its

Re: New user question: Where to put non-form validation code?

2019-07-24 Thread Jim Illback
I had a slight variation on this thread - where to put some M2M field validation/deletion logic. I have a purely model-based form where a checkbox’s value determines whether another field (it’s a M2M field) in the form should be NULL or keep its values to be saved in the database. So

Re: New user question: Where to put non-form validation code?

2019-07-13 Thread Mike Dewhirst
Well yes it could be called multifaceted. Usually but not always the interface with the user is the form. You can have non-database fields as well as model fields so either way there has to be a full suite of validation functionality available in both types of forms. Luckily, model forms

RE: New user question: Where to put non-form validation code?

2019-07-13 Thread laya
Hi If I got your meaning Truly. It should be mentioned that as I know there is not any difference for using validation in model or View . Usually in model, we use regex for validation and in View it needs to use some methods for Email Validation and etc. Sent from Mail for Windows 10 From

Re: New user question: Where to put non-form validation code?

2019-07-13 Thread Dean Karres
n the Student model or CBV? Someplace else? Does it > matter? > > > I like to put that sort of stuff into model methods then add model.clean() > to call them and raise whatever error may be appropriate if they fail. > > > https://docs.djangoproject.com/en/2.1/topic

Re: New user question: Where to put non-form validation code?

2019-07-13 Thread Mike Dewhirst
fail. https://docs.djangoproject.com/en/2.1/topics/forms/modelforms/#interaction-with-model-validation and https://docs.djangoproject.com/en/2.1/ref/models/instances/#validating-objects and https://docs.djangoproject.com/en/2.1/ref/models/instances/#django.db.models.Model.clean You can rais

New user question: Where to put non-form validation code?

2019-07-13 Thread Dean Karres
Hi, I am learning Django. I am using CBVs. My default "index.py" view is basically a dashboard for the app I am playing with. As my models and views become more complicated I want to be able to ask, for any model instance, is this instance "valid" or "complete". Valid means that all Requir

Re: Single place for validation

2019-06-03 Thread Harsh Gundecha
yes i did the same, and got it working Thank you On Tuesday, May 28, 2019 at 1:56:06 AM UTC+5:30, Alexis wrote: > > Hi, > an approach that comes to mind would be defining validation in the model > and using model forms[1] for the user site. > > > HTH > > [1] https:

Re: Single place for validation

2019-05-27 Thread Alexis Roda
Hi, an approach that comes to mind would be defining validation in the model and using model forms[1] for the user site. HTH [1] https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/ Missatge de Harsh Gundecha del dia dl., 27 de maig 2019 a les 16:20: > hello, > i am cur

Re: Single place for validation

2019-05-27 Thread Chetan Ganji
Ganji +91-900-483-4183 ganji.che...@gmail.com http://ryucoder.in On Mon, May 27, 2019 at 7:50 PM Harsh Gundecha wrote: > hello, > i am currently learning django and i have query as following > is it that we have to put validators in both the model definition and > form validat

Single place for validation

2019-05-27 Thread Harsh Gundecha
hello, i am currently learning django and i have query as following is it that we have to put validators in both the model definition and form validation to apply validation to both admin and user site ? i tired on reusing a form class assuming that the validator there would apply on both user

Re: Django validation

2019-04-04 Thread אורי
Inti < intisank...@gmail.com> wrote: > Hi All, > > I working on Django validation, > > i have done some practice, > > I observed somethig plase let know if any misunderstadings, > > 1) When every datatype in models have default validators or worked, it is > w

Django validation

2019-04-04 Thread veera nagaraja sankar Inti
Hi All, I working on Django validation, i have done some practice, I observed somethig plase let know if any misunderstadings, 1) When every datatype in models have default validators or worked, it is worked on the form contains *is_valid()* or else ?.. 2)we can add the custom validations

Re: reg: How to use Django Password validation in my existing views?

2019-02-06 Thread Mike Dewhirst
On 6/02/2019 6:32 pm, Mike Dewhirst wrote: On 6/02/2019 5:15 pm, 'Amitesh Sahay' via Django users wrote: I have an existing django views.py where I have some password, username, and email validation logic applied. However, going forward I need to apply more advanced password valid

Re: reg: How to use Django Password validation in my existing views?

2019-02-05 Thread Mike Dewhirst
On 6/02/2019 5:15 pm, 'Amitesh Sahay' via Django users wrote: I have an existing django views.py where I have some password, username, and email validation logic applied. However, going forward I need to apply more advanced password validation. for e.g. password length limitation,

Re: reg: How to use Django Password validation in my existing views?

2019-02-05 Thread 'Amitesh Sahay' via Django users
ebruary, 2019, 11:48:21 am IST, 'Amitesh Sahay' via Django users wrote: I have an existing django views.py where I have some password, username, and email validation logic applied. However, going forward I need to apply more advanced password validation. for e.g. password lengt

Re: I want to remove username unique and its validation from django i tried but not working

2018-07-29 Thread Phako Perez
You want to update an unique field as null which is wrong, you aren’t able to insert update a field marked as unique instead you can remove the entire row, if you wanted to track all users on your table you can add 2 fields to the table, 1 for the update date and other for a flag which can tell

I want to remove username unique and its validation from django i tried but not working

2018-07-29 Thread lalitaquasoft
Getting this error :I have tried to change username nul but not working IntegrityError at /register/ UNIQUE constraint failed: superuser_user.username please help me on this issue . It will take too much time ` -- You received this message because you are subscribed to the Google Groups

Re: Invalid URLs passing validation by URLValidator

2018-06-27 Thread Tim Bell
On Friday, 22 June 2018 20:53:54 UTC+10, Jason wrote: > > Interesting find.. the only time I've used that kind of URL convention is > by connecting to redis with the python redis library. It also fits db url > connection strings too. > > What's the actual use case for the URL schema? > The us

Re: Invalid URLs passing validation by URLValidator

2018-06-27 Thread Tim Bell
Just picking up on a few points... On Friday, 22 June 2018 21:51:01 UTC+10, Melvyn Sopacua wrote: > > > However, officially, HTTP urls do not allow for username and password as > outlined in section 3.3: > > > > An HTTP URL takes the form: > > > http://:/? > > > where and are as des

Re: Invalid URLs passing validation by URLValidator

2018-06-22 Thread Melvyn Sopacua
On vrijdag 22 juni 2018 02:50:08 CEST Tim Bell wrote: > http://#FOO#/b...@example.com > > I believe that this is passing validation because "#FOO#/bar" is being > treated as a username, with "example.com" as the hostname. However, > "#FOO#/bar"

Re: Invalid URLs passing validation by URLValidator

2018-06-22 Thread Jason
Interesting find.. the only time I've used that kind of URL convention is by connecting to redis with the python redis library. It also fits db url connection strings too. What's the actual use case for the URL schema? You could also report this to the https://groups.google.com/forum/#!forum/

Invalid URLs passing validation by URLValidator

2018-06-21 Thread Tim Bell
Hi, I've come across some strings which I think aren't valid URLs that nevertheless pass validation by django.core.validators.URLValidator in Django 2.0.6 and 1.11.13. I know URL validation is very tricky, but these seemed to me that they should obviously fail. http://#FOO#/b...@e

Suggestions for using a custom pre-login signal to perform custom validation?

2018-03-16 Thread Stodge
ps to perform pre-login validation. from . import signals signals.user_logging_in.send(sender=None, request=request, user=user) # Perform the login using Django's code. real_login(request, user) We have a custom licencing engine that we call to in our custom login function to va

Re: Phone Number Validation

2018-03-16 Thread Carl Brubaker
Guilty as charged! Now that you mention "not", I remember seeing that in a tutorial. As for doing it again, I hate my job and don't have time or resources to quit and go to school, so I'm trying to learn on the fly. I hope to write a program to do my current job, because, so far, the ones I've

Re: Phone Number Validation

2018-03-15 Thread Bernd Wechner
; > I'm trying to make my own phone number form, and I'm having trouble with > number validation. > > Since international numbers can use "(40) (30)" I want to check that only > numbers were entered. I can't seem to make it work though. > > def c

Phone Number Validation

2018-03-15 Thread Carl Brubaker
I'm trying to make my own phone number form, and I'm having trouble with number validation. Since international numbers can use "(40) (30)" I want to check that only numbers were entered. I can't seem to make it work though. def clean_international(self):

Re: What validation tests are applied to ImageField?

2018-02-20 Thread mtnhiker
this thread and wants to know how it > ends... > > In this application I'm not using a form (uploadify is a flash-based > file sender) but I can still take advantage of the django.forms > validation routines by invoking ImageField without a form. This seems > to work:

Re: Need Help with Field Validation

2017-12-04 Thread Mark Phillips
ld('File name', > upload_to=unique_file_path) > computed_sha256 = models.CharField(editable=False, max_length=64) > . > > I am trying to validate the storage_file_name field in the Admin form. The > validation logic is as follows: > > If there is another D

Need Help with Field Validation

2017-12-03 Thread Mark Phillips
storage_file_name = models.FileField('File name', upload_to=unique_file_path) computed_sha256 = models.CharField(editable=False, max_length=64) . I am trying to validate the storage_file_name field in the Admin form. The validation logic is as follows: If there is another Document with

Re: Django: Form validation strange behaviour

2017-09-29 Thread Constantine Covtushenko
ul wrote: > I want to do file validation(size,type) on a field on inlineformset. > > > class ProductDocumentModelForm(ModelForm): > > class Meta: model = ProductDocument >fields = ['document'] > > def clean_document(self): >file = s

Django: Form validation strange behaviour

2017-09-29 Thread Paul
I want to do file validation(size,type) on a field on inlineformset. class ProductDocumentModelForm(ModelForm): class Meta: model = ProductDocument fields = ['document'] def clean_document(self): file = self.cleaned_data['document'] validate_

Re: Email validation in form

2017-09-13 Thread Melvyn Sopacua
First, make sure the field is rendered as an input tag with type "email". If it's not, your Django version is out of date or you're overriding the widget somewhere. Second, read this: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#Validation The standar

Re: Email validation in form

2017-09-13 Thread Moreplavec
Thanks. I made it as needed and wrote simple JS to call popup if there is an error to rise modal again after reload. Thanks! Dne úterý 12. září 2017 15:18:58 UTC+2 Daniel Roseman napsal(a): > > > On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: >> >> On Tuesday, 12 September 2

Re: Email validation in form

2017-09-12 Thread Moreplavec
I have {{ field.errors }} im my template. I changed model to not contain blank=True, but problem is still the same. Dne úterý 12. září 2017 15:18:58 UTC+2 Daniel Roseman napsal(a): > > > On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: >> >> On Tuesday, 12 September 2017 08:5

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 14:18:29 UTC+1, Daniel Roseman wrote: > > On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: >> >> >> >>> {% csrf_token %} >>> {{ form.non_field_errors }} >>> {% for hidden in form.hidden_fields %} >>>

Re: Email validation in form

2017-09-12 Thread Daniel Roseman
On Tuesday, 12 September 2017 08:52:37 UTC+1, Moreplavec wrote: > > > >> {% csrf_token %} >> {{ form.non_field_errors }} >> {% for hidden in form.hidden_fields %} >> {{ hidden }} >> {% endfor %} >>

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
hod == 'POST': >>>> form = OrderFormNew(request.POST) >>>> if form.is_valid(): >>>> form.date_changed = datetime.date.today() >>>> form.save() >>>> return ren

Re: Email validation in form

2017-09-12 Thread Moreplavec
t;> return render(request, 'courses/course_web.html', { >>> 'page': self, >>> 'form': form, >>> }) >>> else: >>> form = OrderFormNe

Re: Email validation in form

2017-09-12 Thread Vijay Khemlani
.fields["coursedate"].queryset = >> CourseDate.objects.filter(course=self.course).order_by('date_start') >> return render(request, 'courses/course_web.html', { >> 'page': self, >> 'form': fo

Email validation in form

2017-09-12 Thread Moreplavec
;date_start') > return render(request, 'courses/course_web.html', { > 'page': self, > 'form': form, > }) All fields work fine, but when i insert email, for example "asdf@asdf" form is taken away but not

Re: ModelForm validation of foreign keys - extra database queries and performance bottleneck

2017-07-25 Thread johan de taeye
code, here's my > analysis of what is happening: > >1. Open the admin editing screen for a single record. >I leave all fields to the original value, except for a field (not one >of the foreign key fields) >2. When saving the record, the first query reads the ex

Re: ModelForm validation of foreign keys - extra database queries and performance bottleneck

2017-07-25 Thread James Schneider
eld1, field2, field3, from mytable; 3. During the form/model validation, I get an extra database query for each of the foreign key fields. It is generated from the to_python method of django.forms.models. ModelChoiceField: select field_a, field_b, field_c, field, ... from relat

ModelForm validation of foreign keys - extra database queries and performance bottleneck

2017-07-24 Thread johan de taeye
form/model validation, I get an extra database query for each of the foreign key fields. It is generated from the to_python method of django.forms.models.ModelChoiceField: select field_a, field_b, field_c, field, ... from related_table where pk = 'id_from_first_query

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Hey man, if you have any problem, ALWAYS check the django documentation in the first place. IMO, its preaty extensive and complete, and always helped me through the 4~5 years I'm developing with django. After that, stackoverflow always help ( =P ). And if the things still goes badly, django-users

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread pieceofkayk2718
Hey thanks for that extra input. I'm currently a student at NMSU making an educational app for NASA'S Planetary Data Systems. Right now I'm the only student working on it and the only person in my building that knows Django (which I'm learning on the job). I'm making a blog alongside my app t

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Np man, always glad to help! Just to seal the case, that happened because django dont edit the migration files itself (well, not through the normal cycle of "makemigrations">"migrate"). You generated a migration with an invalid config, and didnt even mattered if you tried to correct that "default

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread pieceofkayk2718
Oh dude you are officially my hero! I didn't even think about the migration files. That totally worked. And thank you thank you thank you =D <3. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Just to clarify: Change the default value to "False"; Delete the migration file (0012_auto_20170630_1027); Run makemigrations; Run migrate. 2017-06-30 15:08 GMT-03:00 Guilherme Leal : > Have you re-ran the "makemigrations"? If that didnt work, delete the > migration file (0012_auto_20170630_1027

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
Have you re-ran the "makemigrations"? If that didnt work, delete the migration file (0012_auto_20170630_1027) and run "makemigrations" again. 2017-06-30 15:04 GMT-03:00 : > I also did the "If all else fails, reboot your computer" and still have > the same problem. Haha. I think I'm screwed. > >

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread pieceofkayk2718
I also did the "If all else fails, reboot your computer" and still have the same problem. Haha. I think I'm screwed. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an ema

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread pieceofkayk2718
Yes. At first I tried setting default=True or default=False for my BooleanField and kept getting the same error. So I went back in, deleted the model, tried again, got the same error. Then I deleted my db sqlite3 file, made new migrations, migrated (with the model not even a part of my model

Re: Database validation error - Even after manage.py flush.

2017-06-30 Thread Guilherme Leal
tring is not a valid boolean. Change the default value to False (as exemple), run the migration again, and it should work. 2017-06-30 14:23 GMT-03:00 : > So I made the ultimate error. I put a BooleanField in my models.py, when > I made migrations I set default col value to the empty str

Database validation error - Even after manage.py flush.

2017-06-30 Thread pieceofkayk2718
So I made the ultimate error. I put a BooleanField in my models.py, when I made migrations I set default col value to the empty string ''.. Then I migrated and got a validation error. However, I have tried to delete the model containing BooleanField, delete my database file, and

Re: Django phone number validation

2017-06-21 Thread Andréas Kühne
Hi, https://github.com/stefanfoulis/django-phonenumber-field You could probably use that library - it works against googles phonenumber library, which is the library that is used on andoid phones as well. Regards, Andréas 2017-06-21 8:18 GMT+02:00 Santosh Yelamarthi : > Hi All, > > Can anyone

Django phone number validation

2017-06-20 Thread Santosh Yelamarthi
Hi All, Can anyone please share how to validate phone number in django. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubsc

Re: validation of admin form with inlines

2017-02-05 Thread ludovic coues
I would hide or make the amount field read-only and set it with a pre_save signals. This way, you don't have to worry about it and you get the right value every time instead of getting an error every now and then. 2017-02-04 16:32 GMT+01:00 Roberto Russi : > I need to validate a form in the admin

validation of admin form with inlines

2017-02-04 Thread Roberto Russi
I need to validate a form in the admin area checking if the SUM of 'price' field in inlines match whit 'amount' field in the main form. What is best way? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and sto

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Chris Kavanagh
>>> If you submit the form with incorrect information (non unique email) >>> then your view does not return anything because form.is_valid() returns >>> False >>> >>> Validation errors don't prevent the form from being submitted, they >>

  1   2   3   4   5   6   7   8   9   10   >