Re: How can I achieve this intersection ?

2007-07-08 Thread queezy

Um, I know that you can't make up names and expect them to magically do what 
you wish.  My question was simply how to do the straight Pythonic function 
in a Django manner.

Thanks.


- Original Message - 
From: "SmileyChris" <[EMAIL PROTECTED]>
To: "Django users" <django-users@googlegroups.com>
Sent: Sunday, July 08, 2007 7:24 PM
Subject: Re: How can I achieve this intersection ?


>
> On Jul 9, 5:17 am, queezy <[EMAIL PROTECTED]> wrote:
>> I would like to do this in Django, using two lists that are QuerySet 
>> lists:
>>
>>   mylist=mylistWHOM.intersection(mylistWHAT)
>>
>> When I do it in the Pythonic way above, the django parser complains with:
>> 'QuerySet' object has no attribute 'intersection'
>
> Of course it complains, QuerySets (or lists) don't have a function
> called intersection. You can't just make up a name and expect it to do
> what you want.
> mylistWHOM.invite_them_to_my_party() won't work either.
>
> try something like:
>
> whom = set(mylistWHOM)
> what = set(mylistWHAT)
> mylist = whom & what  # or whom.intersection(what), same thing.
>
>
> > 


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



How can I achieve this intersection ?

2007-07-08 Thread queezy

I would like to do this in Django, using two lists that are QuerySet lists:

  mylist=mylistWHOM.intersection(mylistWHAT)

When I do it in the Pythonic way above, the django parser complains with: 
'QuerySet' object has no attribute 'intersection'

This problem has been dogging me for a few days now and I have tried almost 
everything.

Thanks heaps!

-Nat 


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



Re: How to set up full text field in models.py?

2007-06-07 Thread queezy


Thanks Joseph!  That is what I was doing, but I wondered if there was a 
better way.

Cheers!

-Warren

- Original Message - 
From: "Joseph Heck" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 07, 2007 6:02 PM
Subject: Re: How to set up full text field in models.py?


>
> Nothing built in to Django enables that - you have to do it externally
> to the Django framework.
>
> On 6/7/07, Warvin Barker <[EMAIL PROTECTED]> wrote:
>>
>> Hi!
>>
>> I can set up fulltext indices via MySql directly, but is there a way to 
>> do this in models.py?
>>
>> Thanks!
>>
>> -Warren
>>
>> >
>>
>
> > 


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



Re: Another Django Site with Source Code

2007-06-05 Thread queezy

Wow!  Thanks Kelvin!  That's awesome!!

Sincerely,

-Warren


- Original Message - 
From: "Kelvin Nicholson" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, June 05, 2007 10:14 PM
Subject: Another Django Site with Source Code


>
> Dear all Djangoers:
>
> When I first started learning Django I found the docs
> better-than-average, yet looking at code was the way for me to really
> grasp certain concepts.  Cheeserater (thanks Jacob!) was great to look
> at a way to do voting, Cab (thanks James!) was great to look at how to
> deal with Newforms, Lost-Theories (thanks Jeff!) was great to look at
> the commenting system, and rossp.org's blog tutorials (thanks Ross!)
> were a great starting place.
>
> In order to hopefully help somebody out, I wanted to quickly create a
> site with the sole intention of distributing the source code.  Let me
> take this time to introduce http://www.colddirt.com -- the sinful
> aggregator.
>
> Nothing is too complex, so if you've just started learning Django, feel
> free to look through this code.  Some of the the things I've touched on:
>
> -Django's syndication framework (both simple and a little complex)
> -Sitemap creation
> -Generic views
> -Newforms
> -Searching stuff
> -AJAX usage (one simple and one using JSON serialization)
> -Tagcloud creation
> -FreeComment
>
> To supplement the code I wrote up a five part explanation (maybe I'll
> add more later):
>
> http://www.kelvinism.com/tech-blog/colddirt-information/
>
> If you are just learning, maybe this can help.  If you are a Django
> guru, and see me breaking any best practices, please let me know!
>
> Thanks Django Community,
>
> Kelvin
>
>
>
> > 


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



Re: Newforms and Hidden Fields - verifying POST data

2007-04-23 Thread queezy

Wow!  Simon, thanks for the very specific code - I was having difficulty 
with pickle and your sample code brought everything together so perfectly.

