| Name | Supriya |
|---|---|
| Email Address | n/a |
| Posts | 8 |
-
- 2009-09-11 19:22:49
- upload_file query?
- Board » Django » Views
-
def upload_file(request):
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
handle_uploaded_file(request.FILES['file'])
return HttpResponseRedirect('/success/url/')
else:
form = UploadFileForm()
return render_to_response('upload.html', {'form': form})
Is it necessary to do HttpResponseRedirect in the form.is_valid block? Can't I do render_to_response there. I tried doing it, it posts two request instead of one. Why does it do that?
Thanks,
Supriya
-
- 2009-09-11 13:54:09
- Re: Reading a file from http request from a C++ client
- Board » Django » Views
-
-------------------------------46532461346342
Content-Disposition: form-data; name="file"; filename="fileName.zip"
Content-Type: application/octet-stream
[binary file data]
-------------------------------46532461346342--
And in the hearder
Content-Type: multipart/form-data; boundary=-----------------------------46532461346342
This is the http request that Django is getting. I am trying to read it directly by doing request.FILE('file'). I don't know if I should ask this question here, but is there something wrong with the http request here?
-
- 2009-09-11 12:56:30
- Reading a file from http request from a C++ client
- Board » Django » Views
-
We are trying to interface the C++ client and a Django server. Now I want to read a zip file from the http request sent by the client.
I tried
1. Reading directly through request.FILES[‘file’]. This gives an “Key ‘file’ not found in <MutiValueDict:{}>” error
2. When I check for request.FILES, the condition fails.
Now we are trying to figure out, if the request is incorrect or I need to somehow bind the request file to the request.FILES variable on the server.
Any ideas?
Thanks,
Supriya
-
- 2009-08-11 17:11:36
- group_by query in Django
- Board » Django » Models
-
Hi All,
I have two models
class A(models.model):
Field1
Field2
class B(models.model):
a = models.ForeignKey(A)
I want to get all the entries in model B grouped by a. I was wondering if there is a way to do that in django.
-
- 2009-07-27 11:18:17
- Re: Regarding Foreign keys in models
- Board » Django » Models
-
Dear Herbert Poul ,
Thank you once again. It worked.
Supriya
-
- 2009-07-24 11:03:46
- Regarding Foreign keys in models
- Board » Django » Models
-
Hi Everybody,
I have a query regarding declaring foreign keys for models in Django.
I have two tables A and B. I was wondering if it is possible to have a foreign key of table B in table A and also have a foreign key of table A in table B.
I was trying to do so but it complains about the table that is declared afterwards.
For example
Class A (models.Model):
b = models.ForeignKey (B)
Class B (models.Model):
a = models.ForeignKey (A)
It gives me error that variable B is not defined. And if I declare Class B first it says variable A not defined.
Supriya
-
- 2009-07-24 11:00:28
- Re: How does Django handle multiple http request?
- Board » General Category » General Discussion
-
Hello Herbert,
Thank you very much for your response. It helped a lot. That is exactly what my questions was.
Supriya
-
- 2009-07-23 18:50:26
- How does Django handle multiple http request?
- Board » General Category » General Discussion
-
How does Django handle multiple http request? Do we have to do it in Django code to spawn process?.
I was reading about Django integration with Apache and mod_python, do these handle request?


