On Thu, 2009-10-01 at 08:52 -0700, Val Makykh wrote: > Thanks for advice, Tom. > > I've now followed it and have this exception: > __________ > Environment: > > Request Method: GET > Request URL: http://localhost:8000/results/2/1/ > Django Version: 1.1 > Python Version: 2.6.2 > Installed Applications: > ['django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'mysite.polls', > 'django.contrib.admin', > 'mysite.getindex'] > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware') > > > Traceback: > File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in > get_response > 92. response = callback(request, *callback_args, > **callback_kwargs) > File "C:\Users\Val Malykh\Django-1.1\django\bin\mysite\..\mysite > \getindex\views.py" in results > 83. urlFormSet = baseURLFormSet('url')
Re-read the documentation on formsets: the first positional argument is /NOT/ a string, it is a dictionary of (usually) post data. > File "C:\Python26\lib\site-packages\django\forms\formsets.py" in > __init__ > 44. self._construct_forms() > File "C:\Python26\lib\site-packages\django\forms\formsets.py" in > _construct_forms > 87. for i in xrange(self.total_form_count()): > File "C:\Python26\lib\site-packages\django\forms\formsets.py" in > total_form_count > 66. return self.management_form.cleaned_data > [TOTAL_FORM_COUNT] > File "C:\Python26\lib\site-packages\django\forms\formsets.py" in > _management_form > 53. if not form.is_valid(): > File "C:\Python26\lib\site-packages\django\forms\forms.py" in is_valid > 120. return self.is_bound and not bool(self.errors) > File "C:\Python26\lib\site-packages\django\forms\forms.py" in > _get_errors > 111. self.full_clean() > File "C:\Python26\lib\site-packages\django\forms\forms.py" in > full_clean > 234. value = field.widget.value_from_datadict(self.data, > self.files, self.add_prefix(name)) > File "C:\Python26\lib\site-packages\django\forms\widgets.py" in > value_from_datadict > 170. return data.get(name, None) > > Exception Type: AttributeError at /results/2/1/ > Exception Value: 'str' object has no attribute 'get' > > > On 1 окт, 18:59, Tom Evans <tevans...@googlemail.com> wrote: > > On Thu, 2009-10-01 at 07:26 -0700, Val Makykh wrote: > > > Hello all. > > > > > I use Django 1.1. > > > > > I try to make two formsets on the same page. > > > But when I'm trying to use the data from POST, I have such problem: > > > from POST each formset takes only first form with value. Where have I > > > mistaken? > > > > Have you followed the advice for using more than one formset in a view? > > > > http://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-mor... > > > > Cheers > > > > Tom > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---