A big thanks to you!

-Warren


- Original Message - 
From: "Simon Willison" <[EMAIL PROTECTED]>
To: "Django users" 
Sent: Monday, April 23, 2007 7:57 PM
Subject: Re: Newforms and Hidden Fields - verifying POST data


>
> On Apr 23, 5:04 pm, Tipan <[EMAIL PROTECTED]> wrote:
>> I'm seeking advice on how to ensure my form data in hidden fields is
>> the same after the user has posted the form.
>
> Sign it. The easiest way to do this would be something like this:
>
> 1. Throw all of the data you want to persist in a pickle, then base64
> it for good measure:
>
> pickled = pickle.dumps(my_data).encode('base64')
>
> 2. Use your secret key to calculate an MD5 signature:
>
> signature = md5.new(SECRET_KEY + pickled).hexdigest()
>
> 3. Serve up the pickled data AND the signature as hidden fields.
>
> Then when the user submits the form again, you can check that they
> haven't tampered with the data by doing this:
>
> pickled = request.POST.get('pickled', '')
> signature = request.POST.get('signature', '')
>
> if pickled:
>if signature != md5.new(SECRET_KEY + pickled).hexdigest():
>raise NastyError, "You tampered with my data!"
>else:
>my_data = pickle.loads(pickled.decode('base64'))
>
> The same technique can be used in lots of other places - cookies for
> example. The only way the user can tamper with the data you have sent
> them is if they know your SECRET_KEY.
>
> Hope that helps,
>
> Simon Willison
>
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-05 Thread queezy

This is great info, especially since our branch may be getting the IT people 
to set up a IIs server (which we don't especially want, but you take what 
you can get).

Thanks a lot!

-Warren

- Original Message - 
From: <[EMAIL PROTECTED]>
To: "Django users" <django-users@googlegroups.com>
Sent: Thursday, April 05, 2007 12:15 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> Thank you very much for this.
>
> Another thing to keep in mind with IE and PDFs is that IE often (but
> not always) cannot correctly identify a document as being a PDF if you
> are using HTTP compression.  Sometimes the PDF will load correctly,
> sometimes you'll get a blank page and sometimes you'll get an error
> message from Acrobat saying it's not a valid PDF file.
>
> This is a problem even if you have the MIME type and everything else
> set correctly.  It is an especially annoying bug if you use IIS as
> your web server because IIS doesn't allow you to turn compression on
> or off on an site basis, only on a global basis.  So if you want to
> serve PDFs with IIS you can't use compression on anything else served
> by IIS either.
>
>
> On Apr 5, 10:55 am, "Mike Axiak" <[EMAIL PROTECTED]> wrote:
>> Apparently there's a bug with IE whereby Vary will hurt Acrobat's
>> ability to view pdfs.
>> Since Vary is ingrained into the souls of many of Django's middleware,
>> I have provided an additional middleware which deletes Vary in times
>> when IE might break because of it.
>> FixIEVaryBugMiddleware is available 
>> athttp://www.djangosnippets.org/snippets/157/
>>
>> Hope this helps you,
>>
>> Mike Axiak
>>
>> On Apr 4, 11:41 pm, queezy <[EMAIL PROTECTED]> wrote:
>>
>> > Ah, the light just went on (finally!).   I will put the http variable 
>> > in
>> > where pdfbytes is found.
>>
>> > Thanks Malcolm!
>>
>> > Cheers!
>>
>> > -Warren
>>
>> > - Original Message -
>> > From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
>> > To: <django-users@googlegroups.com>
>> > Sent: Wednesday, April 04, 2007 6:50 PM
>> > Subject: Re: Django app serves PDFs but browser doesn't render them
>>
>> > > On Wed, 2007-04-04 at 18:46 -0700, queezy wrote:
>> > >> Hi Malcolm!
>>
>> > >> Actually I tried the following (and gave Ned credit for solving half 
>> > >> of
>> > >> my
>> > >> problem):
>>
>> > >> from django.http import HttpResponse
>> > >> from django.shortcuts import render_to_response
>> > >> import urllib
>>
>> > >> def front(request):
>> > >> sock =
>> > >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
>> > >> html = sock.read()
>> > >> sock.close()
>> > >> return HttpResponse(html)
>>
>> > >> def officereport(request):
>> > >> selected_choice = request.POST['office']
>> > >> sock =
>> > >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
>> > >> html = sock.read()
>> > >> sock.close()
>> > >> #   response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> > >> response['Content-Disposition'] = 'attachment;
>> > >> filename='+selected_choice
>> > >>  return response
>>
>> > >> When I comment out the attachment statement, so thepdfis to be 
>> > >> viewed,
>> > >> it
>> > >> doesn't work.  However, when I comment out the non-attachment 
>> > >> version, I
>> > >> get
>> > >> the download box.  That is why previously I said that it solved half 
>> > >> of
>> > >> my
>> > >> problem.
>>
>> > >> That is the case at WebFaction hosting.  When I am at work on a 
>> > >> Linux
>> > >> server
>> > >> there it tells me that "pdfbytes" is undefined.
>>
>> > > That's because it is undefined. Where are you creating the "pdfbytes"
>> > > variable? Do you mean to use the "html" variable there? The error
>> > > message is telling you exactly what is wrong here.
>>
>> > > Malcolm
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-05 Thread queezy

