├── djangocms_twitter
├── migrations
│ ├── __init__.py
│ └── 0001_initial.py
├── south_migrations
│ ├── __init__.py
│ ├── 0002_auto__add_twittersearch.py
│ ├── 0004_rename_tables.py
│ ├── 0003_auto__add_field_twitterrecententries_twitter_id__add_field_twittersear.py
│ └── 0001_initial.py
├── __init__.py
├── templates
│ └── cms
│ │ └── plugins
│ │ ├── twitter_search_widget.html
│ │ └── twitter_timeline.html
├── cms_plugins.py
└── models.py
├── MANIFEST.in
├── setup.cfg
├── .gitignore
├── setup.py
├── LICENCE.txt
└── README.rst
/djangocms_twitter/migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/djangocms_twitter/south_migrations/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/djangocms_twitter/__init__.py:
--------------------------------------------------------------------------------
1 | __version__ = "0.0.5.post1"
2 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.rst LICENCE.txt
2 | recursive-include djangocms_twitter *.py *.html manifest
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 | [flake8]
2 | exclude=.git,build,dist,docs,requirements,*migrations*
3 | ignore=E501
4 | max-line-length = 99
5 |
6 | [metadata]
7 | license-file = LICENCE.txt
8 |
9 | [wheel]
10 | universal = 1
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.py[cod]
2 |
3 | # C extensions
4 | *.so
5 |
6 | # Packages
7 | *.egg
8 | *.egg-info
9 | dist
10 | build
11 | eggs
12 | parts
13 | bin
14 | var
15 | sdist
16 | develop-eggs
17 | .installed.cfg
18 | lib
19 | lib64
20 |
21 | # Installer logs
22 | pip-log.txt
23 |
24 | # Unit test / coverage reports
25 | .coverage
26 | .tox
27 | nosetests.xml
28 |
29 | # Translations
30 | *.mo
31 |
32 | # Mr Developer
33 | .mr.developer.cfg
34 | .project
35 | .pydevproject
36 | .idea
37 | README.html
38 |
--------------------------------------------------------------------------------
/djangocms_twitter/templates/cms/plugins/twitter_search_widget.html:
--------------------------------------------------------------------------------
1 | {% load i18n %}
2 |
8 |
--------------------------------------------------------------------------------
/djangocms_twitter/templates/cms/plugins/twitter_timeline.html:
--------------------------------------------------------------------------------
1 | {% load i18n %}
2 |
8 |
--------------------------------------------------------------------------------
/djangocms_twitter/cms_plugins.py:
--------------------------------------------------------------------------------
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 |
5 | from .models import TwitterRecentEntries, TwitterSearch
6 |
7 |
8 | class TwitterRecentEntriesPlugin(CMSPluginBase):
9 | model = TwitterRecentEntries
10 | name = _("Twitter")
11 | render_template = "cms/plugins/twitter_timeline.html"
12 |
13 | def render(self, context, instance, placeholder):
14 | context.update({
15 | 'object': instance,
16 | })
17 | return context
18 |
19 | plugin_pool.register_plugin(TwitterRecentEntriesPlugin)
20 |
21 |
22 | class TwitterSearchPlugin(CMSPluginBase):
23 | model = TwitterSearch
24 | name = _("Twitter Search")
25 | render_template = "cms/plugins/twitter_search_widget.html"
26 | admin_preview = False
27 |
28 | def render(self, context, instance, placeholder):
29 | context.update({
30 | 'object': instance,
31 | })
32 | return context
33 | plugin_pool.register_plugin(TwitterSearchPlugin)
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | from setuptools import setup
4 | from djangocms_twitter import __version__
5 |
6 |
7 | CLASSIFIERS = [
8 | 'Development Status :: 4 - Beta',
9 | 'Environment :: Web Environment',
10 | 'Framework :: Django',
11 | 'Intended Audience :: Developers',
12 | 'License :: OSI Approved :: BSD License',
13 | 'Operating System :: OS Independent',
14 | 'Programming Language :: Python',
15 | 'Topic :: Communications',
16 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
17 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Message Boards',
18 | "Programming Language :: Python :: 2.6",
19 | "Programming Language :: Python :: 2.7",
20 | ]
21 |
22 | setup(
23 | name='djangocms-twitter',
24 | version=__version__,
25 | description='Twitter plugin for django CMS',
26 | author='Nephila s.a.s.',
27 | author_email='web@nephila.it',
28 | url='https://github.com/nephila/djangocms_twitter',
29 | packages=['djangocms_twitter', 'djangocms_twitter.migrations'],
30 | install_requires=[
31 | 'django-cms>=3.0'
32 | ],
33 | license='LICENSE.txt',
34 | platforms=['OS Independent'],
35 | classifiers=CLASSIFIERS,
36 | long_description=open('README.rst').read(),
37 | include_package_data=True,
38 | zip_safe=False
39 | )
--------------------------------------------------------------------------------
/LICENCE.txt:
--------------------------------------------------------------------------------
1 | This is a sample of a BSD style license.
2 | --------------------------------------------------------------------
3 | Copyright (c) 2013 Nephila s.a.s.
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions
8 | are met:
9 | 1. Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 | 2. Redistributions in binary form must reproduce the above copyright
12 | notice, this list of conditions and the following disclaimer in the
13 | documentation and/or other materials provided with the distribution.
14 | 3. The name of the author may not be used to endorse or promote products
15 | derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/djangocms_twitter/models.py:
--------------------------------------------------------------------------------
1 | from django.db import models
2 | from django.utils.translation import ugettext_lazy as _
3 | from cms.models.pluginmodel import CMSPlugin
4 |
5 |
6 | class TwitterRecentEntries(CMSPlugin):
7 | title = models.CharField(_('title'), max_length=75, blank=True)
8 | twitter_user = models.CharField(_('twitter user'), max_length=75)
9 | count = models.PositiveSmallIntegerField(_('count'), default=3,
10 | help_text=_('Number of entries to display'))
11 | link_hint = models.CharField(_('link hint'), max_length=75, blank=True,
12 | help_text=_('Deprecated: no longer used by Twitter widgets.'))
13 | twitter_id = models.CharField(_('twitter id'), max_length=75,
14 | help_text=_(u'See https://twitter.com/settings/widgets on how to obtain one'))
15 |
16 | def __unicode__(self):
17 | return self.title
18 |
19 |
20 | class TwitterSearch(CMSPlugin):
21 | title = models.CharField(_('title'), max_length=75, blank=True)
22 | query = models.CharField(_('query'), max_length=200, blank=True, default='',
23 | help_text=_('Deprecated: no longer used by Twitter widgets. Define one when creating widgets.'))
24 | count = models.PositiveSmallIntegerField(_('count'), default=3,
25 | help_text=_('Number of entries to display'))
26 | twitter_id = models.CharField(_('twitter id'), max_length=75,
27 | help_text=_(u'See https://twitter.com/settings/widgets on how to obtain one'))
28 |
29 | def __unicode__(self):
30 | return self.title
31 |
--------------------------------------------------------------------------------
/djangocms_twitter/migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | from django.db import migrations, models
5 |
6 |
7 | class Migration(migrations.Migration):
8 |
9 | dependencies = [
10 | ('cms', '0003_auto_20140926_2347'),
11 | ]
12 |
13 | operations = [
14 | migrations.CreateModel(
15 | name='TwitterRecentEntries',
16 | fields=[
17 | ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
18 | ('title', models.CharField(max_length=75, verbose_name='title', blank=True)),
19 | ('twitter_user', models.CharField(max_length=75, verbose_name='twitter user')),
20 | ('count', models.PositiveSmallIntegerField(default=3, help_text='Number of entries to display', verbose_name='count')),
21 | ('link_hint', models.CharField(help_text='Deprecated: no longer used by Twitter widgets.', max_length=75, verbose_name='link hint', blank=True)),
22 | ('twitter_id', models.CharField(help_text='See https://twitter.com/settings/widgets on how to obtain one', max_length=75, verbose_name='twitter id')),
23 | ],
24 | options={
25 | 'abstract': False,
26 | },
27 | bases=('cms.cmsplugin',),
28 | ),
29 | migrations.CreateModel(
30 | name='TwitterSearch',
31 | fields=[
32 | ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
33 | ('title', models.CharField(max_length=75, verbose_name='title', blank=True)),
34 | ('query', models.CharField(default=b'', help_text='Deprecated: no longer used by Twitter widgets. Define one when creating widgets.', max_length=200, verbose_name='query', blank=True)),
35 | ('count', models.PositiveSmallIntegerField(default=3, help_text='Number of entries to display', verbose_name='count')),
36 | ('twitter_id', models.CharField(help_text='See https://twitter.com/settings/widgets on how to obtain one', max_length=75, verbose_name='twitter id')),
37 | ],
38 | options={
39 | 'abstract': False,
40 | },
41 | bases=('cms.cmsplugin',),
42 | ),
43 | ]
44 |
--------------------------------------------------------------------------------
/djangocms_twitter/south_migrations/0002_auto__add_twittersearch.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import datetime
3 | from south.db import db
4 | from south.v2 import SchemaMigration
5 | from django.db import models
6 |
7 |
8 | class Migration(SchemaMigration):
9 |
10 | def forwards(self, orm):
11 | pass
12 |
13 |
14 | def backwards(self, orm):
15 | pass
16 |
17 |
18 | models = {
19 | 'cms.cmsplugin': {
20 | 'Meta': {'object_name': 'CMSPlugin'},
21 | 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
22 | 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 23, 0, 0)'}),
23 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
24 | 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
25 | 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
26 | 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
27 | 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
28 | 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
29 | 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
30 | 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
31 | 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
32 | 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
33 | },
34 | 'cms.placeholder': {
35 | 'Meta': {'object_name': 'Placeholder'},
36 | 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
37 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
38 | 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
39 | },
40 | 'djangocms_twitter.twitterrecententries': {
41 | 'Meta': {'object_name': 'TwitterRecentEntries', 'db_table': "'cmsplugin_twitterrecententries'", '_ormbases': ['cms.CMSPlugin']},
42 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
43 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
44 | 'link_hint': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
45 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
46 | 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '75'})
47 | },
48 | 'djangocms_twitter.twittersearch': {
49 | 'Meta': {'object_name': 'TwitterSearch', 'db_table': "'cmsplugin_twittersearch'", '_ormbases': ['cms.CMSPlugin']},
50 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
51 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
52 | 'query': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
53 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'})
54 | }
55 | }
56 |
57 | complete_apps = ['djangocms_twitter']
--------------------------------------------------------------------------------
/djangocms_twitter/south_migrations/0004_rename_tables.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from distutils.version import LooseVersion
3 |
4 | import cms
5 | from south.utils import datetime_utils as datetime
6 | from south.db import db
7 | from south.v2 import SchemaMigration
8 | from django.db import models
9 |
10 |
11 | class Migration(SchemaMigration):
12 |
13 | def forwards(self, orm):
14 |
15 | if LooseVersion(cms.__version__) >= LooseVersion('3'):
16 | if 'cmsplugin_twittersearch' in db.connection.introspection.table_names():
17 | db.rename_table(u'cmsplugin_twittersearch', u'djangocms_twitter_twittersearch')
18 | db.rename_table(u'cmsplugin_twitterrecententries', u'djangocms_twitter_twitterrecententries')
19 |
20 |
21 | def backwards(self, orm):
22 |
23 | if LooseVersion(cms.__version__) >= LooseVersion('3'):
24 | if 'djangocms_twitter_twittersearch' in db.connection.introspection.table_names():
25 | db.rename_table(u'djangocms_twitter_twittersearch', u'cmsplugin_twittersearch')
26 | db.rename_table(u'djangocms_twitter_twitterrecententries', u'cmsplugin_twitterrecententries')
27 |
28 | models = {
29 | 'cms.cmsplugin': {
30 | 'Meta': {'object_name': 'CMSPlugin'},
31 | 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
32 | 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
33 | 'depth': ('django.db.models.fields.PositiveIntegerField', [], {}),
34 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
35 | 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
36 | 'numchild': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
37 | 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
38 | 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
39 | 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
40 | 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
41 | 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'})
42 | },
43 | 'cms.placeholder': {
44 | 'Meta': {'object_name': 'Placeholder'},
45 | 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
46 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
47 | 'slot': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
48 | },
49 | u'djangocms_twitter.twitterrecententries': {
50 | 'Meta': {'object_name': 'TwitterRecentEntries', '_ormbases': ['cms.CMSPlugin']},
51 | u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
52 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
53 | 'link_hint': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
54 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
55 | 'twitter_id': ('django.db.models.fields.CharField', [], {'max_length': '75'}),
56 | 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '75'})
57 | },
58 | u'djangocms_twitter.twittersearch': {
59 | 'Meta': {'object_name': 'TwitterSearch', '_ormbases': ['cms.CMSPlugin']},
60 | u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
61 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
62 | 'query': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
63 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
64 | 'twitter_id': ('django.db.models.fields.CharField', [], {'max_length': '75'})
65 | }
66 | }
67 |
68 | complete_apps = ['djangocms_twitter']
69 |
--------------------------------------------------------------------------------
/djangocms_twitter/south_migrations/0003_auto__add_field_twitterrecententries_twitter_id__add_field_twittersear.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import datetime
3 | from south.db import db
4 | from south.v2 import SchemaMigration
5 | from django.db import models
6 |
7 |
8 | class Migration(SchemaMigration):
9 |
10 | def forwards(self, orm):
11 | # Adding field 'TwitterRecentEntries.twitter_id'
12 | db.add_column('cmsplugin_twitterrecententries', 'twitter_id',
13 | self.gf('django.db.models.fields.CharField')(default='', max_length=75),
14 | keep_default=False)
15 |
16 | # Adding field 'TwitterSearch.twitter_id'
17 | db.add_column('cmsplugin_twittersearch', 'twitter_id',
18 | self.gf('django.db.models.fields.CharField')(default='', max_length=75),
19 | keep_default=False)
20 |
21 |
22 | def backwards(self, orm):
23 | # Deleting field 'TwitterRecentEntries.twitter_id'
24 | db.delete_column('cmsplugin_twitterrecententries', 'twitter_id')
25 |
26 | # Deleting field 'TwitterSearch.twitter_id'
27 | db.delete_column('cmsplugin_twittersearch', 'twitter_id')
28 |
29 |
30 | models = {
31 | 'cms.cmsplugin': {
32 | 'Meta': {'object_name': 'CMSPlugin'},
33 | 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
34 | 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 23, 0, 0)'}),
35 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
36 | 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
37 | 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
38 | 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
39 | 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
40 | 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
41 | 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
42 | 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
43 | 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
44 | 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
45 | },
46 | 'cms.placeholder': {
47 | 'Meta': {'object_name': 'Placeholder'},
48 | 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
49 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
50 | 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
51 | },
52 | 'djangocms_twitter.twitterrecententries': {
53 | 'Meta': {'object_name': 'TwitterRecentEntries', 'db_table': "'cmsplugin_twitterrecententries'", '_ormbases': ['cms.CMSPlugin']},
54 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
55 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
56 | 'link_hint': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
57 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
58 | 'twitter_id': ('django.db.models.fields.CharField', [], {'max_length': '75'}),
59 | 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '75'})
60 | },
61 | 'djangocms_twitter.twittersearch': {
62 | 'Meta': {'object_name': 'TwitterSearch', 'db_table': "'cmsplugin_twittersearch'", '_ormbases': ['cms.CMSPlugin']},
63 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
64 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
65 | 'query': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
66 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
67 | 'twitter_id': ('django.db.models.fields.CharField', [], {'max_length': '75'})
68 | }
69 | }
70 |
71 | complete_apps = ['djangocms_twitter']
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | django CMS Twitter plugin
2 | =========================
3 |
4 |
5 | .. image:: https://badge.fury.io/py/djangocms-twitter.png
6 | :target: http://badge.fury.io/py/djangocms-twitter
7 |
8 | .. image:: https://pypip.in/d/djangocms-twitter/badge.png
9 | :target: https://crate.io/packages/djangocms-twitter?version=latest
10 |
11 |
12 |
13 | ``djangocms-twitter`` is a upgrade-friendly plugin, mostly derived from original
14 | implementation in **django CMS** core.
15 |
16 | Due to the switch from v 1.0 to v 1.1 in the twitter API, the original plugin no
17 | longer works, and it's going to be removed.
18 |
19 | Other plugin exists (or you could just switch to plain twitter widgets), althogh,
20 | it's still a bit frustrating to throw away existing plugins.
21 |
22 | Contrary to the 1.0 API, Twitter 1.1 API requires you to create client side
23 | plugins in your profile and ``djangocms-twitter`` can do very little to avoid
24 | this. It delivers data-compatible plugins for straightforward upgrade.
25 |
26 | Some field has been deprecated as no longer used by the twitter widgets. They
27 | have been left for easier upgrade.
28 |
29 | Installation
30 | ------------
31 |
32 | First-time installation
33 | #######################
34 |
35 | #. Add ``djangocms_twitter`` to ``INSTALLED_APPS``
36 | #. Apply migrations::
37 |
38 | $ python manage.py migrate djangocms_twitter
39 |
40 | #. Insert the plugins in the page and configure them as stated in Usage_.
41 |
42 | Upgrade from the in-core plugin
43 | ###############################
44 |
45 | #. Remove ``cms.plugins.twitter`` from ``INSTALLED_APPS``
46 | #. Add ``djangocms_twitter`` to ``INSTALLED_APPS``
47 | #. Apply migrations::
48 |
49 | $ python manage.py migrate djangocms_twitter
50 |
51 | #. Modify the plugins instances according to Usage_.
52 | #. Check your Templates_.
53 |
54 | .. _Usage:
55 |
56 | Usage
57 | -----
58 |
59 | TwitterRecentEntriesPlugin
60 | ##########################
61 |
62 | For this plugin it's not necessary to create a widget for every plugin in your
63 | website; you could just consider the widget you create on the Twitter website
64 | as *templates* for this django CMS plugin:
65 |
66 | ##############################
67 | Create the twitter-side widget
68 | ##############################
69 |
70 | #. Login in your twitter account;
71 | #. Go to https://twitter.com/settings/widgets;
72 | #. Create new widget;
73 | #. Select "**user timeline**" as source;
74 | #. Configure the options (theme, colours etc) as described in https://dev.twitter.com/docs/embedded-timelines;
75 | #. Create widget;
76 | #. get the value of ``data-widget-id`` in the embed code;
77 |
78 | #####################
79 | Plugin instances data
80 | #####################
81 |
82 | ``data-widget-id`` value can be shared by any number of plugins instances, the
83 | plugin-provided user timeline will be shown, while the twitter widget graphics
84 | appearance will be used.
85 |
86 | #. Add or edit the **Twitter** plugin in you placeholders;
87 | #. Fill in the Twitter widget it field using the ``data-widget-id`` value from
88 | the previous step;
89 | #. Save the plugin;
90 |
91 |
92 | TwitterSearchPlugin
93 | ###################
94 |
95 | The twitter widget used by this plugin is entirely configured on the twitter
96 | website.
97 |
98 | ##############################
99 | Create the twitter-side widget
100 | ##############################
101 |
102 | #. Login in your twitter account;
103 | #. Go to https://twitter.com/settings/widgets;
104 | #. Create new widget;
105 | #. Select "**Search**" as source;
106 | #. Configure the search query;
107 | #. Configure the options (theme, colours etc) as described in https://dev.twitter.com/docs/embedded-timelines;
108 | #. Create widget;
109 | #. get the value of ``data-widget-id`` in the embed code;
110 |
111 | #####################
112 | Plugin instances data
113 | #####################
114 |
115 | #. Add or edit the **Twitter Search** plugin in you placeholders;
116 | #. Fill in the Twitter widget it field using the ``data-widget-id`` value from
117 | the previous step;
118 | #. Optionally fill-in the query field in the plugin form; this is only used for
119 | non-javascript enabled browser, as the ``data-widget-id`` will take over on
120 | javascript-enabled ones;
121 | #. Save the plugin;
122 |
123 |
124 | .. _Templates:
125 |
126 | Templates
127 | ---------
128 |
129 | Older templates it's no longer valid. Most of the graphic configuration must be
130 | done in when creating the widget on the Twitter website.
131 |
132 | A limited set of client-side options exists to configure the widgets; see
133 | https://dev.twitter.com/docs/embedded-timelines#options for further info.
134 |
135 | To apply them you need to modify the plugin templates:
136 |
137 | - ``cms/plugins/twitter_timeline.html``: for ``TwitterRecentEntriesPlugin``
138 | - ``cms/plugins/twitter_search_widget.html``: for ``TwitterSearchPlugin``
139 |
140 | .. image:: https://d2weczhvl823v0.cloudfront.net/nephila/djangocms_twitter/trend.png
141 | :alt: Bitdeli badge
142 | :target: https://bitdeli.com/free
143 |
144 |
--------------------------------------------------------------------------------
/djangocms_twitter/south_migrations/0001_initial.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import datetime
3 | from south.db import db
4 | from south.v2 import SchemaMigration
5 | from django.db import models
6 |
7 |
8 | class Migration(SchemaMigration):
9 |
10 | def forwards(self, orm):
11 | # Adding model 'TwitterRecentEntries'
12 | db.create_table('cmsplugin_twitterrecententries', (
13 | ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
14 | ('title', self.gf('django.db.models.fields.CharField')(max_length=75, blank=True)),
15 | ('twitter_user', self.gf('django.db.models.fields.CharField')(max_length=75)),
16 | ('count', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=3)),
17 | ('link_hint', self.gf('django.db.models.fields.CharField')(max_length=75, blank=True)),
18 | ))
19 | db.send_create_signal('djangocms_twitter', ['TwitterRecentEntries'])
20 |
21 | # Adding model 'TwitterSearch'
22 | db.create_table('cmsplugin_twittersearch', (
23 | ('cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)),
24 | ('title', self.gf('django.db.models.fields.CharField')(max_length=75, blank=True)),
25 | ('query', self.gf('django.db.models.fields.CharField')(default='', max_length=200, blank=True)),
26 | ('count', self.gf('django.db.models.fields.PositiveSmallIntegerField')(default=3)),
27 | ))
28 | db.send_create_signal('djangocms_twitter', ['TwitterSearch'])
29 |
30 |
31 | def backwards(self, orm):
32 | # Deleting model 'TwitterRecentEntries'
33 | db.delete_table('cmsplugin_twitterrecententries')
34 |
35 | # Deleting model 'TwitterSearch'
36 | db.delete_table('cmsplugin_twittersearch')
37 |
38 |
39 | models = {
40 | 'cms.cmsplugin': {
41 | 'Meta': {'object_name': 'CMSPlugin'},
42 | 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
43 | 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 6, 23, 0, 0)'}),
44 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
45 | 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
46 | 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
47 | 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
48 | 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}),
49 | 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}),
50 | 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
51 | 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
52 | 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
53 | 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'})
54 | },
55 | 'cms.placeholder': {
56 | 'Meta': {'object_name': 'Placeholder'},
57 | 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}),
58 | 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
59 | 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'})
60 | },
61 | 'djangocms_twitter.twitterrecententries': {
62 | 'Meta': {'object_name': 'TwitterRecentEntries', 'db_table': "'cmsplugin_twitterrecententries'", '_ormbases': ['cms.CMSPlugin']},
63 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
64 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
65 | 'link_hint': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
66 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'}),
67 | 'twitter_user': ('django.db.models.fields.CharField', [], {'max_length': '75'})
68 | },
69 | 'djangocms_twitter.twittersearch': {
70 | 'Meta': {'object_name': 'TwitterSearch', 'db_table': "'cmsplugin_twittersearch'", '_ormbases': ['cms.CMSPlugin']},
71 | 'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}),
72 | 'count': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '3'}),
73 | 'query': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
74 | 'title': ('django.db.models.fields.CharField', [], {'max_length': '75', 'blank': 'True'})
75 | }
76 | }
77 |
78 | complete_apps = ['djangocms_twitter']
--------------------------------------------------------------------------------