Skip to content

Commit

Permalink
Silly code style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Obrist committed Aug 18, 2011
1 parent 7ca8d0e commit 5f028c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions cms/models/managers.py
Expand Up @@ -22,12 +22,14 @@ def get_query_set(self):
return PageQuerySet(self.model)

def drafts(self):
return (super(PageManager, self).drafts()
.exclude(publisher_state=self.model.PUBLISHER_STATE_DELETE))
return super(PageManager, self).drafts().exclude(
publisher_state=self.model.PUBLISHER_STATE_DELETE
)

def public(self):
return (super(PageManager, self).public()
.exclude(publisher_state=self.model.PUBLISHER_STATE_DELETE))
return super(PageManager, self).public().exclude(
publisher_state=self.model.PUBLISHER_STATE_DELETE
)


# !IMPORTANT: following methods always return access to draft instances,
Expand Down
10 changes: 6 additions & 4 deletions cms/utils/page.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db.models import Q
import re

APPEND_TO_SLUG = "-copy"
Expand All @@ -10,10 +11,11 @@ def is_valid_page_slug(page, parent, lang, slug, site):
"""
from cms.models import Title
# Exclude the page with the publisher_state == page.PUBLISHER_STATE_DELETE
qs = (Title.objects.filter(page__site=site, slug=slug)
.exclude(page=page)
.exclude(page=page.publisher_public)
.exclude(page__publisher_state=page.PUBLISHER_STATE_DELETE))
qs = Title.objects.filter(page__site=site, slug=slug).exclude(

This comment has been minimized.

Copy link
@yml

yml Aug 18, 2011

Contributor

You are changing the logic here going from "AND" to "OR", aren't you?

This comment has been minimized.

Copy link
@ojii

ojii Aug 18, 2011

Contributor

glad you read the commits :D

Q(page=page) |
Q(page=page.publisher_public) |
Q(page__publisher_state=page.PUBLISHER_STATE_DELETE)
)

if settings.i18n_installed:
qs = qs.filter(language=lang)
Expand Down

0 comments on commit 5f028c1

Please sign in to comment.