Thanks heaps Mike!

This is a great one to put in the toolbox.  Have a super weekend!

-Warren

- Original Message - 
From: "Mike Axiak" <[EMAIL PROTECTED]>
To: "Django users" <django-users@googlegroups.com>
Sent: Thursday, April 05, 2007 10:55 AM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> Apparently there's a bug with IE whereby Vary will hurt Acrobat's
> ability to view pdfs.
> Since Vary is ingrained into the souls of many of Django's middleware,
> I have provided an additional middleware which deletes Vary in times
> when IE might break because of it.
> FixIEVaryBugMiddleware is available at 
> http://www.djangosnippets.org/snippets/157/
>
> Hope this helps you,
>
> Mike Axiak
>
> On Apr 4, 11:41 pm, queezy <[EMAIL PROTECTED]> wrote:
>> Ah, the light just went on (finally!).   I will put the http variable in
>> where pdfbytes is found.
>>
>> Thanks Malcolm!
>>
>> Cheers!
>>
>> -Warren
>>
>> - Original Message -
>> From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
>> To: <django-users@googlegroups.com>
>> Sent: Wednesday, April 04, 2007 6:50 PM
>> Subject: Re: Django app serves PDFs but browser doesn't render them
>>
>> > On Wed, 2007-04-04 at 18:46 -0700, queezy wrote:
>> >> Hi Malcolm!
>>
>> >> Actually I tried the following (and gave Ned credit for solving half 
>> >> of
>> >> my
>> >> problem):
>>
>> >> from django.http import HttpResponse
>> >> from django.shortcuts import render_to_response
>> >> import urllib
>>
>> >> def front(request):
>> >> sock =
>> >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
>> >> html = sock.read()
>> >> sock.close()
>> >> return HttpResponse(html)
>>
>> >> def officereport(request):
>> >> selected_choice = request.POST['office']
>> >> sock =
>> >> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
>> >> html = sock.read()
>> >> sock.close()
>> >> #   response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> >> response['Content-Disposition'] = 'attachment;
>> >> filename='+selected_choice
>> >>  return response
>>
>> >> When I comment out the attachment statement, so thepdfis to be viewed,
>> >> it
>> >> doesn't work.  However, when I comment out the non-attachment version, 
>> >> I
>> >> get
>> >> the download box.  That is why previously I said that it solved half 
>> >> of
>> >> my
>> >> problem.
>>
>> >> That is the case at WebFaction hosting.  When I am at work on a Linux
>> >> server
>> >> there it tells me that "pdfbytes" is undefined.
>>
>> > That's because it is undefined. Where are you creating the "pdfbytes"
>> > variable? Do you mean to use the "html" variable there? The error
>> > message is telling you exactly what is wrong here.
>>
>> > Malcolm
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-04 Thread queezy


Ah, the light just went on (finally!).   I will put the http variable in 
where pdfbytes is found.

Thanks Malcolm!

Cheers!

-Warren



