Scott Nixon avatar Scott Nixon committed a9a3244

Fixed issue with categories not filtering unpublished Posts.

Comments (0)

Files changed (4)

article/managers.py

 class ActiveRecipe(models.Manager):
     def get_query_set(self):
         return super(ActiveRecipe, self).get_query_set().select_related() \
-                     .filter(is_published=1,members_only=False,published_on__lt=datetime.now())
+                     .filter(is_published=1,published_on__lt=datetime.now())
 
 class MemberRecipe(models.Manager):
     def get_query_set(self):
         return super(MemberRecipe, self).get_query_set().select_related() \
-                     .filter(is_published=1,members_only=True, \
-                             published_on__lt=datetime.now())
+                     .filter(is_published=1,published_on__lt=datetime.now())

article/templates/category_list.html

 {% endblock %}
    
 {% block js %}
-    <script src="/media/js/hh.js" type="text/javascript"></script> 
 {% endblock %}
 
 {% block extra_head %}{% endblock %}
                   <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}">
 			        {{ post.post_title }}</a>
                 </h2>
-                <p class="meta">Category: {% for p in post.get_tag_list %}<a href="{% url category p %}">{{ p }}</a> {% endfor %} | <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}#disqus_thread">{% disqus_num_replies %}</a>{%if request.user.is_staff and not debug %}| <span><a href="/admin/article/post/{{ post.pk }}/">Edit</a></span>{%endif%}</p>
+                <p class="meta">Category: {% for p in post.get_tag_list %}<a href="{% url category p %}">{{ p }}</a> {% endfor %} | <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}#disqus_thread">{% disqus_num_replies %}</a></p>
 
                 <div>
                   {{ post.post_content|safe|truncatewords_html:65 }}
                     {% for t in tag_list %}
                         <li><a {% if tag_obj == t.name %}class="label-green"{% else %}class="label-orange"{% endif %} href="{% url category t.name %}">{{t.name}}</a></li>
                     {% endfor %}
-                    <!-- <li><a href="#" class="label-green">Herbie Lifestyle</a></li>-->
                   </ul>
                 </div><!-- / categories-box -->
 

article/templates/post_list.html

                   <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}">
 			        {{ post.post_title }}</a>
                 </h2>
-                <p class="meta">Posted by: <a href="/about/">{{ post.post_author.get_full_name }}</a> | <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}#disqus_thread">{% disqus_num_replies %}</a> {%if request.user.is_staff and not debug %}| <span><a href="/admin/article/post/{{ post.pk }}/">Edit</a></span>{%endif%}</p>
+                <p class="meta">Posted by: <a href="/about/">{{ post.post_author.get_full_name }}</a> | <a alt="permanent link to {{ post.post_title }}" href="{{ post.get_absolute_url }}#disqus_thread">{% disqus_num_replies %}</a></p>
                 {% if post.post_tags %}<p class="meta">Category: {% for p in post.get_tag_list %}<a href="{% url category p %}">{{ p }}</a> {% endfor %}</p>{% endif %}
 
                 <div class="content">
     tag_obj = Tag.objects.get(name=category)
     tagged_items = TaggedItem.objects.get_by_model(Post, tag_obj)
     post_list = tagged_items.filter(sites=current_site.id,
-                                   post_type__in=[1,4]).order_by(
-                                   '-published_on')
+                                    is_published=1,published_on__lt=datetime.now(),
+                                    post_type__in=[1,4]).order_by('-published_on')
 
     type_of_posts = 0
     paginator = Paginator(post_list, 10) # Show 5 posts per page
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.