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
7bb4334f
Commit
7bb4334f
authored
Nov 06, 2014
by
benjaoming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:kilrogg/django-wiki into kilrogg-master
Conflicts: wiki/plugins/haystack/views.py
parents
f100e698
aded5116
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
wiki/plugins/haystack/views.py
+10
-11
wiki/plugins/notifications/forms.py
+1
-1
wiki/plugins/notifications/views.py
+2
-2
No files found.
wiki/plugins/haystack/views.py
View file @
7bb4334f
from
__future__
import
absolute_import
from
__future__
import
unicode_literals
from
haystack.backends
import
SQ
from
wiki.views.article
import
SearchView
from
haystack.query
import
SearchQuerySet
from
haystack.inputs
import
AutoQuery
from
wiki.core
import
permissions
from
wiki
import
models
class
HaystackSearchView
(
SearchView
):
template_name
=
'wiki/plugins/haystack/search.html'
...
...
@@ -13,20 +15,18 @@ class HaystackSearchView(SearchView):
def
get_queryset
(
self
):
qs
=
SearchQuerySet
()
.
all
()
if
self
.
request
.
user
.
is_authenticated
():
# TODO: This has a leak! It should say
:
# group=self.request.group.id AND group_read=True
if
not
permissions
.
can_moderate
(
models
.
URLPath
.
root
()
.
article
,
self
.
request
.
user
):
qs
=
qs
.
filter_or
(
owner
=
self
.
request
.
user
.
id
,
group
=
self
.
request
.
group
.
id
,
other_read
=
True
if
not
permissions
.
can_moderate
(
models
.
URLPath
.
root
()
.
article
,
self
.
request
.
user
)
:
qs
=
qs
.
filter
(
SQ
(
owner_id
=
self
.
request
.
user
.
id
)
|
(
SQ
(
group_id__in
=
self
.
request
.
user
.
groups
.
values_list
(
'id'
,
flat
=
True
))
&
SQ
(
group_read
=
True
)
)
|
SQ
(
other_read
=
True
)
)
else
:
qs
=
qs
.
exclude
(
other_read
=
False
)
qs
=
qs
.
filter
(
content
=
AutoQuery
(
self
.
query
))
qs
=
qs
.
exclude
(
other_read
=
False
)
qs
=
qs
.
load_all
()
return
qs
\ No newline at end of file
wiki/plugins/notifications/forms.py
View file @
7bb4334f
...
...
@@ -39,7 +39,7 @@ class SettingsModelForm(forms.ModelForm):
if
instance
:
self
.
__editing_instance
=
True
self
.
fields
[
'delete_subscriptions'
]
=
ArticleSubscriptionModelMultipleChoiceField
(
models
.
ArticleSubscription
.
objects
.
filter
(
settings
=
instance
),
models
.
ArticleSubscription
.
objects
.
filter
(
s
ubscription__s
ettings
=
instance
),
label
=
_
(
"Remove subscriptions"
),
required
=
False
,
help_text
=
_
(
"Select article subscriptions to remove from notifications"
),
...
...
wiki/plugins/notifications/views.py
View file @
7bb4334f
...
...
@@ -24,7 +24,7 @@ class NotificationSettings(FormView):
settings
=
form
.
save
()
from
.
import
models
article_subscriptions
=
models
.
ArticleSubscription
.
objects
.
filter
(
settings
=
form
.
instance
,
s
ubscription_s
ettings
=
form
.
instance
,
article__current_revision__deleted
=
False
,
)
.
select_related
(
'article'
,
'article__current_revision'
)
messages
.
info
(
...
...
@@ -51,7 +51,7 @@ class NotificationSettings(FormView):
if
form
.
instance
:
setattr
(
form
.
instance
,
'articlesubscriptions'
,
models
.
ArticleSubscription
.
objects
.
filter
(
settings
=
form
.
instance
,
s
ubscription__s
ettings
=
form
.
instance
,
article__current_revision__deleted
=
False
,
)
.
select_related
(
'article'
,
'article__current_revision'
)
)
...
...
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