Re: Unit testing form validation issue

2009-10-27 Thread Chris Allen
Ended up populating the test database with fixtures via .json dumps. Thank you very much for your help. --- Chris On Oct 26, 6:19 pm, Karen Tracey wrote: > On Mon, Oct 26, 2009 at 4:12 PM, Chris Allen wrote: > > > Anyone have any experience with

Re: Unit testing form validation issue

2009-10-26 Thread Karen Tracey
On Mon, Oct 26, 2009 at 4:12 PM, Chris Allen wrote: > > Anyone have any experience with forms (ModelMultipleChoice fields and > foreignkey'd choice fields) not validating properly in a unit test but > just fine in the runserver? > > Passing the same request.POST data to

Unit testing form validation issue

2009-10-26 Thread Chris Allen
Anyone have any experience with forms (ModelMultipleChoice fields and foreignkey'd choice fields) not validating properly in a unit test but just fine in the runserver? Passing the same request.POST data to the unit test as I am in the runserver and live instance, which I verified via the

Re: Custom form validation request or user-based

2009-09-02 Thread Daniel Roseman
On Sep 2, 10:59 am, Matthias Kestenholz wrote: > On Wed, Sep 2, 2009 at 10:38 AM, Enrico > > Sartorello wrote: > >> if you need this only for the administration site you'd hvae other > >> hooks that you could override. Either take a

Re: Custom form validation request or user-based

2009-09-02 Thread Matthias Kestenholz
On Wed, Sep 2, 2009 at 10:38 AM, Enrico Sartorello wrote: >> if you need this only for the administration site you'd hvae other >> hooks that you could override. Either take a look at the documentation >> or at django/contrib/admin/options.py >> > > If you mean

Re: Custom form validation request or user-based

2009-09-02 Thread Enrico Sartorello
On Wed, Sep 2, 2009 at 10:25 AM, Matthias Kestenholz wrote: > > On Wed, Sep 2, 2009 at 9:15 AM, Enrico > Sartorello wrote: > > Up. > > > > Already? > > Yes, cause it seemed to me that a message buried by other 30 messages was about to be left

Re: Custom form validation request or user-based

2009-09-02 Thread Matthias Kestenholz
On Wed, Sep 2, 2009 at 9:15 AM, Enrico Sartorello wrote: > Up. > Already? > On Tue, Sep 1, 2009 at 11:06 AM, Enrico Sartorello > wrote: >> >> Wait a moment: this solution doesn't solve my problem. >> Remember that the form I need has

Re: Custom form validation request or user-based

2009-09-02 Thread Enrico Sartorello
t;> > i'm developing a Django application where i need to differentiate the >>> > validation of an admin-site model form between different users: some >>> user >>> > must respect some particular restrictions (imposed via "clean_*" >>> methods) &

Re: Custom form validation request or user-based

2009-09-01 Thread Enrico Sartorello
pect some particular restrictions (imposed via "clean_*" >> methods) >> > while others should do what they want without them. >> > >> > The problem arises because during form validation i cannot access any >> > request object (so i can't buil

Re: Custom form validation request or user-based

2009-09-01 Thread Enrico Sartorello
> > i'm developing a Django application where i need to differentiate the > > validation of an admin-site model form between different users: some user > > must respect some particular restrictions (imposed via "clean_*" methods) > > while others should do what they want

Re: Custom form validation request or user-based

2009-08-31 Thread Matthias Kestenholz
trictions (imposed via "clean_*" methods) > while others should do what they want without them. > > The problem arises because during form validation i cannot access any > request object (so i can't build a permission-based criteria), and checking > everything in other p

Re: Custom form validation request or user-based

2009-08-31 Thread Enrico Sartorello
cular restrictions (imposed via "clean_*" methods) > while others should do what they want without them. > > The problem arises because during form validation i cannot access any > request object (so i can't build a permission-based criteria), and checking > everything in other p

Custom form validation request or user-based

2009-08-28 Thread Enrico Sartorello
lem arises because during form validation i cannot access any request object (so i can't build a permission-based criteria), and checking everything in other places (like Model_admin.save_model() method or with signals) can't do the job because there i can't raise form's validation errors. I'v

ModelForm and dojo form validation

2009-07-09 Thread GaRaGeD Style
This question applies to any other JavaScript validation tool, but I'm doing an app that uses dojo, and i'm trying to put client-side validation smartly, but obviously not achieving it :) Is there any way to add extra fields to the form's HTML created by ModelForm ?? I'm specially concerned

Re: Conditionally bypassing Django form validation

2009-06-18 Thread chefsmart
Hi, Now when I think about this, even when I POST the form, I would somehow have to tell Django to check for uniqueness in the following way: - SELECT * from my_table WHERE short_name = [short_name parameter goes here] AND id != [primary key parameter goes here] and SELECT * from my_table

Re: Conditionally bypassing Django form validation

2009-06-18 Thread chefsmart
Thank you Daniel, That's absolutely what it was. So posting all that amount of code was fruitful after all, else we would have gone back and forth trying to find out where the problem lay!! Regards, CM On Jun 19, 12:19 am, Daniel Roseman wrote: > On Jun 18, 8:02 pm,

Re: Conditionally bypassing Django form validation

2009-06-18 Thread Daniel Roseman
On Jun 18, 8:02 pm, chefsmart wrote: > Hi, > Now consider the following view: - > > def edit_diploma(request, did): >     diploma_to_edit = Diploma.objects.get(id=did) >     if request.method == 'POST': >         form = EditDiplomaForm(request.POST) >         if

Conditionally bypassing Django form validation

2009-06-18 Thread chefsmart
Hi, [ Please excuse if this post is a little verbose, but I want to present my case thoroughly ] I am using my own form to edit my models instead of using Django admin (because of client compulsions) Let's consider the following model: - class Diploma(models.Model): short_name =

Re: Seeing form validation errors

2009-06-11 Thread zayatzz
lt;kmtra...@gmail.com> wrote: > > > > On Tue, Jun 9, 2009 at 2:19 AM, zayatzz <alan.kesselm...@gmail.com> wrote: > > > > > Well thats what i was complaining about in the beginning that i could > > > > use good example of how to do it. Its q

Re: Seeing form validation errors

2009-06-10 Thread zayatzz
19 AM, zayatzz <alan.kesselm...@gmail.com> wrote: > > > > Well thats what i was complaining about in the beginning that i could > > > use good example of how to do it. Its quite confusing how form > > > validation is on one page, errors on the others and views o

Re: Seeing form validation errors

2009-06-09 Thread zayatzz
uld > > use good example of how to do it. Its quite confusing how form > > validation is on one page, errors on the others and views on third and > > there is not single full example. > > > How should the else part be? > > > else: > >    message = &

Re: Seeing form validation errors

2009-06-09 Thread Karen Tracey
On Tue, Jun 9, 2009 at 2:19 AM, zayatzz <alan.kesselm...@gmail.com> wrote: > > Well thats what i was complaining about in the beginning that i could > use good example of how to do it. Its quite confusing how form > validation is on one page, errors on the others

Re: Seeing form validation errors

2009-06-09 Thread zayatzz
Well thats what i was complaining about in the beginning that i could use good example of how to do it. Its quite confusing how form validation is on one page, errors on the others and views on third and there is not single full example. How should the else part be? else: message = "

Re: Seeing form validation errors

2009-06-08 Thread Karen Tracey
On Mon, Jun 8, 2009 at 3:57 PM, zayatzz <alan.kesselm...@gmail.com> wrote: > > Well now this is working just fine: > > [snip AccountForm] > > But this (code below) still does not return me any error messages from > form validation. > >

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
if data.get("pwd") != data.get("pwdc"): raise forms.ValidationError("Passwords do not match") return data But this (code below) still does not return me any error messages from form validation.

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
I think i already tried that, Michael, and i got some error that had something to do with nonetype... since there is no pwd in data, you cant compare if its equal or not to '' Alan. On 8 juuni, 17:24, Michael wrote: > On Mon, Jun 8, 2009 at 10:09 AM, zayatzz

Re: Seeing form validation errors

2009-06-08 Thread Michael
On Mon, Jun 8, 2009 at 10:09 AM, zayatzz wrote: > > So i change pwd and pwdc to required=False and in clean i do > if pwd in data (or if ["pwd"] not in data): >if data.get("pwd") != data.get("pwdc"): >raise forms.ValidationError("Passwords do not match")

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
So i change pwd and pwdc to required=False and in clean i do if pwd in data (or if ["pwd"] not in data): if data.get("pwd") != data.get("pwdc"): raise forms.ValidationError("Passwords do not match") return data and i get errorfree clean function? Alan On Jun 8, 4:29 pm, Michael

Re: Seeing form validation errors

2009-06-08 Thread Michael
On Mon, Jun 8, 2009 at 2:05 AM, zayatzz wrote: > > Great :). Thanks... > > Wish i had read your post more thoroughly the first time. > > This takes care of my second problem, but what about the first one - > why do password fields need to be filled? Because empty(or

Re: model form validation always failing

2009-06-08 Thread watad
the form is working fine now , actually my form was inside another form , that was the problem On May 22, 6:55 pm, watad wrote: > hi karen , actually im runing this code , after submit i can see all > the data inside the model ,only the filefield resume is empty , of > course

Re: Seeing form validation errors

2009-06-08 Thread zayatzz
Great :). Thanks... Wish i had read your post more thoroughly the first time. This takes care of my second problem, but what about the first one - why do password fields need to be filled? Because empty(or nonexisting data) fields cannot be compared in 2nd if ? Then what is the syntax for

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 2:54 PM, zayatzz wrote: > > Line 43 - if form.is_valid(): > Line 44 - message = "form valid: " + form.cleaned_data['username'] > > Alan > On Jun 7, 9:45 pm, Alex Gaynor wrote: > > On Sun, Jun 7, 2009 at 2:38 PM,

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Line 43 - if form.is_valid(): Line 44 - message = "form valid: " + form.cleaned_data['username'] Alan On Jun 7, 9:45 pm, Alex Gaynor wrote: > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > > When the form does pass all that validation i

Re: Seeing form validation errors

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > When the form does pass all that validation i get this error in view : > > Exception Type: TypeError > Exception Value: > 'NoneType' object is unsubscriptable > Exception Location:

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
When the form does pass all that validation i get this error in view : Exception Type: TypeError Exception Value: 'NoneType' object is unsubscriptable Exception Location: /home/projects/tst/profile/views.py in profile_detail, line 44 Line 44 is - message = "form valid: " +

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Thanks to both of you! I changed template form tag to {{ form.as_p }} I figured that since my posting view did not give form to context again, but did just redirect, that i had to change this. I also added custom messages to pass to the template from different parts of the view - if request is

Re: Seeing form validation errors

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > [snip form def] > For some reason the view does not save the stuff i get with form and i > want to figure out why. > > Perhaps form does not validate for some reason... Where or how can i > see

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > class AccountForm(forms.Form): >username = forms.CharField(max_length=100, help_text="Enter Username > of your account", label="Your username") >email =

Seeing form validation errors

2009-06-07 Thread zayatzz
I have this form: class AccountForm(forms.Form): username = forms.CharField(max_length=100, help_text="Enter Username of your account", label="Your username") email = forms.EmailField(max_length=100, help_text="Enter your e-mail address", label="Your e-mail address")

ImageField form validation doesn't work.

2009-05-25 Thread [CPR]-AL.exe
Hello. I have a simple form with only ImageField declared in it and I've got the following problem: when I am trying to upload something that is not am image, i get no errors at all. Form.is_valid() returns True. What should I do to validate the imagedata?

Re: model form validation always failing

2009-05-22 Thread watad
hi karen , actually im runing this code , after submit i can see all the data inside the model ,only the filefield resume is empty , of course when i test this i add (blank=True, null=True) to my resume field , so why do u think the other fileds is geeting the data submitted by the form and the

Re: model form validation always failing

2009-05-21 Thread Stu.Axon
Reposted as own subject with all the details On May 21, 5:18 pm, "Stu.Axon" wrote: > I'm having the same problem - using a modelform > > I've got two fields jad_file and jar_file, I notice when I look at the > html that they turn into > id_jad_file > and > id_jar_file > > Is

Re: model form validation always failing

2009-05-21 Thread Stu.Axon
I'm having the same problem - using a modelform I've got two fields jad_file and jar_file, I notice when I look at the html that they turn into id_jad_file and id_jar_file Is there a reason for this? On May 20, 7:13 pm, Karen Tracey wrote: > On Wed, May 20, 2009 at 2:39

Re: model form validation always failing

2009-05-20 Thread Karen Tracey
On Wed, May 20, 2009 at 2:39 AM, watad wrote: > > this is my form after thomas reply: > > {{ form.as_p }} > > > > > and this is my view after your reply : > > def

Re: model form validation always failing

2009-05-20 Thread watad
this is my form after thomas reply: {{ form.as_p }} and this is my view after your reply : def careerspage(request): if request.method == 'POST': form =

Re: model form validation always failing

2009-05-19 Thread Karen Tracey
On Tue, May 19, 2009 at 5:23 AM, watad wrote: > i have a model Career > > class Career(models.Model): > full_name = models.CharField(max_length=200) > email = models.EmailField() > nationality = CountryField() > resume = models.FileField(upload_to='resumes') > def

Re: model form validation always failing

2009-05-19 Thread watad
thanks for the reply thomas if tried that but it is still giving the validation message On May 19, 1:18 pm, Thomas Guettler wrote: > Maybe you form misses this: enctype="multipart/form-data" > > watad schrieb: > > > dear all > ... > > i can see the fileds but when i try to

Re: model form validation always failing

2009-05-19 Thread Thomas Guettler
Maybe you form misses this: enctype="multipart/form-data" watad schrieb: > dear all ... > i can see the fileds but when i try to submit , the rusume validation > is always failing (This field is required.) > although i upload the file, and i was able to add data usign the admin > interface

model form validation always failing

2009-05-19 Thread watad
dear all i have a model Career class Career(models.Model): full_name = models.CharField(max_length=200) email = models.EmailField() nationality = CountryField() resume = models.FileField(upload_to='resumes') def __unicode__(self): return self.full_name and i have the model

Re: Dynamic form validation doesn't work.

2009-04-30 Thread Lacrima
Thank you very much, Daniel!!! Max. On Apr 30, 8:41 pm, Daniel Roseman wrote: > On Apr 30, 5:43 pm, Lacrima wrote: > > > > > Hello! > > > For example I have: > > class ContactForm(forms.Form): > >     def __init__(self, foo, *args,

Re: Dynamic form validation doesn't work.

2009-04-30 Thread Daniel Roseman
On Apr 30, 5:43 pm, Lacrima wrote: > Hello! > > For example I have: > class ContactForm(forms.Form): >     def __init__(self, foo, *args, **kwargs): >         super(ContactForm, self).__init__(*args, **kwargs) >         self.fields['subject'] = forms.CharField() >        

Dynamic form validation doesn't work.

2009-04-30 Thread Lacrima
Hello! For example I have: class ContactForm(forms.Form): def __init__(self, foo, *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) self.fields['subject'] = forms.CharField() self.fields['message'] = forms.CharField() self.fields['sender'] =

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:

Form validation in Admin Panel

2009-04-13 Thread eli
Hi, How can I to validate data from form in Django Admin Panel? (like: clena_fieldname in form.ModelForm) ? regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Using form validation to prevent deletion no longer works (after rev 10206/ticket #9587)

2009-04-05 Thread Dan Tallis
2009/4/5 Karen Tracey : > Forgot the link to that other ticket [1]: > > http://code.djangoproject.com/ticket/10711 Thanks for the response, Karen. I've posted to django-developers. I think ticket 10711 is only very loosely related. Dan

Re: Using form validation to prevent deletion no longer works (after rev 10206/ticket #9587)

2009-04-05 Thread Karen Tracey
Forgot the link to that other ticket [1]: http://code.djangoproject.com/ticket/10711 Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Using form validation to prevent deletion no longer works (after rev 10206/ticket #9587)

2009-04-05 Thread Karen Tracey
On Sun, Apr 5, 2009 at 9:40 AM, Dan Tallis wrote: > > In my application I have a formset with can_delete. Some custom > validation is performed on submit, to determine whether the forms > selected by the user for deletion can be deleted -- i.e. I have a > custom clean()

Using form validation to prevent deletion no longer works (after rev 10206/ticket #9587)

2009-04-05 Thread Dan Tallis
In my application I have a formset with can_delete. Some custom validation is performed on submit, to determine whether the forms selected by the user for deletion can be deleted -- i.e. I have a custom clean() method on the form to decide whether deletion is permitted (based on various bits of

Re: Json Serialization / Form Validation error

2009-04-02 Thread Bro
But before, is it possible to serialize a form in JSON ? 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

Re: Json Serialization / Form Validation error

2009-04-02 Thread Bro
But beforce, is it possible to serialise a form in JSON ? Thanks On 11 fév, 00:50, adrian wrote: > Thank you all for posting this.  You saved me probably hours of head > scratching. --~--~-~--~~~---~--~~ You received this message because you

Re: Multiple form validation

2009-02-20 Thread Karen Tracey
orm(initial={'orderdate': today.strftime('%Y- > %m-%d')}, instance=Order(), prefix="order") >equipform = EquipmentForm(instance=Equipment(), > prefix="equipment") > >return render_to_response('order_form.html', { 'orderform': > orderform, 'equipform': equipf

Multiple form validation

2009-02-20 Thread flagg
nt") return render_to_response('order_form.html', { 'orderform': orderform, 'equipform': equipform }) If I only run is_valid on one form it adds the record correctly. But when I add the second form validation check it fails. Am I missing something? The data I am inputting

Re: Json Serialization / Form Validation error

2009-02-10 Thread adrian
Thank you all for posting this. You saved me probably hours of head scratching. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

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

form validation in XMLHttp submission

2009-02-04 Thread adrian
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 problem and I get the error message "MyModelForm' object has

Re: Automatically Generating Non-Ajax Client-Side Form Validation

2009-01-24 Thread Tim
See http://code.google.com/p/django-ajax-forms/ I started this project to handle your use case. On Jan 24, 3:52 am, Chris <chriss...@gmail.com> wrote: > Is anyone aware of a simple way to automatically generate non-Ajax > form validation? I've seen some useful posts aboutAjax-form

Re: Automatically Generating Non-Ajax Client-Side Form Validation

2009-01-23 Thread Malinka Rellikwodahs
following you're link they discussed client side form validation just like you mentioned, not sure it's complete or what you need but http://eikke.com/tag/django-validation/ might have some useful information On Fri, Jan 23, 2009 at 12:52, Chris <chriss...@gmail.com> wrote: > > Is

Automatically Generating Non-Ajax Client-Side Form Validation

2009-01-23 Thread Chris
Is anyone aware of a simple way to automatically generate non-Ajax form validation? I've seen some useful posts about Ajax-form validation (e.g. http://eikke.com/django-generic-ajax-form-validation/), but I'd rather not waste bandwidth on validating integers/dates/phone- numbers/required-fields

Re: Json Serialization / Form Validation error

2009-01-15 Thread Alex
I ran into this same problem but the code snippets you guys gave weren't working. In case anyone is reading this in the future, here is what you want: dict([(k, [unicode(e) for e in v]) for k,v in errors.items()]) The above line will give a dictionary of field names mapping to lists of errors.

Re: form validation does not work

2008-12-31 Thread Chuck22
      ... > >             return HttpResponseRedirect(reverse('contact_success')) > > > When user submit the contact form without fill out email field, the > > form get submitted without displaying error message 'Please fill out > > your Email'. Instead, I got error: Th

Re: form validation does not work

2008-12-31 Thread Daniel Roseman
ll out email field, the > form get submitted without displaying error message 'Please fill out > your Email'. Instead, I got error: The view app.views.contact didn't > return an HttpResponse object. > > it seems f.is_valud return false, which is correct. But I think form > vali

Re: form validation does not work

2008-12-31 Thread Chuck22
> > > When user submit the contact form without fill out email field, the > > form get submitted without displaying error message 'Please fill out > > your Email'. Instead, I got error: The view app.views.contact didn't > > return an HttpResponse object. > > > it seems

Re: form validation does not work

2008-12-30 Thread Alex Koshelev
When user submit the contact form without fill out email field, the > form get submitted without displaying error message 'Please fill out > your Email'. Instead, I got error: The view app.views.contact didn't > return an HttpResponse object. > > it seems f.is_valud ret

form validation does not work

2008-12-30 Thread Chuck22
sponse object. it seems f.is_valud return false, which is correct. But I think form validation should kick in at this point and return error message to {{ form.email.errors }} field in template. Why doesn't the validation work? Did I miss anything? --~--~-~--~~~---~--~~

Re: Json Serialization / Form Validation error

2008-12-17 Thread Rodrigue
Hi Russell, I bumped into the same issue today and was glad I found this post. However, I found that I had to use unicode() rather than str(), which turns your example into: content = dict((key, [unicode(v) for v in values]) \ for key, values in

Re: Json Serialization / Form Validation error

2008-10-19 Thread Russell Keith-Magee
On Sun, Oct 19, 2008 at 12:58 AM, justind <[EMAIL PROTECTED]> wrote: > > Hello, > > No one has any ideas? Settle down, Tiger. You asked this question on a Friday night. You may need to wait a little more than 18 hours if you want a response. We're all volunteers here, and many of us have

Re: Json Serialization / Form Validation error

2008-10-18 Thread justind
Actually the test form is (I forgot to change the name) class MyForm(forms.Form): text = forms.CharField() link = forms.URLField() On Oct 18, 4:21 pm, justind <[EMAIL PROTECTED]> wrote: > I get exactly the same thing. > > Here's what I'm entering. > > >>> import simplejson > >>>

Re: Json Serialization / Form Validation error

2008-10-18 Thread justind
I get exactly the same thing. Here's what I'm entering. >>> import simplejson >>> simplejson >>> from myproject.app.models import MyForm >>> f = MyForm({'link': 'footext'}) >>> f.errors {'text': [u'This field is required.'], 'link': [u'Enter a valid URL.']} >>> simplejson.dumps(f.errors)

Re: Json Serialization / Form Validation error

2008-10-18 Thread TiNo
Could you try this with simplejson not bundled with Django? If that works this is probably a bug in the version bundled with Django. On Sat, Oct 18, 2008 at 6:58 PM, justind <[EMAIL PROTECTED]> wrote: > > Hello, > > No one has any ideas? > > The code I'm actually using in my view is almost

Re: Json Serialization / Form Validation error

2008-10-18 Thread justind
Hello, No one has any ideas? The code I'm actually using in my view is almost identical to the validage_contact view from http://toys.jacobian.org/presentations/2007/oscon/tutorial/ (single slide: http://toys.jacobian.org/presentations/2007/oscon/tutorial/images/django-master-class.081.png)

Json Serialization / Form Validation error

2008-10-17 Thread [EMAIL PROTECTED]
Hello, I'm having a hard time understanding why Django won't let me serialize a dictionary of form errors. Can anyone explain why Django throws an error if I try to serialize someform.errors, even if I copy it into a plain dictionary? #!/usr/bin/env python from django.utils import simplejson

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-22 Thread Steve Holden
10:01 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: >> >>> On Friday 19 Sep 2008 7:02:06 am Karthik Krishnan wrote: >>> >>> >>>> The premise is this: If the form validation fails, I want to display >>>

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-22 Thread Hanne Moa
y 19 Sep 2008 7:02:06 am Karthik Krishnan wrote: >> >> > The premise is this: If the form validation fails, I want to display >> > all the validation error messages on the top of the page in a special >> > div tag that I have created. >> >> > {% for fiel

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-19 Thread Karthik Krishnan
It throws a debug error page. On Sep 18, 10:01 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On Friday 19 Sep 2008 7:02:06 am Karthik Krishnan wrote: > > > The premise is this: If the form validation fails, I want to display > > all the validation error message

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-19 Thread Kenneth Gonsalves
On Friday 19 Sep 2008 7:02:06 am Karthik Krishnan wrote: > The premise is this: If the form validation fails, I want to display > all the validation error messages on the top of the page in a special > div tag that I have created. > > {% for field, message in form.errors.items()%

Re: Newbie Question: How to display only error messages when form validation fails?

2008-09-18 Thread Steve Holden
Karthik Krishnan wrote: > Hi, > > The premise is this: If the form validation fails, I want to display > all the validation error messages on the top of the page in a special > div tag that I have created. > > {% for field, message in form.errors.items()%} > {{

Newbie Question: How to display only error messages when form validation fails?

2008-09-18 Thread Karthik Krishnan
Hi, The premise is this: If the form validation fails, I want to display all the validation error messages on the top of the page in a special div tag that I have created. {% for field, message in form.errors.items()%} {{message}} {% endfor %} returns a compilation error. I don't want

Re: Basic Form Processing Question: How to prevent form validation on a GET request.

2008-09-18 Thread Karthik Krishnan
Hi Daniel, Thanks for your solution. It worked. Thanks, Karthik On Sep 18, 1:46 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Sep 18, 9:34 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a form which contains some prefilled data and some to be filled > > in by the

Re: Basic Form Processing Question: How to prevent form validation on a GET request.

2008-09-18 Thread Daniel Roseman
On Sep 18, 9:34 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote: > Hi, > > I have a form which contains some prefilled data and some to be filled > in by the user. I have no trouble getting the forms to be prefilled. > What I want is thatfor a GET request, if the form data pre exists, > then

Basic Form Processing Question: How to prevent form validation on a GET request.

2008-09-18 Thread Karthik Krishnan
Hi, I have a form which contains some prefilled data and some to be filled in by the user. I have no trouble getting the forms to be prefilled. What I want is thatfor a GET request, if the form data pre exists, then display it; if not, then show a blank text field . For a post request, if the

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

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

2008-09-11 Thread Nathaniel Griswold
Hi, I'm having problems validating a form for the below models. Multiple null values in the below "Thing" model's "other" column seem to prevent the basic ModelForm from validating. This also happens for OneToOneFields of the same nature. Normal django db api functions and the database do not

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

<    1   2   3   4   >