Re: object has no attribute 'is_valid'

2021-05-26 Thread sourav panja
The Link is crashed. Its not open On Thursday, May 27, 2021 at 10:27:19 AM UTC+5:30 sourav panja wrote: > Thank you > > On Thu, May 27, 2021 at 2:31 AM AK channel wrote: > >> Send the code >> >> On Thu, 27 May 2021, 2:14 am sourav panja, wrote: >> &

Re: object has no attribute 'is_valid'

2021-05-26 Thread sourav panja
Thank you On Thu, May 27, 2021 at 2:31 AM AK channel wrote: > Send the code > > On Thu, 27 May 2021, 2:14 am sourav panja, > wrote: > >> object has no attribute 'is_valid' >> >> -- >> You received this message because you are subscribed to

Re: object has no attribute 'is_valid'

2021-05-26 Thread AK channel
Send the code On Thu, 27 May 2021, 2:14 am sourav panja, wrote: > object has no attribute 'is_valid' > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiv

object has no attribute 'is_valid'

2021-05-26 Thread sourav panja
object has no attribute 'is_valid' -- 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 view this d

Re: Django modelformset is_valid method retrieves entire model from database

2020-07-30 Thread Shaheed Haque
> > > On Wednesday, July 29, 2020 at 2:25:30 AM UTC+3, Abdulrahman Alahaideb > wrote: >> >> I have a modelformset when is_valid method is called the entire model >> objects of the underlying form is retrieved from the database which is not >> efficient if the

Re: Django modelformset is_valid method retrieves entire model from database

2020-07-29 Thread Abdulrahman Alahaideb
UTC+3, Abdulrahman Alahaideb wrote: > > I have a modelformset when is_valid method is called the entire model > objects of the underlying form is retrieved from the database which is not > efficient if the database table contains hundred of thousands records, I > believe Django was not

Re: is_valid() method and cleaned_data attribute

2019-03-22 Thread Mohammad Etemaddar
> object is to validate data. With a bound Form <https://docs.djangoproject.com/en/2.1/ref/forms/api/#django.forms.Form> instance, call the is_valid() <https://docs.djangoproject.com/en/2.1/ref/forms/api/#django.forms.Form.is_valid> method to run validation and return a boolean

Re: is_valid() method and cleaned_data attribute

2019-03-22 Thread Marcio Bernardes
is_valid() validates the form, for instance, if you have a field for integers and the user passes a str the 'is_valid()' will return false. The cleaned_data is the method you can use to access the data from the input if the form is valid, if the form is not valid this method will n

is_valid() method and cleaned_data attribute

2019-03-22 Thread omar ahmed
hello guys i created contact form in my view : if form.is_valid(): message = form.cleaned_data['message'] what is .is_valid() method and what is cleaned_data attribute ??? -- You received this message because you are subscribed to the Google Groups "Django users" group. To u

ModelForm: overriding is_valid()

2018-07-13 Thread clavierplayer
l object that way. I think overriding is_valid() is the correct way to go, but I'm not sure what I'm leaving out--when I override this method, the data is never committed to the database even though I call super(). I've also tried overriding save() and clean() on the ModelForm,

Re: How to "stop" validation when having errors (is_valid) for form?

2015-09-11 Thread 'Tom Evans' via Django users
On Fri, Sep 11, 2015 at 7:37 AM, wrote: > Example: I have 2 on a html page, which is a form (assume it is > login form, with username and password, both are required and will do > validation on this.). > > The behavior of is_valid I see is: > When submit, the returned error

How to "stop" validation when having errors (is_valid) for form?

2015-09-10 Thread gengshenghong
Example: I have 2 on a html page, which is a form (assume it is login form, with username and password, both are required and will do validation on this.). The behavior of is_valid I see is: When submit, the returned errors for the form are: This field is required (for username) This field is

Re: is_valid

2014-02-14 Thread Jonathan Querubina
blank = True on the model field On Feb 14, 2014, at 8:53 AM, fabricio wrote: > how do i django not validate some fields > > -- > 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

is_valid

2014-02-14 Thread fabricio
how do i django not validate some fields -- 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 to this group, send e

error is_valid

