Permalink
Browse files

refined the extension example

  • Loading branch information...
1 parent 49ac8c7 commit 741f9a0c46cc051733dfc34f74e278810439d336 @maccesch committed Sep 12, 2011
View
21 examples/cmsplugin_custom_contact/cms_plugins.py
@@ -1,25 +1,20 @@
-from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from cmsplugin_contact.cms_plugins import ContactPlugin
-from cmsplugin_contact.forms import ContactForm
-from cmsplugin_contact.model import BaseContact
-
-class CustomContact(BaseContact):
- custom_label = models.CharField(
- _('Custom sender label'),
- default=_('Your custom value'), max_length=20)
-
-class CustomContactForm(ContactForm):
- custom = forms.CharField()
+from models import CustomContact
+from forms import CustomContactForm
class CustomContactPlugin(ContactPlugin):
- model = CustomContact
name = _("Custom Contact Form")
- render_template = "cmsplugin_contact/contact.html"
+
+ model = CustomContact
contact_form = CustomContactForm
+
+ # We're using the original cmsplugin_contact templates here which
+ # works fine but requires that the original plugin is in INSTALLED_APPS.
+ render_template = "cmsplugin_contact/contact.html"
email_template = "cmsplugin_contact/email.txt"
fieldsets = (
View
5 examples/cmsplugin_custom_contact/forms.py
@@ -0,0 +1,5 @@
+from django import forms
+from cmsplugin_contact.forms import ContactForm
+
+class CustomContactForm(ContactForm):
+ custom = forms.CharField()
View
8 examples/cmsplugin_custom_contact/models.py
@@ -0,0 +1,8 @@
+from django.db import models
+from cmsplugin_contact.models import BaseContact
+from django.utils.translation import ugettext_lazy as _
+
+class CustomContact(BaseContact):
+ custom_label = models.CharField(
+ _('Custom sender label'),
+ default=_('Your custom value'), max_length=20)

0 comments on commit 741f9a0

Please sign in to comment.