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: New user question: Where to put non-form validation code?

2019-07-25 Thread Matt Zand
Hi everyone, Does anyone know how to post blog at below page: https://www.djangoproject.com/community/blogs/ I am really frustrated as I submitted last week but nothing is there. Who is in charge of blog posts on Django site? Thx, Matt On Thu, Jul 25, 2019 at 12:38 AM Mike Dewhirst wrote: >

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 value

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 value

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

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 auto

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

2019-07-13 Thread laya
: Dean Karres Sent: Saturday, July 13, 2019 5:40 PM To: Django users Subject: New user question: Where to put non-form validation code? 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 b

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

2019-07-13 Thread Dean Karres
Thank you. There are way more parts to this than I would have imagined. On Sat, Jul 13, 2019, 8:01 PM Mike Dewhirst wrote: > On 14/07/2019 10:37 am, Dean Karres wrote: > > Hi, > > I am learning Django. I am using CBVs. My default "index.py" view is > basically a dashboard for the app I am pl

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

2019-07-13 Thread Mike Dewhirst
On 14/07/2019 10:37 am, Dean Karres wrote: 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"

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: Django: Form validation strange behaviour

2017-09-29 Thread Constantine Covtushenko
Hi Paul, You should return value from 'clean_document'. >From your code I see you do not do that. When method returns nothing it is None. That is why you see 'This field cannot be blank.' I hope that make sense. Regards, Constantine C. On Fri, Sep 29, 2017 at 7:01 AM, Paul wrote: > I want to

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_file(file, 'document') Becau

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Chris Kavanagh
I got it working Vijay! Thank you so much for your help, and have a great Christmas!! On Thursday, December 22, 2016 at 9:55:05 PM UTC-5, Vijay Khemlani wrote: > > if the form is not valid then form.errors should contain human-readable > errors for each field, including the one you validate you

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Vijay Khemlani
if the form is not valid then form.errors should contain human-readable errors for each field, including the one you validate yourself (the string inside the raise ValidationError call), you can return that. On Thu, Dec 22, 2016 at 11:49 PM, Chris Kavanagh wrote: > Yeah, I was wrong Vijay. For s

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Chris Kavanagh
Yeah, I was wrong Vijay. For some odd reason I thought the ValidationError would catch it BEFORE submitted. . . I re-read the docs and saw I was wrong. . In other words, I I try to submit the form with the input field empty, I get a small pop up error saying "Please Enter An Email". Or, if I u

Re: Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Vijay Khemlani
I'm not following 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 prevent the form from validation (making form.is_valid() return

Form Validation Error NOT Raised When Form Is Submitted

2016-12-22 Thread Chris Kavanagh
I have a model form called *"ContactForm" *that has an email field. I created a custom* forms.ValidationError* in *"clean_email"* method which checks to see if the email is already in the database , however it's never raised on submit. When submit is called, the view runs and I get the error

Re: Possible bug with UploadedFile and form validation?

2016-06-13 Thread Simon Charette
Hi Nick, `io.TextIOWrapper` objects close their wrapped file when they are garbage collected (e.g. `__del__()`). This is similar to how `File` objects close their underlying file descriptor when collected. In the case of your `clean()` method the `file` object can be garbaged collected as soon

Possible bug with UploadedFile and form validation?

