SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
c9499545
Commit
c9499545
authored
5 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Move OrganizationLookup from journals app to organizations
parent
ec0a545a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
journals/templatetags/lookup.py
+0
-25
0 additions, 25 deletions
journals/templatetags/lookup.py
organizations/templatetags/lookup.py
+34
-0
34 additions, 0 deletions
organizations/templatetags/lookup.py
with
34 additions
and
25 deletions
journals/templatetags/lookup.py
+
0
−
25
View file @
c9499545
...
@@ -10,7 +10,6 @@ from ajax_select import register, LookupChannel
...
@@ -10,7 +10,6 @@ from ajax_select import register, LookupChannel
from
..models
import
Publication
from
..models
import
Publication
from
funders.models
import
Funder
,
Grant
from
funders.models
import
Funder
,
Grant
from
organizations.models
import
Organization
@register
(
'
publication_lookup
'
)
@register
(
'
publication_lookup
'
)
...
@@ -43,30 +42,6 @@ class PublicationLookup(LookupChannel):
...
@@ -43,30 +42,6 @@ class PublicationLookup(LookupChannel):
raise
PermissionDenied
raise
PermissionDenied
@register
(
'
organization_lookup
'
)
class
OrganizationLookup
(
LookupChannel
):
model
=
Organization
def
get_query
(
self
,
q
,
request
):
return
(
self
.
model
.
objects
.
order_by
(
'
name
'
)
.
filter
(
Q
(
name__icontains
=
q
)
|
Q
(
acronym__icontains
=
q
)
|
Q
(
name_original__icontains
=
q
))[:
10
])
def
format_item_display
(
self
,
item
):
"""
(HTML) format item for displaying item in the selected deck area.
"""
return
u
"
<span class=
'
auto_lookup_display
'
>%s</span>
"
%
item
.
full_name_with_acronym
def
format_match
(
self
,
item
):
"""
(HTML) Format item for displaying in the dropdown.
"""
return
item
.
full_name_with_acronym
def
check_auth
(
self
,
request
):
"""
Allow use by logged-in users (e.g. for Affiliations handling).
"""
if
not
request
.
user
.
is_authenticated
():
raise
PermissionDenied
@register
(
'
funder_lookup
'
)
@register
(
'
funder_lookup
'
)
class
FunderLookup
(
LookupChannel
):
class
FunderLookup
(
LookupChannel
):
model
=
Funder
model
=
Funder
...
...
This diff is collapsed.
Click to expand it.
organizations/templatetags/lookup.py
0 → 100644
+
34
−
0
View file @
c9499545
__copyright__
=
"
Copyright © Stichting SciPost (SciPost Foundation)
"
__license__
=
"
AGPL v3
"
from
django.core.exceptions
import
PermissionDenied
from
django.db.models
import
Q
from
ajax_select
import
register
,
LookupChannel
from
..models
import
Organization
@register
(
'
organization_lookup
'
)
class
OrganizationLookup
(
LookupChannel
):
model
=
Organization
def
get_query
(
self
,
q
,
request
):
return
(
self
.
model
.
objects
.
order_by
(
'
name
'
)
.
filter
(
Q
(
name__icontains
=
q
)
|
Q
(
acronym__icontains
=
q
)
|
Q
(
name_original__icontains
=
q
))[:
10
])
def
format_item_display
(
self
,
item
):
"""
(HTML) format item for displaying item in the selected deck area.
"""
return
u
"
<span class=
'
auto_lookup_display
'
>%s</span>
"
%
item
.
full_name_with_acronym
def
format_match
(
self
,
item
):
"""
(HTML) Format item for displaying in the dropdown.
"""
return
item
.
full_name_with_acronym
def
check_auth
(
self
,
request
):
"""
Allow use by logged-in users (e.g. for Affiliations handling).
"""
if
not
request
.
user
.
is_authenticated
():
raise
PermissionDenied
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment