Commits

Antoine Nguyen committed 2e28f20

Initial import.

  • Participants

Comments (0)

Files changed (9)

+.*~$
+^.*\.pyc
+include README.rst
+====================================
+Google groups widgets for Django CMS
+====================================
+
+This extension provides the following plugins:
+
+* *Google groups subscription*: wraps subscribe box into a Django CMS
+   plugin, can be easily integrated into pages
+
+Requirements
+============
+
+* `Django CMS >= 2.2 <http://django-cms.org>`_
+
+Installation
+============
+
+If you want to use those plugins into your project, just follow this
+procedure:
+
+#. Open the *settings.py* file and add ``cmsplugin_googlegroups_widgets`` to the
+   ``INSTALLED_APPS`` variable
+
+#. Run the following command::
+
+    $ ./manage.py syncb

cmsplugin_googlegroups_widgets/__init__.py

Empty file added.

cmsplugin_googlegroups_widgets/admin.py

+# coding: utf-8
+import datetime
+from models import GoogleGroup
+from django.contrib import admin
+
+class GoogleGroupAdmin(admin.ModelAdmin):
+    list_display = ("group_name",)
+    search_fields = ["group_name"]
+
+admin.site.register(GoogleGroup, GoogleGroupAdmin)

cmsplugin_googlegroups_widgets/cms_plugins.py

+from cms.plugin_base import CMSPluginBase
+from cms.plugin_pool import plugin_pool
+from cms.models.pluginmodel import CMSPlugin
+from django.utils.translation import ugettext_lazy as _
+
+from models import GGSubscribe
+
+class SubscribePlugin(CMSPluginBase):
+    model = GGSubscribe
+    name = _("Google groups subscription")
+    render_template = "cmsplugin_googlegroups_widgets/subscribe.html"
+
+    def render(self, context, instance, placeholder):
+        context["instance"] = instance
+        return context
+
+plugin_pool.register_plugin(SubscribePlugin)

cmsplugin_googlegroups_widgets/models.py

+from cms.models.pluginmodel import CMSPlugin
+from django.db import models
+
+class GoogleGroup(models.Model):
+    group_name = models.CharField(max_length=300)
+
+    def __unicode__(self):
+        return unicode(self.group_name)
+
+class GGSubscribe(CMSPlugin):
+    group = models.ForeignKey(GoogleGroup)
+
+    def __unicode__(self):
+        return unicode(self.group)
+
+    def __str__(self):
+        return self.group.group_name
+
+

cmsplugin_googlegroups_widgets/templates/cmsplugin_googlegroups_widgets/subscribe.html

+{% load i18n %}
+<table border=0 style="background-color: #fff; padding: 5px;" cellspacing=0>
+  <tr><td>
+      <img src="http://groups.google.com/intl/{{ LANGUAGE_CODE }}/images/logos/groups_logo_sm.gif"
+           height=30 width=151 alt="{% trans 'Google Groups' %}">
+  </td></tr>
+  <tr><td style="padding-left: 5px"> <b>{% trans "Subscribe to" %} {{ instance.group.group_name }}</b> </td></tr>
+  <form action="http://groups.google.com/group/{{ instance.group.group_name }}/boxsubscribe">
+    <input type=hidden name="hl" value="{{ LANGUAGE_CODE }}">
+    <tr><td style="padding-left: 5px;"> {% trans "Email" %} : <input type=text name=email>
+        <input type=submit name="sub" value="{% trans 'Subscribe' %}">
+    </td></tr>
+  </form>
+  <tr><td align=right> <a href="http://groups.google.com/group/{{ instance.group.group_name }}?hl={{ LANGUAGE_CODE }}">{% trans "Visit this group" %}</a> </td></tr>
+</table>
+from setuptools import setup, find_packages
+
+setup(
+    name = "cmsplugin-googlegroups-widgets",
+    packages = find_packages(),
+    package_data = {
+        'cmsplugin_googlegroups_widgets': [
+            'templates/cmsplugin_googlegroups_widgets/*.html'
+        ]
+    },
+    version = "0.1",
+    description = "Google Groups widgets for django-cms 2.2",
+    long_description=open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
+    author = "Antoine Nguyen",
+    author_email = "tonio@ngyn.org",
+    url = "http://bitbucket.org/tonioo/cmsplugin-googlegroups-widgets",
+    license = "BSD",
+    keywords = ["django", "django-cms", "google groups", "widgets"],
+    classifiers = [
+        "Programming Language :: Python",
+        "Environment :: Web Environment",
+        "Development Status :: 4 - Beta",
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: BSD License",
+        "Operating System :: OS Independent",
+        "Framework :: Django"
+        ],
+    include_package_data = True,
+    zip_safe = False,
+    install_requires = ['setuptools'],
+    requires = [
+        'django-cms (>= 2.2)',
+        ],
+    )