- Original Message - 
From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
To: <django-users@googlegroups.com>
Sent: Wednesday, April 04, 2007 6:50 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> On Wed, 2007-04-04 at 18:46 -0700, queezy wrote:
>> Hi Malcolm!
>>
>> Actually I tried the following (and gave Ned credit for solving half of 
>> my
>> problem):
>>
>> from django.http import HttpResponse
>> from django.shortcuts import render_to_response
>> import urllib
>>
>> def front(request):
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
>> html = sock.read()
>> sock.close()
>> return HttpResponse(html)
>>
>> def officereport(request):
>> selected_choice = request.POST['office']
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
>> html = sock.read()
>> sock.close()
>> #   response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> response['Content-Disposition'] = 'attachment;
>> filename='+selected_choice
>>  return response
>>
>>
>> When I comment out the attachment statement, so the pdf is to be viewed, 
>> it
>> doesn't work.  However, when I comment out the non-attachment version, I 
>> get
>> the download box.  That is why previously I said that it solved half of 
>> my
>> problem.
>>
>> That is the case at WebFaction hosting.  When I am at work on a Linux 
>> server
>> there it tells me that "pdfbytes" is undefined.
>
> That's because it is undefined. Where are you creating the "pdfbytes"
> variable? Do you mean to use the "html" variable there? The error
> message is telling you exactly what is wrong here.
>
> Malcolm
>
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-04 Thread queezy

Hi Malcolm!

I'm sorry that this seems so obvious but when I use the following line ( 
response = HttpResponse(pdfbytes, mimetype='application/pdf') ) the error is 
that pdfbytes is undefined and I'm just not sure how to define it.  I 
realise that the error is telling me what is wrong, but I don't know what to 
do about it.   I will try defining it as binary and use it and see what 
happens.

My apologies to all for such a trivial problem.

Cheers!

-Warren



- Original Message - 
From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
To: <django-users@googlegroups.com>
Sent: Wednesday, April 04, 2007 6:50 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> On Wed, 2007-04-04 at 18:46 -0700, queezy wrote:
>> Hi Malcolm!
>>
>> Actually I tried the following (and gave Ned credit for solving half of 
>> my
>> problem):
>>
>> from django.http import HttpResponse
>> from django.shortcuts import render_to_response
>> import urllib
>>
>> def front(request):
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
>> html = sock.read()
>> sock.close()
>> return HttpResponse(html)
>>
>> def officereport(request):
>> selected_choice = request.POST['office']
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
>> html = sock.read()
>> sock.close()
>> #   response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> response['Content-Disposition'] = 'attachment;
>> filename='+selected_choice
>>  return response
>>
>>
>> When I comment out the attachment statement, so the pdf is to be viewed, 
>> it
>> doesn't work.  However, when I comment out the non-attachment version, I 
>> get
>> the download box.  That is why previously I said that it solved half of 
>> my
>> problem.
>>
>> That is the case at WebFaction hosting.  When I am at work on a Linux 
>> server
>> there it tells me that "pdfbytes" is undefined.
>
> That's because it is undefined. Where are you creating the "pdfbytes"
> variable? Do you mean to use the "html" variable there? The error
> message is telling you exactly what is wrong here.
>
> Malcolm
>
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-04 Thread queezy

Hi Malcolm!

Actually I tried the following (and gave Ned credit for solving half of my 
problem):

from django.http import HttpResponse
from django.shortcuts import render_to_response
import urllib

def front(request):
sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
html = sock.read()
sock.close()
return HttpResponse(html)

def officereport(request):
selected_choice = request.POST['office']
sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
html = sock.read()
sock.close()
#   response = HttpResponse(pdfbytes, mimetype='application/pdf')
response['Content-Disposition'] = 'attachment; 
filename='+selected_choice
 return response


When I comment out the attachment statement, so the pdf is to be viewed, it 
doesn't work.  However, when I comment out the non-attachment version, I get 
the download box.  That is why previously I said that it solved half of my 
problem.

That is the case at WebFaction hosting.  When I am at work on a Linux server 
there it tells me that "pdfbytes" is undefined.

So I am not sure what to do at this stage.

Sorry for any confusion.

Cheers!

-Warren





