On Jul 30, 1:18 am, Phlip <phlip2...@gmail.com> wrote: > Django aficionados: > > Here's my test code: > > from django.test.client import Client > self.client = Client() > from django.core.files.base import ContentFile > file_content = ContentFile(sample_inventory_update_cvs()) > file_content.name = 'response.csv' > > response = self.client.post( self.url, > data={'csv_file':file_content} ) > > Disregard all that ContentFile nonsense (unless it's causing the bug). > > Inside the action code, I want to distinguish GETting from POSTing. > One paints the page and the other absorbs new form data, as usual. > > However, when I print request.method, I get GET. > > Is this a bug in Client? or in (ahem) my comprehension? > > -- > Phlip > http://c2.com/cgi/wiki?ZeekLand
What's the value of `self.url`? One possibility is that it doesn't end with a slash, and you have the APPEND_SLASH setting set to True (the default), so Django is redirecting from '/foo' to '/foo/'. A redirected POST ends up as a GET. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.