2016-06-13 Thread Nick Sarbicki
I've got an odd bug in my system, and while I'm not 100% convinced it is a Django bug, I don't think it is due to me either so thought I'd ask here for some clarification. Essentially if you upload a file to a form. If that forms clean() method reads that file (in my case it gathers data and ma

Re: Weird form validation question

2014-10-09 Thread Sergiy Khohlov
could you please paste code in form valid block ? Many thanks, Serge +380 636150445 skype: skhohlov On Thu, Oct 9, 2014 at 11:23 AM, termopro wrote: > I am using form.is_valid() > > On Thursday, October 9, 2014 10:54:56 AM UTC+3, Sergiy Khohlov wrote: >> >> Are you using form_valid method i

Re: Weird form validation question

2014-10-09 Thread termopro
I am using form.is_valid() On Thursday, October 9, 2014 10:54:56 AM UTC+3, Sergiy Khohlov wrote: > > Are you using form_valid method in view ? > > Many thanks, > > Serge > > > +380 636150445 > skype: skhohlov > > On Thu, Oct 9, 2014 at 10:10 AM, termopro > > wrote: > >> Hi, >> >> I am building a

Re: Weird form validation question

2014-10-09 Thread Sergiy Khohlov
Are you using form_valid method in view ? Many thanks, Serge +380 636150445 skype: skhohlov On Thu, Oct 9, 2014 at 10:10 AM, termopro wrote: > Hi, > > I am building a user registration page. Page has a form where user can > select his current state and city. > > The problem with that is that

Weird form validation question

2014-10-09 Thread termopro
Hi, I am building a user registration page. Page has a form where user can select his current state and city. The problem with that is that i cannot load list of cities into the form when the page is being generated. That's because i show the user only cities from his state, not all of them. S

error after form validation

2014-01-16 Thread fabricio
I got the following error My model http://pastebin.com/2BuE0N0d my view http://pastebin.com/48xEPvQz when it reaches this part of the code gr_caixafaccao = form_caixafaccao.save (commit = False) gr_caixafaccao the object returns me Unable to get repr is hence not caught t

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Mike Dewhirst
On 1/09/2013 2:11am, Gerd Koetje wrote: to explain myself a bit more: gerd12 = should be valid gerd1234 = should be valid gerd 1234 = should not be valid %$$%%#$ = should not be valid gerd123456 - should not be valid You have just specified five cases for unit tests. Start there and experim

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
i gues im learning it the hard way atm. Just wanna convert my php application to python, but its hard when i miss out on some basic stuff. giving me headpains haha :D -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this grou

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
yeah i really should do more python learning. and i will do :D -- 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+unsubscr...@googlegroups.com. To post

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
stupid me, its almost like php if testdata == False: > fixed it Thanks alot for your help all. Appreciated -- 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

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Thomas Orozco
test(data) returns True if the string is acceptable, and False if it's not. But False is an object, it's not the the string "False" - I'd strongly recommend you start with a Python tutorial before moving on to your Django project. Cheers; On Sat, Aug 31, 2013 at 7:27 PM, Gerd Koetje wrote: > t

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
think i fixed the true/false thing, return True was on the wrong indent it still doesnt trow the error , so i gues my if testdata us False: is wrong? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop rece

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Thomas Orozco
Because the indentation is not correct, and doesn't correspond to what I sent you. `return True` should be 4 chars left of where it currently is. On Sat, Aug 31, 2013 at 7:23 PM, Gerd Koetje wrote: > it somehow keeps returning True on everything > > accepted = string.letters + string.digits > m

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
it somehow keeps returning True on everything accepted = string.letters + string.digits max_numbers = 4 def test(word): numbers = 0 for c in word: if c.isdigit(): numbers += 1 if not c in accepted or numbers > max_numbers: return False retur

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
like this? import string accepted = string.letters + string.digits max_numbers = 4 def test(word): numbers = 0 for c in word: if c.isdigit(): numbers += 1 if not c in accepted or numbers > max_numbers: return False return True # Create prof

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Thomas Orozco
Oh, I thought you needed only 4 total chars. Using a regex probably is a bit overkill here: >>> import string >>> accepted = string.letters + string.digits >>> max_numbers = 4 >>> >>> def test(word): ... numbers = 0 ... for c in word: ... if c.isdigit(): ... numbers +

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
im working with this code in my forms.py btw. I see some guys do it in models.py instead -- 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+unsubscr...

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
to explain myself a bit more: gerd12 = should be valid gerd1234 = should be valid gerd 1234 = should not be valid %$$%%#$ = should not be valid gerd123456 - should not be valid etc etc -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsub

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
> > same result still can input spaces weird chars and more then 4 numbers > -- 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+unsubscr...@googlegrou

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Thomas Orozco
Oh, yes, we need to search for the end of the string: r'^[a-zA-Z0-9]{1,4}$' On Sat, Aug 31, 2013 at 6:03 PM, Gerd Koetje wrote: > that still allows space,weird chars and more then 4 numbers > > input: > dfdfdf565665&^^^ > got saved > > > > def clean_

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
that still allows space,weird chars and more then 4 numbers input: dfdfdf565665&^^^ got saved def clean_profielnaam(self): data = self.cleaned_data['profielnaam'] if not re.match(r'^[a-zA-Z0-9]{1,4}', data): raise forms.V

Re: Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Thomas Orozco
Change you regex to: r'^[a-zA-Z0-9]{1,4}' On Sat, Aug 31, 2013 at 5:41 PM, Gerd Koetje wrote: > Hi all, > > How do i valididate for this? > > - numbers and text only , no spaces > - max 4 number > > > > > def clean_profielnaam(self): > data = self.cleaned_data['profielnaam'] >

Form validation number and text only no space mac 4 numbers

2013-08-31 Thread Gerd Koetje
Hi all, How do i valididate for this? - numbers and text only , no spaces - max 4 number def clean_profielnaam(self): data = self.cleaned_data['profielnaam'] if not re.match(r'^[a-z][0-9]+', data): raise forms.ValidationError("Je mag alleen tekst en cijfers ge

Re: Form validation vs. DRY

2013-07-03 Thread Roman Klesel
2013/7/3 Tomas Ehrlich : > you can use model validation > https://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects This sounds very good! :-) Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from t

Re: Form validation vs. DRY

2013-07-03 Thread Tomas Ehrlich
Hi Roman, you can use model validation https://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects It works similar to form validation. After, when you create ModelForm, it will take validation rules from model. All these validations should be called outside save() Cheers

Form validation vs. DRY

2013-07-03 Thread Roman Klesel
e.g.: unique constraint on a database column. Now, when I write my form validation, I have to implement the same logic again, since form validation takes place before a save() is even considered. Like this: >>> if form.is_valid(): >>>form.save() Is there a better way to do it?

Re: form validation

2013-05-11 Thread Roberto López López
Problem solved with BaseInlineFormSet.clean() :-) On 05/11/2013 06:56 PM, Roberto López López wrote: > > Hi everyone, > > I need to do some validation in my model. So far, I have been able to > validate normal forms, but I want to validate forms with an inline, to > ensure that at least one of

form validation

2013-05-11 Thread Roberto López López
Hi everyone, I need to do some validation in my model. So far, I have been able to validate normal forms, but I want to validate forms with an inline, to ensure that at least one of those inlines match the requirement. My code: class PDMAdminForm(ModelForm): class Meta:

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Branko Majic
On Fri, 3 May 2013 15:31:05 +0100 Darren Mansell wrote: > I had rsync'd the code onto the live server from /home/django/rfc/ > into /home/django/rfc/rfc. As it's inside the pythonpath, the code is > still valid and will be executed, especially when you have various > stuff in the same dir names a

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Solved. To anyone who may come across this very obscure issue for themselves, it's entirely an error specific to my setup. I had rsync'd the code onto the live server from /home/django/rfc/ into /home/django/rfc/rfc. As it's inside the pythonpath, the code is still valid and will be executed, esp

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
On 3 May 2013 13:06, Tom Evans wrote: > On Fri, May 3, 2013 at 12:38 PM, Darren Mansell > wrote: > > > > Another bit of info, just in case anyone is currently looking at this.. > > > > The error is coming from > > > /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py > > >

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 12:38 PM, Darren Mansell wrote: > > Another bit of info, just in case anyone is currently looking at this.. > > The error is coming from > /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py > > … > > So it's failing validation because it's seeing the

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Another bit of info, just in case anyone is currently looking at this.. The error is coming from /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py class BooleanField(Field): empty_strings_allowed = False default_error_messages = { *'invalid': _("'%s' value

Re: Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Bit more info (all pointing to the same database / db server): test server with Django dev server : works test server with Apache 2.2.22-6ubuntu5 / mod-wsgi 3.4-0ubuntu3 : works live server with Django dev server : works live server with Apache 2.2.22-1ubuntu1.3 / mod-wsgi 3.3-4build1 : doesn't w

Form Validation Error: 'No' value must be either True or False.

2013-05-03 Thread Darren Mansell
Hi all. Really really confused by this one. Can someone show me where I'm being stupid please? Standard Django 1.5.1 app with MySQL. Trying to save to a VARCHAR(3) column with a forms.CharField form field and a models.CharField model field. When I try to save the form I get this validation error:

Re: ignore field during form validation

2013-01-23 Thread Sarfraz ahmad
def clean_A6M1F6_F(self): data=self.cleaned_data['A6M1F6_F'] if A6M1_mobile.objects.filter(A6M1F6=data).exists(): raise forms.ValidationError(" already exixts") return data i have this clean_field method in the form and given field is not updatable... whenev

Re: ignore field during form validation

2013-01-22 Thread Sarfraz ahmad
gusy i have form which has 5 fields i have defined a clean_field method which doesn't allow a duplicate entry in the database. bt when i tried to update the model instance while calling form.is_valid() method it calls the clean_field() method and returns error that entry already exists. O

Re: ignore field during form validation

2013-01-21 Thread Mario Gudelj
Add required=False to the form field and it won't be validated. On 22 Jan, 2013 2:30 AM, "Jonathan D. Baker" wrote: > Hi Sarfraz, > > If your form class inherits from ModelForm, you can use a subset of fields > within your form per the following documentation: > https://docs.djangoproject.com/en

Re: ignore field during form validation

2013-01-21 Thread Jonathan D. Baker
Hi Sarfraz, If your form class inherits from ModelForm, you can use a subset of fields within your form per the following documentation: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form If you're not inheriting from ModelForm, then it's a matter

Re: ignore field during form validation

2013-01-21 Thread Sarfraz ahmad
Hello everyone, i m facing a problem while validating django form. i have 5 form fields in a form and in the view i want to validate only three form fields which i need to update .. tell me a solution if anyone have any -- You received this message because

RE: Form validation

2013-01-12 Thread Babatunde Akinyanmi
s.com Subject: Re: Form validation More details on the form and why there is a field that depends on 6 pages: In steps 2-5, I am prompting the user for questions and choices about a particular service. On page 6 they are given the opportunity to select a date/time for the service. The validation

Re: Form validation

2013-01-11 Thread Kristofer
27;m not sure where else I can access the required form steps and also be able to raise a validation error. - Original Message - From: "Babatunde Akinyanmi" To: "Kristofer" , django-users@googlegroups.com Sent: Friday, January 11, 2013 8:05:59 AM Subject: RE

RE: Form validation

2013-01-11 Thread Babatunde Akinyanmi
m pages only to be told I can't continue because of something I did 4 pages ago. Sent from my Windows Phone -- From: Kristofer Sent: 1/11/2013 8:00 AM To: django-users@googlegroups.com Subject: Form validation Hello, I am using FormWizard with a 12-step form.

Re: Form validation

2013-01-11 Thread iñigo medina
Iñigo > > I cannot figure out how to get data from the previous steps in the form validation for step 6. > > Where is a point in the FormWizard where I can access previous form data and can also raise ValidationError on a field? > > Thanks, > > -- > You received this me

Form validation

2013-01-10 Thread Kristofer
Hello, I am using FormWizard with a 12-step form. On step 6, I want to perform verification on a field but it depends on fields that were entered in steps 2-5. I cannot figure out how to get data from the previous steps in the form validation for step 6. Where is a point in the

Re: After form validation, need to post and call a perl program to display to a log file

2012-08-26 Thread Pervez Mulla
Hey Nick, Thank you for mail, Can I make use CGI script for this...? If yes how can I make use of that..? Hint>>!!\ Thank you pervez On Fri, Aug 24, 2012 at 8:30 PM, Nick Santos wrote: > Obligatory followup (though the docs I believe cover this pretty well) - > be *very* careful

Re: After form validation, need to post and call a perl program to display to a log file

2012-08-24 Thread Nick Santos
Obligatory followup (though the docs I believe cover this pretty well) - be *very* careful calling subprocess with anything related to a form submission. Read the documents that Melvyn linked to carefully because you can be opening a massive security hole. If this is just temporary to check som

Re: After form validation, need to post and call a perl program to display to a log file

2012-08-24 Thread Melvyn Sopacua
On 24-8-2012 8:41, Pervez Mulla wrote: > Once validation happened (its working good), I wanna call perl script to > disply it content to lof file ... > > > How can I do this ..?? FYI, it don't matter that it's perl, you can do this for anythi

After form validation, need to post and call a perl program to display to a log file

2012-08-23 Thread Pervez Mulla
Hi, I have written code for form validation for different filed . Once validation happened (its working good), I wanna call perl script to disply it content to lof file ... How can I do this ..?? Please help me Pervez -- You received this message because you are subscribed to the Google

Re: Form validation using model data?

2012-07-31 Thread Kurtis Mullins
anges. >>> >>> I'm thinking about making the url (form) field readonly but in html the >>> field becomes still an input field (just with readonly="True"), so i have >>> doubts whether hackers will be able to post a changed value anyhow (i'll >

Re: Form validation using model data?

2012-07-30 Thread Paul
7;m thinking about making the url (form) field readonly but in html the >> field becomes still an input field (just with readonly="True"), so i have >> doubts whether hackers will be able to post a changed value anyhow (i'll >> need to test this). >> >

Re: Form validation using model data?

2012-07-29 Thread Kurtis Mullins
gt; doubts whether hackers will be able to post a changed value anyhow (i'll > need to test this). > > Another approach is to add some custom form validation against the > (current) model, but i have doubts whether validation is the solution for > this? > > Thanks for any

Form validation using model data?

2012-07-29 Thread Paul
ld becomes still an input field (just with readonly="True"), so i have doubts whether hackers will be able to post a changed value anyhow (i'll need to test this). Another approach is to add some custom form validation against the (current) model, but i have doubts whether valid

Re: ignore field during form validation

2012-07-27 Thread Karen Tracey
On Thu, Jul 26, 2012 at 11:14 AM, Zoltan Szalai wrote: > Hi all, > > Let's assume i have to the following simple form: > > > class Form(forms.Form): > > check = forms.BooleanField( > required=False, > ) > # take into account only when 'check' is True > len = forms.IntegerFi

Re: ignore field during form validation

2012-07-26 Thread Zoltan Szalai
In the end I came up with a solution which seems a bit hacky but does exactly what I want. It looks like this: def clean(self): cleaned_data = super(Form, self).clean() check = cleaned_data.get("check", None) # ignore 'len' when 'check' is False if not checkand "len" in self._errors:

Re: ignore field during form validation

2012-07-26 Thread Kurtis Mullins
You could remove "required=True" from 'len' and override clean() to perform a multiple-field validation. (pretty much what Thomas mentioned) len() will execute -- it will check to see if it's an integer. If you just want to completely ignore it, then do exactly as Thomas said, override. But you'll

Re: ignore field during form validation

2012-07-26 Thread Zoltan Szalai
On 2012.07.26. 17:44, Tomas Neme wrote: class Form(forms.Form): check = forms.BooleanField( required=False, ) # take into account only when 'check' is True len = forms.IntegerField( min_value=3, max_value=5, required=True, ) What I w

Re: ignore field during form validation

2012-07-26 Thread Tomas Neme
> class Form(forms.Form): > > check = forms.BooleanField( > required=False, > ) > # take into account only when 'check' is True > len = forms.IntegerField( > min_value=3, > max_value=5, > required=True, > ) > > > What I want is to validate the 'le

ignore field during form validation

2012-07-26 Thread Zoltan Szalai
Hi all, Let's assume i have to the following simple form: class Form(forms.Form): check = forms.BooleanField( required=False, ) # take into account only when 'check' is True len = forms.IntegerField( min_value=3, max_value=5, required=True, )

Incorrect post URL on failed form validation

2012-07-13 Thread Kevin
I'm new to Django so hopefully this will be trivial to solve. I have a table of data I display in a view along with a simple form to add a new row of data to the table: def my_data_view(request, data_id): myData = MyData.objects.get(pk=data_id) if request.method == 'POST': myForm

How to do form validation for inline formsets?

2012-04-18 Thread Derek
extra=9, can_delete=False) if request.method == 'POST': ... else: formset = UploadFieldFormSet(instance=upload) Approach No. 2 - Form validation # form file class UploadFieldFormSet(BaseFormSet): def clean(self): if any(self.errors)

Re: Form Validation

2012-04-15 Thread Daniel Roseman
On Sunday, 15 April 2012 10:22:43 UTC+1, coded kid wrote: > > > def my_memb(request): > if request.method=="POST": > form=MembForm(request.POST) > if form.is_valid(): > data=form.cleaned_data > form.save()

Form Validation

2012-04-15 Thread coded kid
I want my form to validate the fields so that only users who fill the form field should be redirected to the next page. If a user fails to fill any of the form field, the user should be taken to the same page where it will output validation error so that the user can fill the fields. I tried writi

Re: Form Validation and unique_together on update a model

2012-04-13 Thread Massimo Barbierato
Thanks Tom, you're right!!! I solved it passing 'edit' again. Thanks again Max (I'm speculating a little) > > In your code snippet, lines 36-38: > > sale = None > if 'edit' in request.GET: > sale = Sales.objects.get(sale_id=request.GET['edit']) > > When you submit the form again

Re: Form Validation and unique_together on update a model

2012-04-13 Thread Tom Evans
On Fri, Apr 13, 2012 at 1:08 PM, Massimo Barbierato wrote: > Hi all, i'm new. I searched  in the group for answers to my problem, but i > didn't find anything :( > > My problem is this: > > i have a model with two fields in unique_together, the related ModelForm and > the view. > When i pass an in

Form Validation and unique_together on update a model

2012-04-13 Thread Massimo Barbierato
Hi all, i'm new. I searched in the group for answers to my problem, but i didn't find anything :( My problem is this: i have a model with two fields in unique_together, the related ModelForm and the view. When i pass an instance of my model to the form to update it and then save it, i receive

help with form validation

2012-03-13 Thread Sergiy Khohlov
Hello, I would like to ask question about form error handling. Main target is decreasing count of the code in the template. Of course it is possible to display all form in template such as : {{ form.as_table }} In this case possible to set some widget in form and make a template code is simple.

Form validation with ImageFields

2011-10-03 Thread David
Hello I need to upload an image through a form. I also need to have the ability to use the "clear" checkbox built into the imagefield widget to have the image reference in the database removed. Images should also be checked for filetype, dimensions and rejected if appropriate. So I did this:

Re: Django form validation.. does anyone else find it awkward??

2011-07-13 Thread Matteius
""" Devs: ALWAYS call model.full_clean() OR form.is_valid() to protect Database from radical or duplicate DB entries! * Calling model.full_clean() OR form.is_valid() calls 3 underlying methods (clean, clean_fields, validate_unique) """ I haven't had to

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Andre Terra
On Tue, Jul 12, 2011 at 2:25 PM, Venkatraman S wrote: > > > On Tue, Jul 12, 2011 at 9:12 PM, Andre Terra wrote: > >> May I ask if you are managing to do this (and, if so, how) without >>> writing duplicate logic? >>> >> >> This, to me, is a key area for improvement. Aside from the development >>

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Venkatraman S
On Tue, Jul 12, 2011 at 9:12 PM, Andre Terra wrote: > May I ask if you are managing to do this (and, if so, how) without >> writing duplicate logic? >> > > This, to me, is a key area for improvement. Aside from the development > challenge the idea imposes, an extra issue with writing DRY validati

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Cal Leeming [Simplicity Media Ltd]
hich works seamlessly with Django form validation, but it is an absolute PITA. Cal On Tue, Jul 12, 2011 at 4:42 PM, Andre Terra wrote: > May I ask if you are managing to do this (and, if so, how) without >> writing duplicate logic? >> > > This, to me, is a key area for improvem

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Andre Terra
your app. I tried using it once and soon enough I was writing so much custom code that I decided to drop uni-form altogether. The issue of form validation being complex has also been discussed on django-developers, and I don't mind to be rude, but this kind of "wouldn't it be

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Derek
On Jul 12, 10:15 am, Venkatraman S wrote: > On Tue, Jul 12, 2011 at 1:23 PM, Cal Leeming [Simplicity Media Ltd] < > > > cal.leem...@simplicitymedialtd.co.uk> wrote: > > On 12 Jul 2011 08:13, "bruno desthuilliers" > > wrote: > > > > On Jul 12, 3:37 am, Venkatraman S wrote: > > > > > On the valid

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Venkatraman S
On Tue, Jul 12, 2011 at 1:23 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > On 12 Jul 2011 08:13, "bruno desthuilliers" > wrote: > > > > On Jul 12, 3:37 am, Venkatraman S wrote: > > > > > > On the validation, yes, it is a little pesky. But, offlate, i am

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread Cal Leeming [Simplicity Media Ltd]
On 12 Jul 2011 08:13, "bruno desthuilliers" wrote: > > On Jul 12, 3:37 am, Venkatraman S wrote: > > > > On the validation, yes, it is a little pesky. But, offlate, i am trying to > > *understand* it better and trying to move the logic > > to the client. For eg. jquery-validate does bulk of the st

Re: Django form validation.. does anyone else find it awkward??

2011-07-12 Thread bruno desthuilliers
On Jul 12, 3:37 am, Venkatraman S wrote: > > On the validation, yes, it is a little pesky. But, offlate, i am trying to > *understand* it better and trying to move the logic > to the client. For eg. jquery-validate does bulk of the stuff on client side > - atleast for required fields. So, moving >

Re: Django form validation.. does anyone else find it awkward??

2011-07-11 Thread Venkatraman S
On Tue, Jul 12, 2011 at 4:26 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Does anyone else find working with form validation in Django to be a bit > awkward and/or tedious? > > I can't say exactly why I don't like it, because

Django form validation.. does anyone else find it awkward??

2011-07-11 Thread Cal Leeming [Simplicity Media Ltd]
Does anyone else find working with form validation in Django to be a bit awkward and/or tedious? I can't say exactly why I don't like it, because I don't really know myself, I just always disliked working with it. Am I being a fussy little fuzz ball, or does anyone else have

Re: Possible bug in form validation

2011-06-21 Thread Shawn Milochik
On 06/21/2011 12:17 AM, Ian Clelland wrote: On Mon, Jun 20, 2011 at 1:49 PM, Shawn Milochik > wrote: I know that, whenever someone finds a "bug" in Django they're usually doing something incorrectly. Hopefully someone will point out what I need to do to mak

Re: Possible bug in form validation

2011-06-20 Thread Ian Clelland
On Mon, Jun 20, 2011 at 1:49 PM, Shawn Milochik wrote: > I know that, whenever someone finds a "bug" in Django they're usually doing > something incorrectly. Hopefully someone will point out what I need to do to > make this work. > I don't know if it's considered 'correct' or not, but the max_va

Possible bug in form validation

2011-06-20 Thread Shawn Milochik
I know that, whenever someone finds a "bug" in Django they're usually doing something incorrectly. Hopefully someone will point out what I need to do to make this work. However, this is looking like a legitimate bug to me. http://dpaste.com/hold/556603/ Environment: Django: (1, 3, 0, 'fin

  1   2   3   4   >