- Original Message - 
From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
To: <django-users@googlegroups.com>
Sent: Wednesday, April 04, 2007 6:13 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> On Wed, 2007-04-04 at 17:31 -0700, queezy wrote:
>> Hi!
>>
>> Sorry it took a while - I had to get the info from work.
>>
>> Renderer mode: Quirks mode
>> Cache source: Not cached
>> Encoding: UTF-8
>>
>> The other stuff was blank.
>>
>> My view is as follows:
>>
>> ==  SNIP ==
>> from django.http import HttpResponse
>> from django.shortcuts import render_to_response
>> import urllib
>>
>> def front(request):
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
>> html = sock.read()
>> sock.close()
>> return HttpResponse(html)
>>
>> def officereport(request):
>> selected_choice = request.POST['office']
>> sock =
>> urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
>> html = sock.read()
>> sock.close()
>> return HttpResponse(html)
>
> If this is the method that returns your PDF, the problem is clear. You
> are NOT setting the mimetype. So Django defaults to sending it with an
> HTML mimetype and your browser correctly respects that and tries to
> display the result as if it were an HTML. You have to set the mimetype
> for any non-HTML data. This was mentioned earlier in the thread -- Ned
> even gave you an example.
>
> Regards,
> Malcolm
>
>
>
> > 


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



Re: Django app serves PDFs but browser doesn't render them

2007-04-04 Thread queezy

Hi!

Sorry it took a while - I had to get the info from work.

Renderer mode: Quirks mode
Cache source: Not cached
Encoding: UTF-8

The other stuff was blank.

My view is as follows:

==  SNIP ==
from django.http import HttpResponse
from django.shortcuts import render_to_response
import urllib

def front(request):
sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/templates/officechoice.html")
html = sock.read()
sock.close()
return HttpResponse(html)

def officereport(request):
selected_choice = request.POST['office']
sock = 
urllib.urlopen("/home2/a12007/webapps/officeprofiler/profiler/"+selected_choice)
html = sock.read()
sock.close()
return HttpResponse(html)

==  SNIP ==

So what thoughts are there out there amongst our experts?

Thanks heaps!

-Warren



- Original Message - 
From: "oggie rob" <[EMAIL PROTECTED]>
To: "Django users" <django-users@googlegroups.com>
Sent: Monday, April 02, 2007 9:03 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> Ahh... botched post.
> Anyway, check the Page Info "Type" & post your view method if there
> are still problems.
>
> -rob
>
> On Apr 2, 9:02 pm, "oggie rob" <[EMAIL PROTECTED]> wrote:
>> Try looking at Firefox's "Page Info". That will tell you whether
>> Django or Firefox is the issue. It should say  Why don't you post some
>> of your view method. It might be
>>
>> On Apr 2, 7:27 pm, queezy <[EMAIL PROTECTED]> wrote:
>>
>> > Hi All!
>>
>> > I used response = HttpResponse(pdfbytes, 
>> > mimetype='application/pdf') in my view (of course returning the 
>> > response var) and firefox still has issues - it shows pdfbytes instead 
>> > of rendering.
>>
>> > Is there anything more that I should be doing to make this work with 
>> > firefox?  I am sure that the secret to success with this is in these 
>> > lines that Ned provided.
>>
>> > Thanks so much!!
>>
>> > -Warren
>>
>> >   - Original Message -
>> >   From: Ned Batchelder
>> >   To: django-users@googlegroups.com
>> >   Sent: Monday, April 02, 2007 6:50 PM
>> >   Subject: Re: Django app serves PDFs but browser doesn't render them
>>
>> >   We serve PDFs, both in-browser, and out.  Here the lines to set the 
>> > type and disposition:
>>
>> >   response = HttpResponse(pdfbytes, mimetype='application/pdf')
>> >   response['Content-Disposition'] = 'attachment; filename=foo.pdf'
>> >   return response
>>
>> >   Here pdfbytes are the actual bytes of the PDF file.  With the 
>> > Content-Disposition line, Firefox will display the Save As dialog to 
>> > save the file someplace.  Without that line, the PDF is displayed in 
>> > the browser.
>>
>> >   --Ned.
>>
>> >   Malcolm Tredinnick wrote:
>> > On Mon, 2007-04-02 at 18:02 -0700, queezy wrote:
>> >   Hi All!
>>
>> > We have a Django application that uses a form to allow users to select
>> > offices and it sends them off to a pdf.  At the present time we are 
>> > using
>> > FireFox on a Linux box and we are just using the Django loopback server 
>> > for
>> > the time being.  This means that we don't have a secondary, or even a
>> > primary instance of Apache working for us.
>>
>> > So when you select an office and the pdf is served up you see binary 
>> > codes
>> > dumped on your screen.
>>
>> > That sounds like you haven't set the mimetype correctly. Firefox should
>> > ask what application to use for anything it can't render natively. The
>> > fact that you are seeing bytes sent to the screen suggests you are
>> > sending it across with the HTML or some text-derivative mimetype so 
>> > that
>> > Firefox things it should display this directly.
>>
>> >   By itself, if I fire up FireFox and go to the pdfs, I am prompted for 
>> > what
>> > viewer to use, and choose postscript viewer and all is well.  So the 
>> > browser
>> > is capable of rendering pdfs properly.
>>
>> > Any constructive comments on this?  Any advice on getting the browser 
>> > to
>> > actually render the pdfs?
>>
>> > Browsers usually (I was going to say always, but I'm not sure what
>> > native-PDF-underneath-MacOS does) hand off PDF rendering to a
>> > third-party app. Sometimes that third-party app it is con

