maccesch / cmsplugin-contact

Extendable contact plugin for django-cms with spam protection and i18n
BSD 2-Clause "Simplified" License
71 stars 62 forks source link

Problem when extending the plugin #69

Closed nop33 closed 9 years ago

nop33 commented 9 years ago

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

maccesch commented 9 years ago

Have you checked if Django can send emails? Often this fails silently because of incorrect SMTP settings or something like that.

nop33 commented 9 years ago

I can send emails when using the cmsplugin_contact without a problem. But not with my custom app which extends it...

nop33 commented 9 years ago

I am not getting any errors in the logs. Just a page refresh with the entered data pre-filled in the contact form and no email sent. Is there any other example of a cmsplugin_contact extension that I could see?

maccesch commented 9 years ago

Recently we merged a pull request that changed the behavior of the plugin after form submit. Probably the problem was introduced there. I will check tomorrow if I can find something.

nop33 commented 9 years ago

So you managed to reproduce it? Thanks for the effort.

maccesch commented 9 years ago

Ok I just uploaded a new release to PIPy. Please have a look at the updated example.

nop33 commented 9 years ago

I deployed the new version but the problem is not solved. I have the same problem: Page refresh after the form submit and no email. Here are my files: https://gist.github.com/nop33/81df80c3e95703c13a01 It looks like it only happens when I select my custom template. It works fine when selecting the default template.. Thanks

nop33 commented 9 years ago

However, if I just copy the contents of the default template (https://github.com/maccesch/cmsplugin-contact/blob/master/cmsplugin_contact/templates/cmsplugin_contact/contact.html) into my template file, I still get the problem. So there is nothing wrong with my custom template.

nop33 commented 9 years ago

Can you please reopen this ticket?

maccesch commented 9 years ago

It seems like you're overwriting the subject field of the basic contact form and also introduce your own message field instead of using the content field provided. Why do you do that?

nop33 commented 9 years ago

I just wanted to add the labels of email, subject and content in the admin form, so I can create instances of the plugin in different languages. I will try to rename the fields and try to see if it works.

nop33 commented 9 years ago

Turns out the problem was that in the forms.py I had the line

    mandatory_note = forms.CharField()

My purpose was to let the user define a message for the mandatory fields. By adding this line in the forms.py I guess that the form was not submitting since there was no value for this field and it was required.

Sorry for the trouble, I am still learning Django.

maccesch commented 9 years ago

No worries. I'm glad you found the problem :)