You are not logged in.

Change Language:

Freelancer? Consultant? Check out: WorkTrail - Time Tracking made easy
Profile for Supriya

Name Supriya
Email Address n/a
Posts8
  • 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
  • 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?
  • 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
  • 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.
  • Re: Regarding Foreign keys in models
    Board » Django » Models
    Dear Herbert Poul ,

    Thank you once again. It worked.

    Supriya
  • 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
  • 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
  • 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?



Powered by Sphene Community Tools