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

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

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

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

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

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

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

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

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

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

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 =

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

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

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

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

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

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

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

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 =

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"

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,

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

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 >

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,

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

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

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'

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

RE: Form validation

2013-01-12 Thread Babatunde Akinyanmi
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
ary 11, 2013 8:05:59 AM Subject: RE: Form validation Hi, You can use the wizard's get_cleaned_data_for_step(step) method where step is 0-indexed so step 2 form data would be: get_cleaned_data_for_step('1'). It would return a dictionary of the cleaned data for that step. Ignorable comment:

RE: Form validation

2013-01-11 Thread Babatunde Akinyanmi
Hi, You can use the wizard's get_cleaned_data_for_step(step) method where step is 0-indexed so step 2 form data would be: get_cleaned_data_for_step('1'). It would return a dictionary of the cleaned data for that step. Ignorable comment: I would be very pissed if I had to fill 6 form pages only to

Re: Form validation

2013-01-11 Thread iñigo medina
El 11/01/2013 08:00, "Kristofer" escribió: > > > On step 6, I want to perform verification on a field but it depends on fields that were entered in steps 2-5. Do you save such data anywhere (database, session...)? You might get from this source and use as you need.

Re: Form validation using model data?

2012-07-31 Thread Kurtis Mullins
ahh okay, then I simply create two model forms. class CreateURLForm(ModelForm): class Meta: fields = ('url', 'name') # This will restrict the user to only modifying this data model = URLModel # Or whatever your model is called class UpdateURLForm(ModelForm): class Meta:

Re: Form validation using model data?

2012-07-30 Thread Paul
That would be an option as well indeed. In fact i have 1 (base)-form for the model that i subclass for create, read and update operations. The difference is that create and update have a submit button, read doesn't, and in the read view, the fields are read-only. The website becomes

Re: Form validation using model data?

2012-07-29 Thread Kurtis Mullins
Just to get some more information about the problem; Do you allow your users to initially insert the Name+URL? When does this become "authenticated"? Maybe you could have two forms. One that allows users to add new Name+URL Objects (not sure what your object/Model is called) and another to allow

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

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

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 >

Re: Form Validation - Redisplay With Error

2011-05-27 Thread Robin
Thanks, Derek! Wikipedia makes good sense. On May 27, 1:14 am, Derek wrote: > On May 26, 1:07 am, Robin wrote:> I'm very > comfortable with SQL and more traditional programming.  Would > > you recommend some specific HTTP primer, or anything  else

Re: Form Validation - Redisplay With Error

2011-05-27 Thread Derek
On May 26, 1:07 am, Robin wrote: > I'm very comfortable with SQL and more traditional programming.  Would > you recommend some specific HTTP primer, or anything  else for those > making the transition to web dev? > Assuming good faith in the wisdom of the crowd... :

Re: Form validation

2011-05-26 Thread Daniel Roseman
On Thursday, May 26, 2011 4:50:17 PM UTC+1, Nikhil Somaru wrote: > > Apologies for the font. > > Would you guys mind elaborating how I would re-display the form, with the > validation errors? I am trying to follow the print version of the > Djangobook, and it's been brilliant up to this point.

Re: Form validation

2011-05-26 Thread Nikhil Somaru
Apologies for the font. Would you guys mind elaborating how I would re-display the form, with the validation errors? I am trying to follow the print version of the Djangobook, and it's been brilliant up to this point. There's nothing mentioned in the template about errors. On Thu, May 26, 2011

Re: Form validation

2011-05-26 Thread Daniel Roseman
On Thursday, May 26, 2011 11:18:39 AM UTC+1, Nikhil Somaru wrote: > > Hi all, > > I am testing the form validation. When I try and submit an empty form, I > get: > > ValueError at /contact/ > > The view djangobook.contact.views.contact didn't return an HttpResponse > object. > > > #

Re: Form validation

