I made the change but now the following error appears: 'QueryDict' object is not callable
On Oct 18, 6:43 pm, "Michael P. Jung" <mpj...@terreon.de> wrote: > First of all may I recommend you to use Django forms: > > http://docs.djangoproject.com/en/dev/topics/forms/ > > > With this method i have the following error: > > Key 'user_text' not found in <QueryDict: {}> > >> def view(request): > >> user_text = request.GET['user_text'] > >> return render_to_reponse("....html",{'user_text':user_text}) > > When requesting the view for the first time the request.GET dict will > not contain a 'user_text'. If you replace request.GET['user_text'] by > request.GET('user_text', '') it will not raise an exception, but return > '' (empty string) if no 'user_text' is contained in the GET dict. > > Besides it's good practice to use POST for forms, if they're used to > submit new or modify existing data. That's the reason why the example > code in the forms documentation always checks for request.method == > 'POST' to see if the form is actually being submitted or loaded for the > first time. > > In order to get the idea of POST and GET better you might be best of > googeling for it and reading up what the HTTP methods are supposted to > be used for. Rule of thumb: Use POST whenever you're modifying data and > GET when querying data. > > --mp --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---