Re: Django app serves PDFs but browser doesn't render them

2007-04-02 Thread queezy
Hi All!

I used response = HttpResponse(pdfbytes, mimetype='application/pdf') in my 
view (of course returning the response var) and firefox still has issues - it 
shows pdfbytes instead of rendering.

Is there anything more that I should be doing to make this work with firefox?  
I am sure that the secret to success with this is in these lines that Ned 
provided.

Thanks so much!!

-Warren


  - Original Message - 
  From: Ned Batchelder 
  To: django-users@googlegroups.com 
  Sent: Monday, April 02, 2007 6:50 PM
  Subject: Re: Django app serves PDFs but browser doesn't render them


  We serve PDFs, both in-browser, and out.  Here the lines to set the type and 
disposition:

  response = HttpResponse(pdfbytes, mimetype='application/pdf')
  response['Content-Disposition'] = 'attachment; filename=foo.pdf'
  return response

  Here pdfbytes are the actual bytes of the PDF file.  With the 
Content-Disposition line, Firefox will display the Save As dialog to save the 
file someplace.  Without that line, the PDF is displayed in the browser.

  --Ned.

  Malcolm Tredinnick wrote: 
On Mon, 2007-04-02 at 18:02 -0700, queezy wrote:
  Hi All!

We have a Django application that uses a form to allow users to select 
offices and it sends them off to a pdf.  At the present time we are using 
FireFox on a Linux box and we are just using the Django loopback server for 
the time being.  This means that we don't have a secondary, or even a 
primary instance of Apache working for us.

So when you select an office and the pdf is served up you see binary codes 
dumped on your screen.

That sounds like you haven't set the mimetype correctly. Firefox should
ask what application to use for anything it can't render natively. The
fact that you are seeing bytes sent to the screen suggests you are
sending it across with the HTML or some text-derivative mimetype so that
Firefox things it should display this directly.

  By itself, if I fire up FireFox and go to the pdfs, I am prompted for what 
viewer to use, and choose postscript viewer and all is well.  So the browser 
is capable of rendering pdfs properly.

Any constructive comments on this?  Any advice on getting the browser to 
actually render the pdfs?

Browsers usually (I was going to say always, but I'm not sure what
native-PDF-underneath-MacOS does) hand off PDF rendering to a
third-party app. Sometimes that third-party app it is configured as a
browser plugin.

I personally have no experience to share here because I prefer to use an
external app for PDF rendering, as my browser window is not the right
size for viewing generated-for-print-page documents, so I like being
able to resize them separately.

Regards,
Malcolm






  

-- 
Ned Batchelder, http://nedbatchelder.com

  

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



Re: Django app serves PDFs but browser doesn't render them

2007-04-02 Thread queezy
Very cool!

Thanks so much, Ned!!   Certainly this will do the trick.  ( I have a demo of 
this app coming up on Thursday and it would be great if I could actually show 
the pdfs rendered.)

Sincerely,

-Warren


  - Original Message - 
  From: Ned Batchelder 
  To: django-users@googlegroups.com 
  Sent: Monday, April 02, 2007 6:50 PM
  Subject: Re: Django app serves PDFs but browser doesn't render them


  We serve PDFs, both in-browser, and out.  Here the lines to set the type and 
disposition:

  response = HttpResponse(pdfbytes, mimetype='application/pdf')
  response['Content-Disposition'] = 'attachment; filename=foo.pdf'
  return response

  Here pdfbytes are the actual bytes of the PDF file.  With the 
