Hello site
[auf_framonde.git] / project / contact / cms_plugins.py
CommitLineData
01b54c21
MN
1from django.utils.translation import ugettext_lazy as _
2from cms.plugin_base import CMSPluginBase
3from cms.plugin_pool import plugin_pool
4from models import *
5from forms import ContactForm
6
7class ContactPlugin(CMSPluginBase):
8 model = Contact
9 name = _("Contact Form")
10 render_template = "contact.html"
11
12 def render(self, context, instance, placeholder):
13 request = context['request']
14
15 if request.method == "POST":
16 form = ContactForm(request.POST)
17 if form.is_valid():
18 form.send(instance.site_email)
19 context.update( {
20 'contact': instance,
21 })
22 return context
23 else:
24 form = ContactForm()
25
26
27 context.update({
28 'contact': instance,
29 'form': form,
30 })
31 return context
32
33plugin_pool.register_plugin(ContactPlugin)
34
35class CMSVideoPlugin(CMSPluginBase):
36 name = _("Video")
37 model = VideoPlugin
38 render_template = "videoPlugin.html"
39
40 def render(self, context, instance, placeholder):
41 context.update({'videoG':instance.video,
42 'video':instance,
43 'placeholder':placeholder})
44 return context
45
46plugin_pool.register_plugin(CMSVideoPlugin)