2014-02-14 Thread fabricio
I have this model class Pedido(models.Model): idpedido = models.IntegerField(verbose_name=u'Código', primary_key=True,default=-1 , blank=True) idsys_point_cliente = models.CharField(max_length=60, default="-1") idempresa = models.CharField(max_length=60, default="-1") dtemissao =

Re: Django ModelForm is_valid & form_valid

2013-06-20 Thread Jacob Valenta
Thank you good sir! You have put an end to my week long head ache! On Thursday, June 20, 2013 12:27:36 PM UTC-4, Jason Arnst-Goodrich wrote: > > This is a common problem to run into. > > def form_valid(self, form): > > customer = form.save(commit=False) > > customer.store = self.request.user.acti

Re: Django ModelForm is_valid & form_valid

2013-06-20 Thread Jason Arnst-Goodrich
This is a common problem to run into. def form_valid(self, form): customer = form.save(commit=False) customer.store = self.request.user.active_profile.store customer.save() return super(CustomerInformationView, self).save(form) super(CustomerInformationView, self).save(form)doesn't really

Django ModelForm is_valid & form_valid

2013-06-20 Thread Jacob Valenta
ckages/django/views/generic/base.py" in dispatch 86. return handler(request, *args, **kwargs) File "/Users/jacobvalenta/.virtualenvs/mercury/lib/python2.7/site-packages/django/views/generic/edit.py" in post 222. return super(BaseUpdateView, self).post(reque

how to change form field in method is_valid()

2011-12-24 Thread 软刀
"": "Message.to_user" must be a "User" instance. so i want to change self.fields['to_user'] 's value before is_valid() is call like: def is_valid(self): # do something to fix the problem super(MessageForm, self).is_valid() but I don&#x

Re: newbie question: .is_valid seems non-Boolean?

2009-12-20 Thread Łukasz Balcerzak
se >>> f = F({'name': 'Lukasz'}) >>> f.is_valid() True You get your boolean if you ``call`` the "is_valid" method. On Dec 20, 2009, at 2:17 PM, BobAalsma wrote: > I'm following the The Django Book 2.0, trying to learn Django. > I'm o

Re: newbie question: .is_valid seems non-Boolean?

2009-12-20 Thread Karen Tracey
: > although all other parts seem to work as described in the book, > the .is_valid returns an unexpected non Boolean answer - how to addres > this? > is_valid is a method. You need to call it in order to get its return value: f.is_valid() not: f.is_valid Karen -- You received this m

newbie question: .is_valid seems non-Boolean?

2009-12-20 Thread BobAalsma
I'm following the The Django Book 2.0, trying to learn Django. I'm on Apple OS X10.5.8, Python 2.5.1. I have looked at FAQ, mailing lists, etc. but did not find any situation looking like this. Question: although all other parts seem to work as described in the book, the .is_valid

Re: is_valid error/bug when unique_together fields are both ForeignKey fields

2009-11-28 Thread cerberos
The problem ("Foo bar with this None and None already exists.") only happens when I use a ModelForm and choose to specify the field details myself. Here is an example Models class Foo(models.Model): f = models.IntegerField(unique=True) def __unicode__(self): return 'Foo with f = %

Re: is_valid error/bug when unique_together fields are both ForeignKey fields

2009-11-26 Thread Nick Arnett
On Thu, Nov 26, 2009 at 9:37 AM, cerberos wrote: > I have a model that has two fields (Django 1.1.1) > > class FooBar(models.Model): >foo = models.ForeignKey('Foo') >bar = models.ForeignKey('Bar') > >class Meta: >unique_together =

Re: is_valid error/bug when unique_together fields are both ForeignKey fields

2009-11-26 Thread Karen Tracey
On Thu, Nov 26, 2009 at 12:37 PM, cerberos wrote: > I have a model that has two fields (Django 1.1.1) > > class FooBar(models.Model): >foo = models.ForeignKey('Foo') >bar = models.ForeignKey('Bar') > >class Meta: >unique_together =

is_valid error/bug when unique_together fields are both ForeignKey fields

2009-11-26 Thread cerberos
I have a model that has two fields (Django 1.1.1) class FooBar(models.Model): foo = models.ForeignKey('Foo') bar = models.ForeignKey('Bar') class Meta: unique_together = (('foo','bar'),) When is_valid is called in my view and the