Content-Disposition line, Firefox will display the Save As dialog to save the 
file someplace.  Without that line, the PDF is displayed in the browser.

  --Ned.

  Malcolm Tredinnick wrote: 
On Mon, 2007-04-02 at 18:02 -0700, queezy wrote:
  Hi All!

We have a Django application that uses a form to allow users to select 
offices and it sends them off to a pdf.  At the present time we are using 
FireFox on a Linux box and we are just using the Django loopback server for 
the time being.  This means that we don't have a secondary, or even a 
primary instance of Apache working for us.

So when you select an office and the pdf is served up you see binary codes 
dumped on your screen.

That sounds like you haven't set the mimetype correctly. Firefox should
ask what application to use for anything it can't render natively. The
fact that you are seeing bytes sent to the screen suggests you are
sending it across with the HTML or some text-derivative mimetype so that
Firefox things it should display this directly.

  By itself, if I fire up FireFox and go to the pdfs, I am prompted for what 
viewer to use, and choose postscript viewer and all is well.  So the browser 
is capable of rendering pdfs properly.

Any constructive comments on this?  Any advice on getting the browser to 
actually render the pdfs?

Browsers usually (I was going to say always, but I'm not sure what
native-PDF-underneath-MacOS does) hand off PDF rendering to a
third-party app. Sometimes that third-party app it is configured as a
browser plugin.

I personally have no experience to share here because I prefer to use an
external app for PDF rendering, as my browser window is not the right
size for viewing generated-for-print-page documents, so I like being
able to resize them separately.

Regards,
Malcolm






  

-- 
Ned Batchelder, http://nedbatchelder.com

  

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



Re: Django app serves PDFs but browser doesn't render them

2007-04-02 Thread queezy

Thanks Malcolm!  Your post does tell me that one route might be a plugin.

I also figure that Django could send a signal of some sort to the browser.

So your post is helpful!

-Warren


- Original Message - 
From: "Malcolm Tredinnick" <[EMAIL PROTECTED]>
To: <django-users@googlegroups.com>
Sent: Monday, April 02, 2007 6:35 PM
Subject: Re: Django app serves PDFs but browser doesn't render them


>
> On Mon, 2007-04-02 at 18:02 -0700, queezy wrote:
>> Hi All!
>>
>> We have a Django application that uses a form to allow users to select
>> offices and it sends them off to a pdf.  At the present time we are using
>> FireFox on a Linux box and we are just using the Django loopback server 
>> for
>> the time being.  This means that we don't have a secondary, or even a
>> primary instance of Apache working for us.
>>
>> So when you select an office and the pdf is served up you see binary 
>> codes
>> dumped on your screen.
>
> That sounds like you haven't set the mimetype correctly. Firefox should
> ask what application to use for anything it can't render natively. The
> fact that you are seeing bytes sent to the screen suggests you are
> sending it across with the HTML or some text-derivative mimetype so that
> Firefox things it should display this directly.
>
>> By itself, if I fire up FireFox and go to the pdfs, I am prompted for 
>> what
>> viewer to use, and choose postscript viewer and all is well.  So the 
>> browser
>> is capable of rendering pdfs properly.
>>
>> Any constructive comments on this?  Any advice on getting the browser to
>> actually render the pdfs?
>
> Browsers usually (I was going to say always, but I'm not sure what
> native-PDF-underneath-MacOS does) hand off PDF rendering to a
> third-party app. Sometimes that third-party app it is configured as a
> browser plugin.
>
> I personally have no experience to share here because I prefer to use an
> external app for PDF rendering, as my browser window is not the right
> size for viewing generated-for-print-page documents, so I like being
> able to resize them separately.
>
> Regards,
> Malcolm
>
>
> > 


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



Django app serves PDFs but browser doesn't render them

2007-04-02 Thread queezy

Hi All!

We have a Django application that uses a form to allow users to select 
offices and it sends them off to a pdf.  At the present time we are using 
FireFox on a Linux box and we are just using the Django loopback server for 
the time being.  This means that we don't have a secondary, or even a 
primary instance of Apache working for us.

So when you select an office and the pdf is served up you see binary codes 
dumped on your screen.

