class Homepage(FormView): template_name = 'index.html'
def get(self, request, *args, **kwargs): ecg_form = GhanaECGForm() ecg_form.prefix = 'ecg_form'
last_form = FormLastActiveForm() last_form.prefix = 'last_form'
return self.render_to_response(self.get_context_data('ecg_form': ecg_form, 'last_form': last_form))
def post(self, request, *args, **kwargs): ecg_form = GhanaECGForm(self.request.POST, prefix='ecg_form') last_form = FormLastActiveForm(self.request.POST, prefix='last_form')
if ecg_form.is_valid() and last_form.is_valid(): return HttpResponseRedirect('/ta/') else: return self.form_invalid(ecg_form, last_form, **kwargs)
def form_invalid(self, ecg_form, last_form, **kwargs): ecg_form.prefix = 'ecg_form' last_form.prefix = 'last_form' return self.render_to_response(self.get_context_data('ecg_form': ecg_form, 'last_form': last_form))
Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in execute django.setup() File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/apps.py", line 15, in ready dt_settings.patch_all() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 232, in patch_all patch_root_urlconf() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 220, in patch_root_urlconf reverse('djdt:render_panel') File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 550, in reverse app_list = resolver.app_dict[ns] File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 352, in app_dict self._populate() File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 285, in _populate for pattern in reversed(self.url_patterns): File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 402, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 396, in urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/khophi/Developments/DjangoApps/logECG/logECG/urls.py", line 10, in <module> url(r'^', include('main.urls')), File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 33, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/khophi/Developments/DjangoApps/logECG/main/urls.py", line 1, in <module> from . import views File "/home/khophi/Developments/DjangoApps/logECG/main/views.py", line 49 return self.render_to_response(self.get_context_data('ecg_form': ecg_form, 'last_form': last_form))
It looks like you are trying to pass a dict to get_context_data(), but you forgot the surrounding {}.
-James
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2f55833b-829c-4249-9d7f-fc451ee9d84c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.