Permalink
Browse files

filter entries in plugin by tags

  • Loading branch information...
1 parent 8359da4 commit 4995037c7f40fc61abaa3c1f117e492879bd3458 @fivethreeo committed Nov 16, 2011
Showing with 9 additions and 1 deletion.
  1. +8 −0 cmsplugin_blog/cms_plugins.py
  2. +1 −1 djeese.ini
@@ -1,5 +1,8 @@
from django.utils.translation import ugettext_lazy as _
+from tagging.models import TaggedItem
+from tagging.utils import get_tag_list
+
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.utils import get_language_from_request
@@ -27,7 +30,12 @@ def render(self, context, instance, placeholder):
kw = get_translation_filter_language(Entry, language)
qs = qs.filter(**kw)
+ if instance.tagged:
+ tags = get_tag_list(instance.tagged)
+ qs = TaggedItem.objects.get_by_model(qs , tags)
+
latest = qs[:instance.limit]
+
context.update({
'instance': instance,
'latest': latest,
View
@@ -3,7 +3,7 @@ name = cmsplugin-blog
author = Øyvind Saltvik
version = 1.1.2
packagename = cmsplugin-blog
-installation = -e git+https://github.com/fivethreeo/cmsplugin-blog.git#egg=cmsplugin-blog
+installation = -e git+https://github.com/fivethreeo/cmsplugin-blog.git@develop#egg=cmsplugin-blog
installed-apps =
cmsplugin_blog
simple_translation

0 comments on commit 4995037

Please sign in to comment.