By itself, if I fire up FireFox and go to the pdfs, I am prompted for what 
viewer to use, and choose postscript viewer and all is well.  So the browser 
is capable of rendering pdfs properly.

Any constructive comments on this?  Any advice on getting the browser to 
actually render the pdfs?

Thanks heaps!

-Warren 


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



Re: Using a numeric POST in Newforms to serve a URL (You'd think that this would be easy. )

2007-04-01 Thread queezy

Hi Anders!

Thanks a lot!!  This is exactly what I need.

Sincerely,

-Warren

- Original Message - 
From: "anders conbere" <[EMAIL PROTECTED]>
To: <django-users@googlegroups.com>
Sent: Sunday, April 01, 2007 11:54 AM
Subject: Re: Using a numeric POST in Newforms to serve a URL (You'd think 
that this would be easy. )


>
> are you just looking for how to access post variables?
>
> request.POST is a dictionary that stores the post variables.
>
> if you want to access some id you post to the view you just do something 
> like
>
> if request.POST:
>request.POST['id']
>
> On 4/1/07, queezy <[EMAIL PROTECTED]> wrote:
>>
>> Hi!
>>
>> I think (but I could be mistaken) that the article suggested on this is
>> about going to different URLs.  However, I want to just use newforms and,
>> based on a simple form, POST a numeric.  Upon arrival at the view (which 
>> is
>> the SAME view for all form choices) the user is served up a PDF based on 
>> the
>> numeric sent.  So if the user clicks on the form for a report for Office
>> 110, a "110" is posted and the user is shown 110.pdf.
>>
>> So it is dead simple, but seemingly difficult to accomplish in Django.
>>
>> Is there a pretty straightforward way to just POST a numeric and, based 
>> on
>> that, serve a URL?
>>
>> Thanks a lot!
>>
>> -Warren
>>
>>
>> >
>>
>
> > 


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



Re: Using a numeric POST in Newforms to serve a URL (You'd think that this would be easy. )

2007-04-01 Thread queezy

Hi!

I think (but I could be mistaken) that the article suggested on this is 
about going to different URLs.  However, I want to just use newforms and, 
based on a simple form, POST a numeric.  Upon arrival at the view (which is 
the SAME view for all form choices) the user is served up a PDF based on the 
numeric sent.  So if the user clicks on the form for a report for Office 
110, a "110" is posted and the user is shown 110.pdf.

So it is dead simple, but seemingly difficult to accomplish in Django.

Is there a pretty straightforward way to just POST a numeric and, based on 
that, serve a URL?

Thanks a lot!

-Warren 


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



Problem figuring out generic view with drop down box

2007-04-01 Thread queezy

Hi!

I have this: http://somewebaddress/; method="POST">
and then this:

   
  Click here to 
choose
  100 Dummy Entry 1
  106 Dummy Entry 2
  107 Dummy Entry 3


So it is a drop-down box with office numbers.  The idea is that it goes to 
urls.py:

from django.views.generic.simple import redirect_to
urlpatterns = patterns('django.views.generic.simple',
   (r'^$', front),
   (r'^(?P\d+)/$', 'redirect_to', {'url': '/%(id)s.pdf'}),
   )

However this cannot work as it goes to the url and tries to pass the 
variable "office" with a given value.  However, when it goes it ends up at 
the url which has nothing after it (because it isn't a GET but a POST) and 
it uses the url pattern "front" to just display the form again.

So I am not seeing how to pass variables and values via POST within the 
Django framework.   Can someone suggest alternative code above so that this 
would work?

Thanks so much!

-Warren 


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



Re: Django-0.96 hosting available at WebFaction

2007-03-24 Thread queezy

WOW!  Cool, Remi - I'm already a member (a12007 is my ID) and I will 
activate Django later today!!

Cheers!

-Warren


- Original Message - 
From: "Remi" <[EMAIL PROTECTED]>
To: "Django users" 
Sent: Saturday, March 24, 2007 10:47 AM
Subject: ANN: Django-0.96 hosting available at WebFaction


>
> Hi everyone,
>
> I'm happy to announce that WebFaction have added Django-0.96 to
> their one-click installer.
> We've also upgraded MySQLdb to version 1.2.2 on all of our servers
> because the previous version we had wasn't compatible with the
> new Django version.
>
> Remi
>
> http://www.webfaction.com - Hosting for an agile web.
>
>
> > 


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