Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Silly code style changes

  • Loading branch information...
commit 5f028c1cacb273388bc4d4f03aad89e0886162a5 1 parent 7ca8d0e
@ojii ojii authored
Showing with 12 additions and 8 deletions.
  1. +6 −4 cms/models/managers.py
  2. +6 −4 cms/utils/page.py
View
10 cms/models/managers.py
@@ -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,
View
10 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"
@@ -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(
@yml
yml added a note

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

@ojii Collaborator
ojii added a note

glad you read the commits :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ 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)
Please sign in to comment.
Something went wrong with that request. Please try again.