Commit | Line | Data |
---|---|---|
01b54c21 MN |
1 | from django.utils.translation import ugettext_lazy as _ |
2 | from cms.plugin_base import CMSPluginBase | |
3 | from cms.plugin_pool import plugin_pool | |
4 | from models import * | |
5 | from forms import ContactForm | |
6 | ||
7 | class 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 | ||
33 | plugin_pool.register_plugin(ContactPlugin) | |
34 | ||
35 | class 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 | ||
46 | plugin_pool.register_plugin(CMSVideoPlugin) |