Re: reg: Django forms and models

2019-11-13 Thread 'Amitesh Sahay' via Django users
Initially I had written the "else" statement at the wrong place. Moved it under the very first "if" and used then returned the HTTPresponse on the right place inside the function Regards, Amitesh S On Wednesday, 13 November, 2019, 5:42:57 AM IST, o1bigtenor wrote: On Tue, Nov 12,

Re: reg: Django forms and models

2019-11-12 Thread o1bigtenor
On Tue, Nov 12, 2019 at 12:39 PM 'Amitesh Sahay' via Django users wrote: > > Hello Kasper, > > Thank you for the hint. I found my mistake and resolved it. > So what did you do? (doesn't need to have all the detail just the idea please) TIA -- You received this message because you are subscribed

Re: reg: Django forms and models

2019-11-12 Thread 'Amitesh Sahay' via Django users
Hello Kasper, Thank you for the hint. I found my mistake and resolved it. Regards, Amitesh On Tuesday, 12 November, 2019, 2:02:09 AM IST, Kasper Laudrup wrote: Hi Amitesh, In this view: On 11/11/2019 20.36, 'Amitesh Sahay' via Django users wrote: > > def contact(request): >   

Re: reg: Django forms and models

2019-11-11 Thread Kasper Laudrup
Hi Amitesh, In this view: On 11/11/2019 20.36, 'Amitesh Sahay' via Django users wrote: def contact(request): if request.method =='POST': name_r = request.POST.get('name') email_r = request.POST.get('email') phone_r = request.POST.get('phone') comment_r

reg: Django forms and models

2019-11-11 Thread 'Amitesh Sahay' via Django users
Hello Members, I am creating a simple django forms and integrating it with models. I have followed the django docs to perform the task, but I believe that I am doing some mistake due to which I am getting "ValueError at /blog/contact/". Below is the full error stack: Environment: Request Metho

Data validation in both forms and models

2011-12-02 Thread zobbo
itten already to the database. If I change my order lines in admin to add up to 6 my model won't know about those lines until they're written to the database. So I am left with the idea that I have to put my validation rules in a third place - where both my admin forms and models can access th

forms and models

2011-02-04 Thread CrabbyPete
I have the following code: def sites(request): if 'url' in request.GET: url = request.GET['url'] website = WebSite.objects.get( url = url ) form = WebSiteForm(instance = website) return submit_web_form( request, form ) else: form = WebSiteForm(reque

Re: Forms and Models question

2008-03-26 Thread didier rano
It is not my case, because I have only one form, and there is an one-to-many relationship between form and model. 2008/3/26, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > Check out this guide: > http://collingrady.wordpress.com/2008/02/18/editing-multiple-objects-in-django-with-newforms/ > > On Mar

Re: Forms and Models question

2008-03-26 Thread [EMAIL PROTECTED]
Check out this guide: http://collingrady.wordpress.com/2008/02/18/editing-multiple-objects-in-django-with-newforms/ On Mar 26, 3:02 pm, "didier rano" <[EMAIL PROTECTED]> wrote: > Hi, > > I have a model like that: > > REF(Model) > M2(Model): > title > ForeignKey(REF) > > I need to create a fo

Forms and Models question

2008-03-26 Thread didier rano
Hi, I have a model like that: REF(Model) M2(Model): title ForeignKey(REF) I need to create a form with M2Form(Form): title MultipleChoice(REF) This form should generate many M2 with the same title. Is it possible to use NewForms for it ? Didier Rano --~--~-~--~~-

Re: How to stop validations duplications in forms and models?

2008-02-21 Thread shabda
>(the save() method shouldn't raise >any validation errors except those triggered by the database server due >to IntegrityErrors). So what is the recommended place to write validations in models, for now? On Feb 22, 12:25 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-02-21 at

Re: How to stop validations duplications in forms and models?

2008-02-21 Thread Malcolm Tredinnick
On Thu, 2008-02-21 at 08:54 -0800, shabda wrote: > I have some models, and some forms to write data to them. The > attributes in models need to have soem validations, (For example, name > must be alpha numeric, price must be less that 1000 etc). SO I write > the validations in model.save() and ra

How to stop validations duplications in forms and models?

2008-02-21 Thread shabda
I have some models, and some forms to write data to them. The attributes in models need to have soem validations, (For example, name must be alpha numeric, price must be less that 1000 etc). SO I write the validations in model.save() and raise Exceptions, when a validation fails. I also need to wr