I wrote an simple django app to store e-mail adresses if the user fills in a form. Everything worked fine but when i followed this tutorial to integrate my app in django-cms i noticed that my form is not displaying in the Plugin as it did before i moved it to django-cms. It seems that {% csrf_token %}
and {{ form.as_p }}
are not working in the Plugin.
Anyone knows why?
Here my cms_plugin.py
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from newsletter_djangocms.models import NewsletterPlugin
from django.utils.translation import ugettext as _
class CMSNewsletterPlugin(CMSPluginBase):
model = NewsletterPlugin
module = _("Recipients")
name = _("Newsletter Plugin")
render_template = "newsletter_djangocms/add.html"
def render(self, context, instance, placeholder):
context.update({'instance': instance})
return context
plugin_pool.register_plugin(CMSNewsletterPlugin)
models.py of main app (not CMSPlugin)
from django.db import models
class Recipient(models.Model):
adress = models.EmailField(max_length=100)
name = models.CharField(max_length=100)
lastname = models.CharField(max_length=100)
def __str__(self):
return self.adress
and forms.py (also main app)
from django import forms
from .models import Recipient
class NewsletterForm(forms.ModelForm):
class Meta:
model = Recipient
fields = ('adress','name', 'lastname',)
In which file could be the mistake or where could i find a helpfull post or something. Only thing i found here is this. But that not worked for me. I would be very glad about a good tip.