2011-05-26 Thread Lucian Nicolescu
>From what I see and if the you pasted correct indentations I think the "render_to_response" instruction should be outside the "else" statement (in the view code). Lucian On Thu, May 26, 2011 at 1:18 PM, Nikhil Somaru wrote: > Hi all, > > I am testing the form validation.

Re: Form Validation - Redisplay With Error

2011-05-25 Thread Robin
I'm very comfortable with SQL and more traditional programming. Would you recommend some specific HTTP primer, or anything else for those making the transition to web dev? On May 25, 8:24 am, bruno desthuilliers wrote: > On May 25, 3:54 pm, Robin

Re: Form Validation - Redisplay With Error

2011-05-25 Thread bruno desthuilliers
On May 25, 3:54 pm, Robin wrote: > Because that would be too easy? ;) Well... >  Sincere thanks, Bruno.  A lot of > this is new to me...python, Django, web dev, and even open source. > Didn't even think of that! Surprisingly enough, it took me a couple weeks realizing I

Re: Form Validation - Redisplay With Error

2011-05-25 Thread Ndungi Kyalo
sorry, i'll repost under the appropriate subject. On 25 May 2011 17:11, Ndungi Kyalo wrote: > Am trying to pre-select a radio button created with the django.forms library > : >     vote = forms.ChoiceField( >         widget = forms.RadioSelect(), >         choices = [ >         

Re: Form Validation - Redisplay With Error

2011-05-25 Thread Ndungi Kyalo
Am trying to pre-select a radio button created with the django.forms library : vote = forms.ChoiceField( widget = forms.RadioSelect(), choices = [ ['a', 'i liked it'], ['b', 'i did not like it'] ], required=True ) How would I go

Re: Form Validation - Redisplay With Error

2011-05-25 Thread Robin
Because that would be too easy? ;) Sincere thanks, Bruno. A lot of this is new to me...python, Django, web dev, and even open source. Didn't even think of that! There's so much to learn, it can be overwhelming. Thank you again, I'll have a look through the code today. On May 25, 1:02 am,

Re: Form Validation - Redisplay With Error

2011-05-25 Thread bruno desthuilliers
On May 25, 4:48 am, Robin wrote: > I've tried to track down this information (new to Django and web dev) > and I'm certainly not expecting a spoon-fed answer.  A nudge in the > right direction would be most appreciated. :) Why don't you just have a look at the code of the

Re: Form Validation - Redisplay With Error

2011-05-24 Thread Robin
Apologies...it seems I misunderstood clean_message(). It's not a method, but clean_* is something for each field. I'll continue my research, but would still love to hear from you all about custom login forms and how you handle them. On May 24, 8:48 pm, Robin wrote: > I'm

Re: form validation for empty checkboxes that are not required (and they are the only fields present)

