forgot to mention, that I did HttpResponse(response)
and there was just gibberish displayed...



On Aug 25, 10:00 am, saeb <[EMAIL PROTECTED]> wrote:
> Thanks, I did use form validation as inhttp://dpaste.com/73704/but I
> couldn't get the validation to work. I wasn't sure what I was doing
> wrong, so I resorted to the ad hoc method you are seeing, hoping to
> resolve it once I get the view working. In regards to PDF generation,
> I wasn't sure what I am supposed to do with the response object. I
> want it to be a 2- click process, where user may or may not generate
> the PDF. Can you point me to an example for better idea? I couldn't
> get much out of the documentation.
>
> On Aug 25, 9:02 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
>
> > On Mon, Aug 25, 2008 at 9:01 AM, saeb <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Following is my view.http://dpaste.com/73677/
> > > In the template I have 2 buttons, one is to retrieve results for the
> > > id typed in the input box and other is to generate a PDF of the
> > > results (if user desires). The results are generated fine, but when I
> > > click the generatePDF button it gives a DataError saying -- " invalid
> > > input syntax for integer: ""  ". Can anyone give me a better idea to
> > > achieve this?
>
> > First, you appear to be using Django forms a little but not really.
> > Specifically you are not using them to validate the input, and your ad-hoc
> > checking of  len(request.POST) to see if you have input is likely not doing
> > what you think.  Even if the "user_id" field of your form is left blank, it
> > will be present in request.POST with a value of an empty string.  Your
> > routine would be much cleaner if you take advantage of the built-in
> > validation support of Django forms.
>
> > The DataError "invalid input syntax for integer" is likely coming from the
> > database.  Note when you call gen_pdf (which returns an HttpResponse) you do
> > nothing with the return value and just fall through to the subsequent code.
> > You set deal_avail to true because it's a post and len(request.POST) >= 0
> > (request_id is there, it's an empty string).  When you call:
>
> > deals = Deals.my_manager.get_open_deals(requested_id)
>
> > with requested_id set to the empty string the database complains that an
> > empty string is not a valid integer.
>
> > Karen
--~--~---------~--~----~------------~-------~--~----~
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 more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to