Re: form problem
I made the change but now the following error appears: 'QueryDict' object is not callable On Oct 18, 6:43 pm, "Michael P. Jung"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 > >> 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 -~--~~~~--~~--~--~---
Re: form problem
With this method i have the following error: Key 'user_text' not found in What should i change or add to my code? On Oct 18, 5:40 pm, Rama Vadakattu <rama.vadaka...@gmail.com> wrote: > Simple Capture the form variable and send it to another template > > def view(request): > user_text = request.GET['user_text'] > return render_to_reponse("html",{'user_text':user_text}) > > --rama > On Oct 18, 7:26 pm, A_Swtos <sotat...@gmail.com> wrote: > > > > > I have a form like this: > > > > > Text: > > > maxlength="20" /> > > > > > > > The user can type into the form whatever wants.If i press the button > > 'submit' i want to go to a page where it appears what i wrote before. > > Is this possible without saving it into a database? > > What is the code that you propose? > > Im new in django and i would like to tell me all the details that will > > help me, if you can. > > Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
form problem
I have a form like this: Text: The user can type into the form whatever wants.If i press the button 'submit' i want to go to a page where it appears what i wrote before. Is this possible without saving it into a database? What is the code that you propose? Im new in django and i would like to tell me all the details that will help me, if you can. Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: admin url error
Thank you DR for your useful help :) On Oct 12, 2:40 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Oct 12, 11:28 am, A_Swtos <sotat...@gmail.com> wrote: > > > > > > > I'm new in django and i try to do what tutorial says about activating > > the admin site but i take the following error: > > > IndentationError at /admin/ > > ('unexpected indent', ('/home/sotathan/mysite/../mysite/urls.py', 4, > > 1, ' from django.contrib import admin\n')) > > Request Method: GET > > Request URL: http://127.0.0.1:8000/admin/ > > Exception Type: IndentationError > > Exception Value: > > ('unexpected indent', ('/home/sotathan/mysite/../mysite/urls.py', 4, > > 1, ' from django.contrib import admin\n')) > > Exception Location: /usr/local/lib/python2.6/dist-packages/django/ > > utils/importlib.py in import_module, line 35 > > Python Executable: /usr/bin/python > > Python Version: 2.6.2 > > > my code: > > > settings.py: > > ... > > INSTALLED_APPS = ( > > 'django.contrib.admin', > > 'django.contrib.auth', > > 'django.contrib.contenttypes', > > 'django.contrib.sessions', > > 'django.contrib.sites', > > ) > > > urls.py: > > > from django.conf.urls.defaults import * > > > from django.contrib import admin > > admin.autodiscover() > > > urlpatterns = patterns('', > > (r'^admin/', include(admin.site.urls)), > > ) > > > Any help? > > Like the message says, you have indentation problems in urls.py. From > the code you've pasted above, it looks like you've got extra spaces at > the start of these lines: > from django.contrib import admin > admin.autodiscover() > -- > 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-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 -~--~~~~--~~--~--~---
admin url error
I'm new in django and i try to do what tutorial says about activating the admin site but i take the following error: IndentationError at /admin/ ('unexpected indent', ('/home/sotathan/mysite/../mysite/urls.py', 4, 1, ' from django.contrib import admin\n')) Request Method: GET Request URL:http://127.0.0.1:8000/admin/ Exception Type: IndentationError Exception Value: ('unexpected indent', ('/home/sotathan/mysite/../mysite/urls.py', 4, 1, ' from django.contrib import admin\n')) Exception Location: /usr/local/lib/python2.6/dist-packages/django/ utils/importlib.py in import_module, line 35 Python Executable: /usr/bin/python Python Version: 2.6.2 my code: settings.py: ... INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', ) urls.py: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), ) Any help? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---