2010-09-28 Thread Skylar Saveland
class Asset(models.Model): languages = models.ManyToManyField('account.Language', null=True, blank=True) class AssetLanguageForm(forms.ModelForm): languages = forms.ModelMultipleChoiceField( queryset=Language.objects.all(), required=False,

Re: form validation for empty checkboxes that are not required (and they are the only fields present)

2010-09-28 Thread Brian Neal
On Sep 27, 11:35 am, Skylar Saveland wrote: > I have some modelforms within a .  Each form has one > checkboxselectmultiple that is not required.  If I post nothing (all > checkboxes are empty) then all of the forms are invalid.  If I post > anything then all of the

Re: Form Validation

2010-07-30 Thread Daniel Roseman
On Jul 30, 4:49 pm, rupert wrote: > Here's the view template: > > def respondant(request): > >         user = request.user > >         if set(RESPONDANT_FIELDS).issubset(set([key for key,value in > request.POST.items()])): >                 form =

Re: Form Validation

2010-07-30 Thread rupert
Here's the view template: def respondant(request): user = request.user if set(RESPONDANT_FIELDS).issubset(set([key for key,value in request.POST.items()])): form = RespondantForm(request.POST) if form.is_valid():

Re: Form Validation

2010-07-30 Thread Daniel Roseman
On Jul 30, 4:42 pm, rupert wrote: > I'm trying to use this line of code in form validation, and it is not > working: > > {{ form.field_name.errors }} > > The following lines do output: > {{ form.filed_name}} > {{ form.field_name.help_text }} > > Any thoughts? Could it be

Re: Form validation

2010-07-27 Thread Renne Rocha
Send your model and form codes, than it will be easier to see what is wrong. On Tue, Jul 27, 2010 at 4:45 AM, S.Selvam wrote: > Hi all, > I have two model fields (text and file ) and i want either one of the field > to be filled out. > > I set null=True,blank=True for

Re: Form validation and template errors - need n00b help

2010-07-14 Thread reduxdj
Great, Tom I looked a the django book carefully and did the following: return render_to_response('listing.html', {'form':form,'error': True}) and works... thanks for responding as well On Jul 14, 7:37 am, Tom Evans wrote: > On Tue, Jul 13, 2010 at 4:06 PM, reduxdj

Re: Form validation and template errors - need n00b help

2010-07-14 Thread Tom Evans
On Tue, Jul 13, 2010 at 4:06 PM, reduxdj wrote: > HI, > > Forgive me, here's another n00b doozie. I've created a form, which > extends form, however, my form is not validating and I can't get the > form to print errors next to my form fields. What's curious, at the >

Re: Form validation

2010-05-19 Thread Dejan Noveski
> > >user = User.objects.get(pk=request.user.id) from = UpdateUserForm(user, ...initialstuff...) > First off, change this to form = UpdateUserForm(request.user,...) request.user is django.contrib.auth.User object. You have to have -- -- Dejan Noveski Web Developer dr.m...@gmail.com

Re: Form validation

2010-05-19 Thread Dejan Noveski
On Wed, May 19, 2010 at 3:11 PM, Dejan Noveski wrote: > >>user = User.objects.get(pk=request.user.id) > >from = UpdateUserForm(user, ...initialstuff...) >> > > First off, change this to form = UpdateUserForm(request.user,...) > request.user is django.contrib.auth.User

Re: Form Validation question

2010-05-13 Thread Daniel Roseman
On May 13, 5:17 pm, zweb wrote: > I am doing this > >  form = ContactForm(request.POST) # A form bound to the POST data >  if form.is_valid(): # All validation rules pass > > As clean is called by is_valid() and at this point form in bound to > POST data, I cannot use

Re: Form Validation question

2010-05-13 Thread zweb
I am doing this form = ContactForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass As clean is called by is_valid() and at this point form in bound to POST data, I cannot use self.instance unless I do this form =

Re: Form Validation question

2010-05-13 Thread Jeff Green
I have used sessions to store the initial db record so that when I go into my form I retrieve the value such as stationrec = request.session['stationrec'] On Thu, May 13, 2010 at 9:36 AM, zweb wrote: > I am using a model form to edit (change) an exisiting row in db. > >

Re: Form Validation question

2010-05-13 Thread Shawn Milochik
"Also, a model form instance bound to a model object will contain a self.instance attribute that gives model form methods access to that specific model instance." From: http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/ So you can refer to self.instance in your validation code,

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-17 Thread john2095
There has been some change between 1.1 and trunk regarding questions whether to enforce defaults at the form or the model level. Might be relevant, or provide a clue: http://stackoverflow.com/questions/1436327/does-model-charfieldblankfalse-work-with-save On Mar 17, 12:11 pm, Karen Tracey

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread Karen Tracey
On Tue, Mar 16, 2010 at 8:51 PM, saxon75 wrote: > I guess I should try a little harder before asking for help. Turns > out that I also needed to define the slug field in the model with > "blank=True." > Yeah but, if it worked previously under 1.1, it ought not be broken by

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I guess I should try a little harder before asking for help. Turns out that I also needed to define the slug field in the model with "blank=True." Sorry for the spam. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
I should also note that in the AddArticleForm class, the slug field has the "required" attribute set to False, like so: slug = forms.CharField(max_length=25, required=False) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Form validation changes since 1.1.1? (Autocomplete errors)

2010-03-16 Thread saxon75
Ah, small mistake: my current Django revision is r12794, not r11794. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to

Re: Form Validation in Admin

2010-01-12 Thread Sasuke
Sent: Monday, January 11, 2010 9:27 PM Subject: Re: Form Validation in Admin On Jan 11, 3:24 am, "Sasuke" <zhouj...@gmail.com> wrote: Hi all, I'm using the form's clean() method to do validation for models in admin. The validation we need to do is to make sure there are no more t

Re: Form Validation in Admin

2010-01-11 Thread Daniel Roseman
On Jan 11, 3:24 am, "Sasuke" wrote: > Hi all, > I'm using the form's clean() method to do validation for models in admin. The > validation we need to do is to make sure there are no more than a certain > number of items totally submitted. So I calculate the total number of

Re: Form validation

2009-11-26 Thread Karen Tracey
On Thu, Nov 26, 2009 at 5:49 AM, pinco wrote: > Hi there. > > I’m not able to figure out how to solve in a simple and clean way the > following problem. > Basically what I want to do is to edit the instances of the following > model: > > Models.py > class

Re: Form validation: Add at least one item to inline model

2009-11-23 Thread Brandon Taylor
http://wadofstuff.blogspot.com/2009/08/requiring-at-least-one-inline-formset.html On Nov 23, 6:06 pm, Brandon Taylor wrote: > Hi everyone, > > I need to validate that at lease one item has been added to an inline > model in Django admin. I'm not quite sure where to put

Re: Form validation in Admin Panel

2009-04-13 Thread eli
On 13 Kwi, 21:10, Alex Gaynor wrote: > Provide a custom form to the ModelAdmin using the form > option:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form > > Alex > Oh, it's so simple.. :-) Thank You Alex regards.

Re: Form validation in Admin Panel

2009-04-13 Thread Alex Gaynor
On Mon, Apr 13, 2009 at 2:52 PM, eli wrote: > > Hi, > > How can I to validate data from form in Django Admin Panel? (like: > clena_fieldname in form.ModelForm) ? > > regards. > > > Provide a custom form to the ModelAdmin using the form option:

Re: form validation in XMLHttp submission

2009-02-05 Thread adrian
It is true that I was accessing the error message incorrectly in python - it should be my_form.errors['date'] and it is set. However the doc says you can access that same value with form.name_of_field.errors in a template like this: {{ form.date.errors }} Date: {{

Re: form validation in XMLHttp submission

2009-02-04 Thread Malcolm Tredinnick
On Wed, 2009-02-04 at 11:23 -0800, adrian wrote: > > I'm using the standard pattern for handling a POST request form > submission, even though the form is submitted by JavaScript as an > XMLHttpRequest, and the date validation is not working. I added some > logging statements to find the

Re: form validation does not work

2008-12-31 Thread Chuck22
Thanks for the reference. The problem is solved with this code modification: def contact(request): if request.method == 'POST': f = ContactForm(request.POST) if f.is_valid(): email = f.cleaned_data['email'] ... #send email return

Re: form validation does not work

2008-12-31 Thread Daniel Roseman
On Dec 31, 12:18 am, Chuck22 wrote: > class ContactForm(forms.Form): >           email = forms.EmailField(required=True, >                              widget=forms.TextInput(attrs= > {'size':'30'}), >                             error_messages={'required':'Please fill > out

Re: form validation does not work

2008-12-31 Thread Chuck22
def contact(request): if request.method == 'POST': f = ContactForm(request.POST) if f.is_valid(): email = f.cleaned_data['email'] ... #send email return HttpResponseRedirect(reverse('contact_success')) else: f=ContactForm()

Re: form validation does not work

2008-12-30 Thread Alex Koshelev
Please post here entire view code On Wed, Dec 31, 2008 at 8:18 AM, Chuck22 wrote: > > class ContactForm(forms.Form): > email = forms.EmailField(required=True, > widget=forms.TextInput(attrs= > {'size':'30'}), >

Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Nathaniel Griswold
Thanks, created Ticket #9039 > I don't think the ModelForm validation should prohibit something the > databases generally allow. I'd open a ticket (search first though to see if > it's already been reported/decided on...I could be missing something). > > Karen >

Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Karen Tracey
On Thu, Sep 11, 2008 at 8:14 AM, krylatij <[EMAIL PROTECTED]> wrote: > > You can create only one model with empty 'other' field. > If you could create one more, field 'other' will not be unique more. > That's why validation fails. > This is not generally true at the database level, as

Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread krylatij
You can create only one model with empty 'other' field. If you could create one more, field 'other' will not be unique more. That's why validation fails. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Form validation problem for model with ForeignKey having unique=True,blank=True,null=True

2008-09-11 Thread Nathaniel Griswold
My django version is 1.0-final-SVN-9013 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send

Re: Form validation

2008-08-25 Thread julianb
On Aug 23, 11:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > This seems to have done the trick. Thanks for your help. > > def index(request): >     if request.method == 'POST': >         form = pasteForm(request.POST) >         if form.is_valid(): >             name =

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
Thanks :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
This seems to have done the trick. Thanks for your help. def index(request): if request.method == 'POST': form = pasteForm(request.POST) if form.is_valid(): name = form.cleaned_data['name'] log = form.cleaned_data['log'] return

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
Thanks for your reply Karen. I have been following those docs. If I use it literally it is missing an else after is_valid. Otherwise it tests for POST - if exist test is valid - if is invalid and is POST it returns no response object. That is why I felt I had to return the form again - I was

Re: Form validation

2008-08-23 Thread Karen Tracey
On Sat, Aug 23, 2008 at 4:34 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote: > > OK, I've found why it wasn't returning an httpresponseobject. It was > because I wasn't returning a render_to_response on validation fail. > However I cannot get my errors to show on the form. Any ideas ? > Follow

Re: Form validation

2008-08-23 Thread [EMAIL PROTECTED]
OK, I've found why it wasn't returning an httpresponseobject. It was because I wasn't returning a render_to_response on validation fail. However I cannot get my errors to show on the form. Any ideas ? --~--~-~--~~~---~--~~ You received this message because you are

Re: Form Validation for GET Request

2008-06-14 Thread [EMAIL PROTECTED]
I always use if(len(request.GET)>0): form=TestForm(request.GET) if(form.is_valid()): #process form else: form=Testform() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
Maybe because you actually have to pass `action`? ;) Pass it through your form. Maybe my use of 'action' confused you with the 's action property. Not what I meant, sorry. I didn't realize you had an actual form (Wait, why do you .. Ok, beyond the point) but in this case you can just check for

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
This is what my template looks like: {{ form.as_table }} This is what my view looks like: ... myform = MyForm() if request.method=="GET": myform = MyForm(request.GET) if request.GET.get('action') == True: if myform.is_valid(): ... ... return render_to_response

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
If errors are showing when you first load the page then you need to check that the user has actually completed an action before validating the form. In this case, doing something like if request.GET.get('action') == True: # your form validation here In your links back to the system, simply

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
The problem is when I use myform = MyForm(request.GET) if myform.is_valid(): ... Any fields which are required have their error message activated on first visit to page. Also, any 'initial' value that I put in the forms is not shown. --~--~-~--~~~---~--~~ You

Re: Form Validation for GET Request

2008-06-13 Thread Russell Keith-Magee
On Sat, Jun 14, 2008 at 9:05 AM, ichbindev <[EMAIL PROTECTED]> wrote: > > However, form.is_valid() is for POST only. Is there an is_valid() kind > of thing for forms where method is GET so that data may be validated? I don't know what gave you the idea that is_valid() is just for POST data.

Re: Form Validation

2008-06-11 Thread Adi
Thanks, I will make that change so that the database integrity is maintained. But I also want to do this on the form level. I can do this outside the form in the view but i think that might be inelegant. I will have to create the validation errors by hand and put it in the error_messages for the

  1   2   >