Permalink
Browse files

Now featured and popular doesn't exclude any more

  • Loading branch information...
1 parent e5934df commit 0c3b242f2bd34390dea61a4247f1f314eb084fce @elpaso elpaso committed Oct 6, 2012
Showing with 7 additions and 4 deletions.
  1. +2 −2 qgis-app/homepage.py
  2. +5 −2 qgis-app/plugins/models.py
View
@@ -11,8 +11,8 @@ def homepage(request):
Renders the home page
"""
fresh = Plugin.fresh_objects.all()[:5]
- featured = Plugin.featured_objects.all().exclude(pk__in=[p.pk for p in fresh])[:5]
- popular = Plugin.popular_objects.all().exclude(pk__in=[p.pk for p in fresh]).exclude(pk__in=[p.pk for p in featured])[:5]
+ featured = Plugin.featured_objects.all() #.exclude(pk__in=[p.pk for p in fresh])[:5]
+ popular = Plugin.popular_objects.all() #.exclude(pk__in=[p.pk for p in fresh]).exclude(pk__in=[p.pk for p in featured])[:5]
posts = Post.objects.all()[:5]
try:
content = FlatPage.objects.get(url='/').content
@@ -10,7 +10,6 @@
import datetime, os, re
# Tagging
-#from taggit.managers import TaggableManager
from taggit_autosuggest.managers import TaggableManager
PLUGINS_STORAGE_PATH = getattr(settings, 'PLUGINS_STORAGE_PATH', 'packages')
@@ -33,6 +32,7 @@ class StablePlugins(models.Manager):
def get_query_set(self):
return super(StablePlugins, self).get_query_set().filter(pluginversion__approved=True, pluginversion__experimental=False).distinct()
+
class ExperimentalPlugins(models.Manager):
"""
Shows only public plugins: i.e. those with "approved" flag set
@@ -41,6 +41,7 @@ class ExperimentalPlugins(models.Manager):
def get_query_set(self):
return super(ExperimentalPlugins, self).get_query_set().filter(pluginversion__approved=True, pluginversion__experimental=True).distinct()
+
class FeaturedPlugins(models.Manager):
"""
Shows only public featured stable plugins: i.e. those with "approved" flag set
@@ -49,6 +50,7 @@ class FeaturedPlugins(models.Manager):
def get_query_set(self):
return super(FeaturedPlugins, self).get_query_set().filter(pluginversion__approved=True, featured=True).order_by('-created_on').distinct()
+
class FreshPlugins(models.Manager):
"""
Shows only approved plugins: i.e. those with "approved" version flag set
@@ -62,6 +64,7 @@ def __init__(self, days = PLUGINS_FRESH_DAYS, *args, **kwargs):
def get_query_set(self):
return super(FreshPlugins, self).get_query_set().filter(pluginversion__approved=True, modified_on__gte = datetime.datetime.now()- datetime.timedelta(days = self.days)).order_by('-created_on').distinct()
+
class UnapprovedPlugins(models.Manager):
"""
Shows only unapproved plugins
@@ -86,14 +89,14 @@ def get_query_set(self):
return super(PopularPlugins, self).get_query_set().filter(deprecated=False ).order_by('-downloads').distinct()
-
class TaggablePlugins (TaggableManager):
"""
Shows only public plugins: i.e. those with "approved" flag set
"""
def get_query_set(self):
return super(TaggablePlugnis, self).get_query_set().filter(deprecated=False, pluginversion__approved=True).distinct()
+
class Plugin (models.Model):
"""
Plugins model

0 comments on commit 0c3b242

Please sign in to comment.