Closed brberis closed 6 years ago
Sorry I put models.py but I meant forms.py
What is 'QuickContactPlugins'?
Hello,
class TemplatePrefixMixin(object):
def get_render_template(self, context, instance, placeholder):
return self.render_template
class QuickContactPlugins(TemplatePrefixMixin, CMSPluginBase):
module = 'RE Plugins'
in
....
....
class PluginEditModeMixin(object):
def get_edit_mode(self, request):
return (
hasattr(request, 'toolbar') and request.toolbar and
request.toolbar.edit_mode)
class ContactCMSPlugin(CMSPlugin):
cmsplugin_ptr = models.OneToOneField(
CMSPlugin, related_name='+', parent_link=True)
class Meta:
abstract = True
class QuickContactPlugin(PluginEditModeMixin,
ContactCMSPlugin):
quick_contact = models.ForeignKey(QuickContactForm, blank=True,
help_text=_('Select form to show')
)
def get_form_info(self, request):
queryset = QuickContactForm.objects
queryset = QuickContactForm.objects.get(name = self.quick_contact)
return queryset
OK, I see nowhere in your class hierarchy where you include the FormPluginBase.
This can be imported from from cmsplugin_form_handler.cms_plugins import FormPluginBase
In your code above, change the base class for ContactCMSPlugin
from CMSPlugin
to FormPluginBase
.
Oops.. Thanks. Now I'm stuck with this error:
Request Method: | POST
-- | --
/es/plugin_forms/50/
1.11.12
TypeError
argument of type 'NoneType' is not iterable
/home/projects/castorgc/lib/python3.4/site-packages/django/shortcuts.py in resolve_url, line 153
/home/projects/castorgc/bin/python3
3.4.3
Traceback:
File "/home/projects/castorgc/lib/python3.4/site-packages/django/shortcuts.py" in resolve_url
147. return reverse(to, args=args, kwargs=kwargs)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/urls/base.py" in reverse
91. return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
File "/home/projects/castorgc/lib/python3.4/site-packages/django/urls/resolvers.py" in _reverse_with_prefix
497. raise NoReverseMatch(msg)
During handling of the above exception (Reverse for 'None' not found. 'None' is not a valid view function or pattern name.), another exception occurred:
File "/home/projects/castorgc/lib/python3.4/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/views/generic/base.py" in view
68. return self.dispatch(request, *args, **kwargs)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/views/generic/base.py" in dispatch
88. return handler(request, *args, **kwargs)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/views/generic/edit.py" in post
185. return self.form_invalid(form)
File "/home/projects/castorgc/lib/python3.4/site-packages/cmsplugin_form_handler/views.py" in form_invalid
112. return redirect(url)
File "/home/projects/castorgc/lib/python3.4/site-packages/django/shortcuts.py" in redirect
56. return redirect_class(resolve_url(to, *args, **kwargs))
File "/home/projects/castorgc/lib/python3.4/site-packages/django/shortcuts.py" in resolve_url
153. if '/' not in to and '.' not in to:
Exception Type: TypeError at /es/plugin_forms/50/
Exception Value: argument of type 'NoneType' is not iterable
Looks like you haven't defined a success URL. Have a look at the documentation, specifically here.
Description:
Hi, I get this error when the form is submited:
cms_plugins.py
models.py
Any thoughts? and Thanks!