Re: ModelForm's is_valid() returns False, but I don't know why.

2009-08-15 Thread Daniel Roseman
; is loaded with data from a file] >      form = CategoriaForm( initial=data , prefix=str(idx) ) >      if form.is_valid(): >         [do something] >     else: >        [do another thing] > [/lots of code] > > The webpage shows the form populated with the data, BUT, is_valid() always

Re: ModelForm's is_valid() returns False, but I don't know why.

2009-08-15 Thread Tom
valid(): >         [do something] >     else: >        [do another thing] > [/lots of code] > > The webpage shows the form populated with the data, BUT, is_valid() always > return false. I don't know what fails to validate, form.errors is empty. > > Thanks! > >

ModelForm's is_valid() returns False, but I don't know why.

2009-08-14 Thread George Laskowsky
e] The webpage shows the form populated with the data, BUT, is_valid() always return false. I don't know what fails to validate, form.errors is empty. Thanks! P.S: thanks Margie for the last help. -- George Laskowsky Ziguilinsky --~--~-~--~~~---~--~~ You re

Re: ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread omat
Thanks, you are right. My generic form template accesses forms errors and they get populated. This is behavior seems a little strange but other way (errors being populated only when is_valid is called) would have different complications I guess. FYI, in my blog app, a blog item has several

Re: ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread Karen Tracey
On Fri, Jun 27, 2008 at 12:10 PM, omat <[EMAIL PROTECTED]> wrote: > > Thanks for the clarification. > > Apparently my demo case of the problem was not appropriate, but my > real problem is still there. > > I have 2 ModelForms that I want to receive data at a single form > submission. > > item_form

Re: ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread omat
, 6:47 pm, Arien <[EMAIL PROTECTED]> wrote: > On Fri, Jun 27, 2008 at 10:39 AM, omat <[EMAIL PROTECTED]> wrote: > > > At the instant I initialize my form, the errors dict is filled, > > although the documentation says, the validation happens after form > >

Re: ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread Arien
On Fri, Jun 27, 2008 at 10:39 AM, omat <[EMAIL PROTECTED]> wrote: > > At the instant I initialize my form, the errors dict is filled, > although the documentation says, the validation happens after form > instance's is_valid() method is called. > > [example snipped]

ModelForm's error dict is filled before is_valid() is called

2008-06-27 Thread omat
Hi, At the instant I initialize my form, the errors dict is filled, although the documentation says, the validation happens after form instance's is_valid() method is called. Here is the demonstration: >>> from blog.forms import ItemForm >>> from blog.models import I

Re: Initializing modelform if modelform's is_valid() is false

2008-05-07 Thread Lakshmi J
Thanks Karen... My issue has been solved. I used Dojo widgets in my template instead of Django widgets. Then those reprinted data were not displayed. But when I removed Dojo widgets, it is working properly. Can you suggest an efficient way to integrate Django and Dojo, any links or tutorial? On

Re: Initializing modelform if modelform's is_valid() is false

2008-05-07 Thread Karen Tracey
On Thu, May 8, 2008 at 1:00 AM, leppy <[EMAIL PROTECTED]> wrote: > > Hi everyone, > > I have a model 'Person' in my application as follows: > > class Person(models.Model): >name = models.CharField(max_length = 100) >address = models.CharField(max_length = 800) >phone = mode

Initializing modelform if modelform's is_valid() is false

2008-05-07 Thread leppy
Hi everyone, I have a model 'Person' in my application as follows: class Person(models.Model): name = models.CharField(max_length = 100) address = models.CharField(max_length = 800) phone = models.CharField(max_length = 15) Next, I have created a modelform, class Person

Re: is_valid() name change?

2008-04-25 Thread Malcolm Tredinnick
On Fri, 2008-04-25 at 12:28 +0200, Thomas Guettler wrote: > Malcolm Tredinnick schrieb: > > On Fri, 2008-04-25 at 09:37 +0200, Thomas Guettler wrote: > > [...] > > > > > >> I wrote > >> a ticket some time ago. If you care, please leave > >> a comment: > >> > >> http://code.djangoproject.com/t

Re: is_valid() name change?

