HOOLY S**T
-- Thanks so much. That was the culprit
On Tuesday, July 28, 2015 at 10:39:16 PM UTC, James Schneider wrote:
On Tuesday, July 28, 2015 at 10:39:16 PM UTC, James Schneider wrote:
It looks like you are trying to pass a dict to get_context_data(), but you forgot the surrounding {}.
-James
On Jul 28, 2015 3:36 PM, "Nkansah Rexford" <seanm...@gmail.com> wrote:I have this:--
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))
The reddened line throws this traceback:
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_lineutility.execute()File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in executedjango.setup()File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setupapps.populate(settings.INSTALLED_APPS)File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populateapp_config.ready()File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/apps.py", line 15, in readydt_settings.patch_all()File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 232, in patch_allpatch_root_urlconf()File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/settings.py", line 220, in patch_root_urlconfreverse('djdt:render_panel')File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 550, in reverseapp_list = resolver.app_dict[ns]File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 352, in app_dictself._populate()File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 285, in _populatefor pattern in reversed(self.url_patterns):File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 402, in url_patternspatterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 396, in urlconf_moduleself._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 includeurlconf_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 viewsFile "/home/khophi/Developments/DjangoApps/logECG/main/views.py", line 49return self.render_to_response(self.get_context_data('ecg_form': ecg_form, 'last_form': last_form))
Honestly, I wish I knew what was wrong. I've got no idea.In sublime, using a python lint, when I click on the line 49, I get the message:[E]: Invalid SyntaxPlease help.
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.
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/16c29149-8699-4f40-91bf-24943fa8dd84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment