and with puttin in de <a href="{{ YOUROBJECT.OBJECTLINKTOZIPFILE
}}">.................would it work???.....because if you have a def on
views.py with http response for the download....and the correct
url.py..should work
El miércoles, 1 de agosto de 2012, 0:03:21 (UTC+2), Tomas Neme escribió:
>
>
> Down here's the code in which I'm creating a zip file with a bunch of pdf
> labels, and returning it on the HttpResponse for the user to DL it.
>
> The weird thing is that I'm getting just a pdf file (ok, I'm testing with
> a single file, so I don't know if that's the problem) and I can't set the
> downloaded filename to anything (it's always "download")
>
> Can someone see what I'm doing wrong?
>
> files = []
> for detail in queryset:
> for parcel in
> detail.parceldescription_set.select_related().all():
> shipment = parcel.shipment
> if not shipment.label:
> try:
> shipment.download_label(args['username'],
> args['password'])
> except Shipment.Wait:
> self.message_user(_("Failed downloading label for "
> "shipment {id} because the "
> "Canada Post server is busy, "
> "please wait a couple of
> minutes "
> "and try again").format(
> id=shipment.id))
> files.append(shipment.label.file)
>
> tmp = tempfile.mkstemp(suffix=".zip")
> tf = zipfile.ZipFile(tmp[1], mode="w")
> for file in files:
> filename = os.path.basename(file.name)
> tf.write(file.name, filename)
> tf.close()
>
> return HttpResponse(open(tmp[1]), mimetype="application/zip")
>
>
> --
> "The whole of Japan is pure invention. There is no such country, there are
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3ca18f90-2bd2-42fd-a27b-faf1cbd570ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.