maccesch / cmsplugin-contact Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rtpm/cmsplugin_contact
Extendable contact plugin for django-cms with spam protection and i18n
License: BSD 2-Clause "Simplified" License
This project forked from rtpm/cmsplugin_contact
Extendable contact plugin for django-cms with spam protection and i18n
License: BSD 2-Clause "Simplified" License
Currently untranslated error message is:
The words you entered did not match the image
The dot is missing at the end. This is ugly. ;-) But if we change this, also translations have to be changed. It is OK if I change this?
I have an issue and cannot load a form from a custom template.
I use a subclass for ContactForm to overwrite the template class variable to something like "bootstrap/contactform.html
" and register the alternative form in the project's settings file as described in the docs. However, no matter what I do, only the standard template "cmsplugin_contact/contact.html
" is loaded.
If I look into cms_plugins.py
it seems to me that the render
method of the ContactPlugin
class does not change its own render_template
variable but only the plugin instance's variable. (Actually I am not sure why this is not the same.) With a quick and dirty check I get the desired result if I add the line self.render_template = instance.render_template
after line 167 if file cms_plugins.py
. Can you check this?
Thanks very much! Fabian
Hi,
I'm trying to update my website running django-cms 2.4.2 with the latest version of cmsplugin-contact and occured the error bellow
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/cms/views.py", line 148, in details
return render_to_response(template_name, context_instance=context)
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 176, in render_to_string
return t.render(context_instance)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 140, in render
return self._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 123, in render
return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/classytags/core.py", line 106, in render
return self.render_tag(context, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/sekizai/templatetags/sekizai_tags.py", line 76, in render_tag
rendered_contents = nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 62, in render
result = block.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/classytags/core.py", line 106, in render
return self.render_tag(context, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cms/templatetags/cms_tags.py", line 264, in render_tag
content = get_placeholder_content(context, request, page, name, inherit)
File "/usr/local/lib/python2.7/dist-packages/cms/templatetags/cms_tags.py", line 182, in get_placeholder_content
content = render_placeholder(placeholder, context, name)
File "/usr/local/lib/python2.7/dist-packages/cms/plugin_rendering.py", line 127, in render_placeholder
content.extend(render_plugins(plugins, context, placeholder, processors))
File "/usr/local/lib/python2.7/dist-packages/cms/plugin_rendering.py", line 81, in render_plugins
out.append(plugin.render_plugin(context, placeholder, processors=processors))
File "/usr/local/lib/python2.7/dist-packages/cms/models/pluginmodel.py", line 173, in render_plugin
context = plugin.render(context, instance, placeholder_slot)
File "/home/blabla/production/web_app/portal/src/cmsplugin-contact/cmsplugin_contact/cms_plugins.py", line 150, in render
form = self.create_form(instance, request)
File "/home/blabla/production/web_app/portal/src/cmsplugin-contact/cmsplugin_contact/cms_plugins.py", line 82, in create_form
ContactFormBase = class_for_path(instance.form_layout)
File "/home/blabla/production/web_app/portal/src/cmsplugin-contact/cmsplugin_contact/utils.py", line 6, in class_for_path
module_name, class_name = class_path.rsplit(".", 1)
ValueError: need more than 1 value to unpack
I'm running with django 1.4.7, python 2.7.3, ubuntu 12.04 and mysql 5.1
Any Ideas?
I realize that whenever I refresh the page localhost/contact/ the browser prompts me a form resubmission warning. Doesn't the plugin redirect after rendering the form. The same goes to when the form is submitted and the thank you message is displayed.
Is it something I need to configure or is it a bug?
Thanks
I often see that the re-captcha image contains only one word, but the text reads as follows:
"Please enter the two words on the image separated by a space:"
My suggestion is to change that text that works regardless of the words that appear on the image.
Cheers
i have a litle modifed plugin and customized plugins installed in cms.
if customized plugin enabled UWSGI falls..
Hi There,
Under the message box I get a bunch of HTML where the captcha should be. It looks like this:
<script> var RecaptchaOptions = { theme: 'clean' }; </script> <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LeTmMMSAAAAAObtPtIT-0rewsCeWAlQAF1E42TB"></script> <iframe src="http://www.google.com/recaptcha/api/noscript?k=6LeTmMMSAAAAAObtPtIT-0rewsCeWAlQAF1E42TB" height="300" width="500" frameborder="0"></iframe>Also please note that when i first tried to create the contact form in admin it would not let me proceed because it said a field was missing but would not tell me what field it was missing. Once I added the RECAPTCHA_PUBLIC_KEY & RECAPTCHA_PRIVATE_KEY to settings.py it allowed me to create the form. However it will not work.
Any thoughts?
"CSRF verification failed. Request aborted" and so on... Unfortunately cannot test under ios/android circumstances. But it all goes somewhere here.
Strange, that it isn't thrown on the desktop.
Most of public servers reject "mail from" different with connection account (or not confirmed in it).
For these need to keep only "reply to" with email from form, but in "sender" need to be email from settings.
Hi,
I know this issue was opened before twice and I went over those issues but still couldn't get the plugin to show up.
I'm on Django 1.3, Python 2.6.6 and tried versions 0.9.7, 0.9.8 and latest.
Also tried installing stopspam but it doesn't show up either.
Could you publish an up-to-date list of steps of how to get this working?
Thanks!
~Y
Line 67 in contact.html should be {{ form.accept_terms|safe }} not {{ form.accept_terms }}.
Thanks! Great plugin!
Hi
I have install the plugin an im getting exactly the error below:
"Sending the message using the user-supplied address to set From: header of the email is currently not supported. This is because many servers will reject emails that use From: addresses not registered with that server."
When filling the form the user-supplied address in being place as the from header of the email.
any ideas?
Cheers,
Hello,
I would like to ask if someone would be willing to write a few lines. It does not have to be 200 pages long just maybe a page or two what someone has to do after downloading, installing and syncing the db.
Sorry if this is the wrong section for such a request still new to github
kind regards
ed-Media
Michael
Edit:
Well I have read the cms-tutorial but somehow I'm missing something...
I did what you wrote in your read me
But what do I have to do now? You said something about placeholders.
In the Read me it says admin interface? Does that mean localhost:8000/admin ?
Hi,
I am using your plugin and noticed that after an update it stopped working for me. I've looked at the form and noticed that it passes that some field is missing. After inspection I found that form is not valid because of id_my_name field.
Quick search gave this
Contact form name is required, while in editing form in cms it's marked as not required. Not sure about your plans, but it would be great if ether form would require this field since without it does not send emails due to invalid form or you would changed that to handle empty form name.
It looks like it's missing from there, while 1.1.0 is available.
Plugin is not available.
Django-1.2.4
Latest Django-cms
akismet-0.2.0
I use virtualenv, if this is relevant
Hi guys, I have two simple (or not) questions :)
$.ajax({
url : "/",
type : "POST",
data : { SOME_KEY_?? : $('#contact-form').val() },
success : function(json) {
console.log(json);
console.log("success");
},
// handle a non-successful response
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText);
}
});
I have django-cms 3 with django 1.6 and 'djangocms_text_ckeditor' in INSTALLES_APPS.
Although the in docs it is stated that "If you have the package 'djangocms_text_ckeditor' in your INSTALLES_APPS CKEditor is used", I am getting errors about 'USE_TINYMCE'
Hi,
Do you plan to release a tag soon to be able to use pip ?
Error when rendering {% cms_toolbar %}:
Reverse for 'cms_usersettings_change' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
pip freeze:
Django==1.6.5
Pillow==2.4.0
South==0.8.4
argparse==1.2.1
cmsplugin-contact==1.0.0
django-classy-tags==0.5.1
django-cms==3.0.2
django-mptt==0.6.0
django-polymorphic==0.5.5
django-sekizai==0.7
djangocms-admin-style==0.2.2
djangocms-file==0.0.1
djangocms-flash==0.0.2
djangocms-googlemap==0.0.5
djangocms-inherit==0.0.1
djangocms-link==1.3.4
djangocms-picture==0.0.2
djangocms-snippet==1.0.2
djangocms-teaser==0.0.1
djangocms-text-ckeditor==2.1.4
djangocms-video==0.0.1
easy-thumbnails==2.0.1
html5lib==0.999
six==1.6.1
wsgiref==0.1.2
Installed 1.1.2 and ran the migration with MIGRATION_MODULES
set up.
I can't create a contact page. Is this related to #63?
It looks like your most recent update changed the recaptcha libary to use django-nocaptcha-recaptcha
. You should probably change the validation here: https://github.com/maccesch/cmsplugin-contact/blob/master/cmsplugin_contact/admin.py#L60 to use that library instead of the deprecated recaptcha-client
See #33
Hi, the setup instructions are missing the 'migrate' step so that tables are created in the database.
We shoud use the safe method in the both .txt templates to prevent for ascii chars in the contact emails.
The code sending the content from the form as text/plain MIME what should not get to problems in Email Clients.
What you think?
I have this error when I run manage.py makemigrations
File "/home/opt/python-virtual-env/django-cms/lib/python3.7/site-packages/cmsplugin_contact/migrations/0003_auto__add_field_contact_form_name.py", line 3, in <module>
from south.db import db
File "/home/opt/python-virtual-env/django-cms/lib/python3.7/site-packages/south/db/__init__.py", line 84, in <module>
db = dbs[DEFAULT_DB_ALIAS]
KeyError: 'default'
Hello!
Could you change models.py a little and convert Contact class into abstract class? Something like
class BaseContact(CMSPlugin):
class Meta:
abstract = True
# all fields here
class Contact(BaseContact):
pass
I'd like to add more fields into my contact form, but I can't subclass non abstract model. Django CMS doesn't allow it. After that change I could subclass BaseContact and add more fileds into my new subclassed model.
Also, it would be nice to change cms_plugin.ContactPlugin for easier subclassing. May be something like
class ContactPlugin(CMSPluginBase):
contact_form = ContactForm
email_template = "cmsplugin_contact/email.txt"
def create_form(self, instance, request):
if instance.get_spam_protection_method_display() == 'Akismet':
AkismetContactForm.aksimet_api_key = instance.akismet_api_key
class ContactForm(self.contact_form, AkismetContactForm):
pass
FormClass = ContactForm
elif instance.get_spam_protection_method_display() == 'ReCAPTCHA':
RecaptchaContactForm.recaptcha_public_key = getattr(
settings, "RECAPTCHA_PUBLIC_KEY",
instance.recaptcha_public_key)
RecaptchaContactForm.recaptcha_private_key = getattr(
settings, "RECAPTCHA_PRIVATE_KEY",
instance.recaptcha_private_key)
RecaptchaContactForm.recaptcha_theme = instance.recaptcha_theme
class ContactForm(self.contact_form, RecaptchaContactForm):
pass
FormClass = ContactForm
else:
class ContactForm(self.contact_form, HoneyPotContactForm):
pass
FormClass = ContactForm
if request.method == "POST":
return FormClass(request, data=request.POST)
else:
return FormClass(request)
def send(self, form, site_email):
subject = form.cleaned_data['subject']
if not subject:
subject = _('No subject')
email_message = EmailMessage(
render_to_string("cmsplugin_contact/subject.txt", {
'subject': subject,
}),
render_to_string(self.email_template, {
'data': form.cleaned_data,
}),
form.cleaned_data['email'],
[site_email],
headers = {
'Reply-To': form.cleaned_data['email']
},)
email_message.send(fail_silently=True)
In this case anyone can subclass ContactPlugin and override model, form, contact_form and email_template properties without copying some code from ContactPlugin.
Thank you!
Hello, great plugin!
I am having an issue with the ReCaptcha javascript being unencoded when the page renders.
The javascript gets rendered inside
tags and has all < and > tangs converted to < and &rt;Any ideas as to how to solve this?
Thanks!
Google introduced a new reCaptcha
https://www.google.com/recaptcha/intro/index.html
It would be great if this plugin supported it. I guess one needs to change the according
recaptcha-client, or maybe switch to
https://github.com/2degrees/python-recaptcha instead?
C:\Python27\lib\site-packages\cmsplugin_contact-1.1.1-py2.7.egg\cmsplugin_contact\admin.py:15: RemovedInDjango18Warning: Creating a ModelForm without either the 'fields' attribute or th
e 'exclude' attribute is deprecated - form ContactAdminForm needs updating
class ContactAdminForm(ModelForm):
When having multiple forms on one page, configured to send e-mail to different contacts, a post in one form sends the message to all contacts.
Example: one contact form for tech@... and one for customerservice@...
Both recipients will receive the message no matter what form was posted to.
Django told me the models aren't in sync, please take a look at this
$ python manage.py makemigrations --dry-run
Migrations for 'cmsplugin_contact':
0002_auto_20160225_1709.py:
- Alter field form_layout on contact
- Alter field recaptcha_theme on contact
- Alter field site_email on contact
- Alter field spam_protection_method on contact
Thanks!
I'm trying to upgrade a project that uses cmsplugin-contact
to Django 1.8.4 and django CMS 3.1.2 (using Python 2.7.5+ on Ubuntu).
Django 1.8 has introduced changes to the templates (multiple template engine support), and this seems to break backwards compatibility. I now get the following error with cmsplugin-contact==1.1.0
when I run python manage.py runserver
:
...
File "<site-packages>/cmsplugin_contact/cms_plugins.py", line 8, in <module>
from django.template.loader import render_to_string, find_template, TemplateDoesNotExist
ImportError: cannot import name find_template
I've done a quick research, but no solution so far where find_template()
has gone in 1.8 and what to use instead (if applicable). Here are some links I found:
Hi
is the pypi with the latest version of the code ?
I've managed to install it from zip in my local machine with your latest "from email changes " but I can't do the same on my heroku app.
Do you have any idea how I can install it manually on heroku or are planning to update the pypi soon ?
Thanks,
I love this plugin, but wish there was a 'proposed way with best practices' to get the custom plugin showing up.
I know 'everyone' does it differently, but I would really love a plugin that is easy to install and covers many use cases. Maybe it's even better to include a few different use case that are ready to plugin pluggable. I know it's hard for model-based apps, but how many different contact-form variations are out there? Usually I need no more than 3 fields displayed to the end user, mine just happens to be:
And the default here is:
I'm thinking: keep 4 fields (or more) and use and admin template choice to display only some.
I'm happy to help out where I can. Just wanted to start a discussion.
with * == (public|private)
, of course
The form class uses self.recaptcha_*_key
as preferred value, falling back to settings.RECAPTCHA_*_KEY
when it's absent.
https://github.com/maccesch/cmsplugin-contact/blob/master/cmsplugin_contact/nospam/forms.py#L66
but the plugin, when it instantiates the form, does it the other way around: it uses the setting if present, and falls back to the instance value if it's not
https://github.com/maccesch/cmsplugin-contact/blob/master/cmsplugin_contact/cms_plugins.py#L84
what is the preferred semantics? Is the setting a default, to be overriden by the instance value, or the other way around?
I'd EXPECT it to be the former: have the instance to take precedence before the global setting. Is this a bug? Should I fix it?
Hi,
I'm trying to use a custom contact form with your plugin. In cms_plugins.py there is:
from forms import AkismetContactForm, RecaptchaContactForm, HoneyPotContactForm
which uses the supplied forms.py file. Is there a pythonic way of overwriting this? Putting a forms.py in my main project's directory doesn't seem to work. Any pointers welcome.
I created an app as described in the examples/cmsplugin_custom_contact
, to subclass cmsplugin_contact and add custom fields. I am also trying to use my own template. Everything looks fine expect from the fact that when submitting the form, the page refreshes and there is no email sent.
My files for the cmsplugin_custom_contact app look like this:
https://gist.github.com/nop33/27b6be6d2e1819d7441a
Any idea what the problem is?
Thanks
Hello,
This is not an issue, I just wanted to ask a question. Is it possible to reuse the same plugin instance that was added in a page into other pages? For example, I want to have a custom contact form in the sidebar of many pages. The only solution I see right now is to add one instance in every page separately. And then the same for every language of the site..
Thanks.
Hey its trying to run the south migrations, not sure how to run the normal django migrations when running ./manage.py migrate.
I've installed and uninstalled in Django cms 3.0 and it doesn't show as a plugin. Any help would be appreciated thanks.
Running makemigrations creates unwanted migrations.
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_contact', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='contact',
name='form_layout',
field=models.CharField(help_text='Choice the layout of contact form', max_length=255, verbose_name='Form Layout', choices=[(b'cmsplugin_contact.forms.ContactForm', 'default')]),
preserve_default=True,
),
]
Hi Maccesch
I have struggled and searched and can't get cmsplugin-contact working. I am developing in an Ubuntu VE using Python 2.7, Django 1.3, and Django CMS 2.1.3. I have the standard plugins installed that ship with Django CMS (text, twitter, etc); however, can't seem to get cmsplugin-contact to show up as an option. Am I looking in the correct place?
FYI: I have added 'cmsplugin_contact' to my INSTALLED_APPS and syncdb and I believe have properly migrated with South.
Any thoughts? Need more info?
Thanks
Clayton
the subject text created from the subject.txt template needs to have new lines stripped.
splitlines isn't enough.
cmsplugin_contact/cmsplugins.py:100
render_to_string(self.subject_template, {
'subject': subject,
}).strip("\n")
Hello,
we get a 403 csrf token validation failed during some tests with cmsplugin-contact and we are looking for a way to disable csrf token for our contact form. Our site is a public site, without authentification and we don't want to add some frictions for our clients to contact us.
But we DO use online edition and we don't want to turn off CSRF for the whole site.
I've some django experience but no django-cms experience and didn't see where I could add a conditional @csrf_exempt.
When installed, cmsplugin-contact comes up with a 'TemplateDoesNotExist at /admin/cms/page/5/edit-plugin/138/ cms/plugins/widgets/wymeditor.html'
I have 'djangocms_text_ckeditor' in front of the 'cms' app as per instructions on djangcms_text_ckeditor, and that plugin on itself is working as expected.
Using Django 1.5, django-cms 2.4 and djangocms-text-ckedito 1.0.9
Add file upload field to default template? (commented out?)
Security Concerns?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.