2008-04-25 Thread Kenneth Gonsalves
On 25-Apr-08, at 3:58 PM, Thomas Guettler wrote: >> ticket. It's always taken into account that there is often more >> than one >> person wishing for any particular feature or bug fix. >> >> > How can you know how many people have this problem, if nobody says > "me too", > or "patch works fo

Re: is_valid() name change?

2008-04-25 Thread Thomas Guettler
Malcolm Tredinnick schrieb: > On Fri, 2008-04-25 at 09:37 +0200, Thomas Guettler wrote: > [...] > > >> I wrote >> a ticket some time ago. If you care, please leave >> a comment: >> >> http://code.djangoproject.com/ticket/6675 >> > > I don't want to sound mean, but please don't. The utilit

Re: is_valid() name change?

2008-04-25 Thread Malcolm Tredinnick
On Fri, 2008-04-25 at 09:37 +0200, Thomas Guettler wrote: [...] > I wrote > a ticket some time ago. If you care, please leave > a comment: > > http://code.djangoproject.com/ticket/6675 I don't want to sound mean, but please don't. The utility of tickets isn't evaluated by the number of "me to

Re: is_valid() name change?

2008-04-25 Thread Thomas Guettler
dimrub schrieb: > I don't think having a function with such a profound side effect (such > as making clean_data available) is a good idea. Very counter- > intuitive, IMHO. Why not split it into two: > > I don't think this side effect is bad. But I think it is black magic, that cleaned_data is s

Re: is_valid() name change?

2008-04-24 Thread Malcolm Tredinnick
(and, as I explain below, you've mis-diagnosed the thing you're concerned with slightly) and we try very hard not to break existing code without really good reason. The name fits very naturally into the normal use pattern, in the sense that code reads quite logically and it's clear

is_valid() name change?

2008-04-24 Thread dimrub
I don't think having a function with such a profound side effect (such as making clean_data available) is a good idea. Very counter- intuitive, IMHO. Why not split it into two: - validate() - that performs the validation and makes clean_data available - is_valid() - that calls the above val

Re: does is_valid handle unique=True

2007-11-09 Thread Malcolm Tredinnick
On Sat, 2007-11-10 at 11:41 +0530, Kenneth Gonsalves wrote: > hi, > > I was using form_for_model with one field which has unique=True. This > form passes the is_valid test, but postgres barfs on the duplicate > entry - am I doing something wrong, or does is_valid not handle

Re: does is_valid handle unique=True

2007-11-09 Thread Sean Perry
Kenneth Gonsalves wrote: > hi, > > I was using form_for_model with one field which has unique=True. This > form passes the is_valid test, but postgres barfs on the duplicate > entry - am I doing something wrong, or does is_valid not handle > unique=True? is_valid simply

does is_valid handle unique=True

2007-11-09 Thread Kenneth Gonsalves
hi, I was using form_for_model with one field which has unique=True. This form passes the is_valid test, but postgres barfs on the duplicate entry - am I doing something wrong, or does is_valid not handle unique=True? -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in

Re: newforms is_valid issue

2007-05-02 Thread maeck
set correctly (as it is if I do print d.__dict__). I am using Django 0.96 release version on mysql. M. On May 1, 11:19 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-05-01 at 21:21 -0700, maeck wrote: > > oops, did not use form_for_instance(d). > > However,

Re: newforms is_valid issue

2007-05-01 Thread Malcolm Tredinnick
On Tue, 2007-05-01 at 21:21 -0700, maeck wrote: > oops, did not use form_for_instance(d). > However, is_valid is not telling me that the form is correct. > What am I doing wrong? Well, if f.bound is True and f.is_valid() is false, f.errors will contain the validation errors. That would

Re: newforms is_valid issue

2007-05-01 Thread maeck
oops, did not use form_for_instance(d). However, is_valid is not telling me that the form is correct. What am I doing wrong? >>> d = Person.objects.get(id=1) >>> p = forms.models.form_for_instance(d) >>> f=p() >>> print f Name: Country: - USA Net

newforms is_valid issue

2007-05-01 Thread maeck
I am confused about the following: If I get a previous saved record, transform it into a form instance and then create a form out of it, the data is not valid nor bound (see below). However, if I print out the form, all fields are populated correctly. Am I missing a step? Thanks, Marcel >>> d =