Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-wiki
Commits
71f2693f
Commit
71f2693f
authored
Nov 12, 2014
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not call get_empty_query_set, that's deprecated
parent
d11a036c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletions
+21
-1
wiki/managers.py
+21
-1
No files found.
wiki/managers.py
View file @
71f2693f
...
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
...
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
from
django.db
import
models
from
django.db
import
models
from
django.db.models
import
Q
from
django.db.models
import
Q
from
django.db.models.query
import
QuerySet
,
EmptyQuerySet
from
django.db.models.query
import
QuerySet
,
EmptyQuerySet
from
django
import
VERSION
as
DJANGO_VERSION
from
mptt.managers
import
TreeManager
from
mptt.managers
import
TreeManager
...
@@ -41,6 +42,18 @@ class ArticleQuerySet(QuerySet):
...
@@ -41,6 +42,18 @@ class ArticleQuerySet(QuerySet):
return
self
.
filter
(
current_revision__deleted
=
False
)
return
self
.
filter
(
current_revision__deleted
=
False
)
class
ArticleEmptyQuerySet
(
EmptyQuerySet
):
def
can_read
(
self
,
user
):
return
self
def
can_write
(
self
,
user
):
return
self
def
active
(
self
):
return
self
class
ArticleFkQuerySetMixin
():
class
ArticleFkQuerySetMixin
():
def
can_read
(
self
,
user
):
def
can_read
(
self
,
user
):
...
@@ -98,8 +111,15 @@ class ArticleFkEmptyQuerySet(ArticleFkEmptyQuerySetMixin, EmptyQuerySet):
...
@@ -98,8 +111,15 @@ class ArticleFkEmptyQuerySet(ArticleFkEmptyQuerySetMixin, EmptyQuerySet):
class
ArticleManager
(
models
.
Manager
):
class
ArticleManager
(
models
.
Manager
):
def
get_empty_query_set
(
self
):
def
get_empty_query_set
(
self
):
# Pre 1.6 django, we needed a custom inheritor of EmptyQuerySet
# to pass custom methods. However, 1.6 introduced that EmptyQuerySet
# cannot be instantiated but instead passes through the methods
# of the custom QuerySet.
# See: https://code.djangoproject.com/ticket/22817
if
DJANGO_VERSION
<
(
1
,
6
):
return
ArticleEmptyQuerySet
(
self
.
model
,
using
=
self
.
_db
)
return
self
.
get_query_set
()
.
none
()
return
self
.
get_query_set
()
.
none
()
def
get_query_set
(
self
):
def
get_query_set
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment