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
d7fa5ce5
Commit
d7fa5ce5
authored
8 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Remove browse method from views
parent
194fc234
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
commentaries/urls.py
+14
-7
14 additions, 7 deletions
commentaries/urls.py
commentaries/views.py
+3
-18
3 additions, 18 deletions
commentaries/views.py
with
17 additions
and
25 deletions
commentaries/urls.py
+
14
−
7
View file @
d7fa5ce5
...
@@ -6,20 +6,27 @@ from . import views
...
@@ -6,20 +6,27 @@ from . import views
urlpatterns
=
[
urlpatterns
=
[
# Commentaries
# Commentaries
url
(
r
'
^$
'
,
views
.
CommentaryListView
.
as_view
(),
name
=
'
commentaries
'
),
url
(
r
'
^$
'
,
views
.
CommentaryListView
.
as_view
(),
name
=
'
commentaries
'
),
url
(
r
'
^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$
'
,
views
.
browse
,
name
=
'
browse
'
),
url
(
r
'
^browse/(?P<discipline>[a-z]+)/(?P<nrweeksback>[0-9]+)/$
'
,
views
.
CommentaryListView
.
as_view
(),
name
=
'
browse
'
),
url
(
r
'
^howto$
'
,
TemplateView
.
as_view
(
template_name
=
'
commentaries/howto.html
'
),
name
=
'
howto
'
),
url
(
r
'
^howto$
'
,
TemplateView
.
as_view
(
template_name
=
'
commentaries/howto.html
'
),
name
=
'
howto
'
),
# Match a DOI-based link:
# Match a DOI-based link:
url
(
r
'
^(?P<arxiv_or_DOI_string>10.[0-9]{4,9}/[-._;()/:a-zA-Z0-9]+)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
url
(
r
'
^(?P<arxiv_or_DOI_string>10.[0-9]{4,9}/[-._;()/:a-zA-Z0-9]+)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
# Match an arxiv-based link:
# Match an arxiv-based link:
# new style identifiers:
# new style identifiers:
url
(
r
'
^(?P<arxiv_or_DOI_string>arXiv:[0-9]{4,}.[0-9]{5,}(v[0-9]+)?)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
url
(
r
'
^(?P<arxiv_or_DOI_string>arXiv:[0-9]{4,}.[0-9]{5,}(v[0-9]+)?)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
# old style identifiers:
# old style identifiers:
url
(
r
'
^(?P<arxiv_or_DOI_string>arXiv:[a-z-]+/[0-9]{7,}(v[0-9]+)?)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
url
(
r
'
^(?P<arxiv_or_DOI_string>arXiv:[a-z-]+/[0-9]{7,}(v[0-9]+)?)/$
'
,
views
.
commentary_detail
,
name
=
'
commentary
'
),
url
(
r
'
^request_commentary$
'
,
views
.
RequestCommentary
.
as_view
(),
name
=
'
request_commentary
'
),
url
(
r
'
^request_commentary$
'
,
views
.
RequestCommentary
.
as_view
(),
name
=
'
request_commentary
'
),
url
(
r
'
^prefill_using_DOI$
'
,
views
.
prefill_using_DOI
,
name
=
'
prefill_using_DOI
'
),
url
(
r
'
^prefill_using_DOI$
'
,
views
.
prefill_using_DOI
,
name
=
'
prefill_using_DOI
'
),
url
(
r
'
^prefill_using_identifier$
'
,
views
.
PrefillUsingIdentifierView
.
as_view
(),
name
=
'
prefill_using_identifier
'
),
url
(
r
'
^prefill_using_identifier$
'
,
views
.
PrefillUsingIdentifierView
.
as_view
(),
url
(
r
'
^vet_commentary_requests$
'
,
views
.
vet_commentary_requests
,
name
=
'
vet_commentary_requests
'
),
name
=
'
prefill_using_identifier
'
),
url
(
r
'
^vet_commentary_request_ack/(?P<commentary_id>[0-9]+)$
'
,
views
.
vet_commentary_request_ack
,
name
=
'
vet_commentary_request_ack
'
),
url
(
r
'
^vet_commentary_requests$
'
,
views
.
vet_commentary_requests
,
name
=
'
vet_commentary_requests
'
),
url
(
r
'
^vet_commentary_request_ack/(?P<commentary_id>[0-9]+)$
'
,
views
.
vet_commentary_request_ack
,
name
=
'
vet_commentary_request_ack
'
),
]
]
This diff is collapsed.
Click to expand it.
commentaries/views.py
+
3
−
18
View file @
d7fa5ce5
import
datetime
import
feedparser
import
re
import
re
import
requests
import
requests
from
django.utils
import
timezone
from
django.shortcuts
import
get_object_or_404
,
render
from
django.shortcuts
import
get_object_or_404
,
render
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.contrib.auth.decorators
import
permission_required
from
django.contrib.auth.decorators
import
permission_required
...
@@ -40,7 +37,7 @@ class RequestCommentaryMixin(object):
...
@@ -40,7 +37,7 @@ class RequestCommentaryMixin(object):
kwargs
[
'
request_commentary_form
'
]
=
RequestCommentaryForm
()
kwargs
[
'
request_commentary_form
'
]
=
RequestCommentaryForm
()
context
=
super
(
RequestCommentaryMixin
,
self
).
get_context_data
(
**
kwargs
)
context
=
super
(
RequestCommentaryMixin
,
self
).
get_context_data
(
**
kwargs
)
context
[
'
existing_commentary
'
]
=
None
# context['request_commentary_form'].get_existing_commentary()
context
[
'
existing_commentary
'
]
=
None
context
[
'
doiform
'
]
=
DOIToQueryForm
()
context
[
'
doiform
'
]
=
DOIToQueryForm
()
context
[
'
identifierform
'
]
=
IdentifierToQueryForm
()
context
[
'
identifierform
'
]
=
IdentifierToQueryForm
()
return
context
return
context
...
@@ -276,7 +273,7 @@ class CommentaryListView(ListView):
...
@@ -276,7 +273,7 @@ class CommentaryListView(ListView):
def
get_queryset
(
self
):
def
get_queryset
(
self
):
'''
Perform search form here already to get the right pagination numbers.
'''
'''
Perform search form here already to get the right pagination numbers.
'''
self
.
form
=
self
.
form
(
self
.
request
.
GET
)
self
.
form
=
self
.
form
(
self
.
request
.
GET
)
if
self
.
form
.
is_valid
():
if
self
.
form
.
is_valid
()
and
self
.
form
.
has_changed
()
:
return
self
.
form
.
search_results
()
return
self
.
form
.
search_results
()
return
self
.
model
.
objects
.
vetted
().
order_by
(
'
-latest_activity
'
)
return
self
.
model
.
objects
.
vetted
().
order_by
(
'
-latest_activity
'
)
...
@@ -295,24 +292,12 @@ class CommentaryListView(ListView):
...
@@ -295,24 +292,12 @@ class CommentaryListView(ListView):
context
[
'
discipline
'
]
=
self
.
kwargs
[
'
discipline
'
]
context
[
'
discipline
'
]
=
self
.
kwargs
[
'
discipline
'
]
context
[
'
nrweeksback
'
]
=
self
.
kwargs
[
'
nrweeksback
'
]
context
[
'
nrweeksback
'
]
=
self
.
kwargs
[
'
nrweeksback
'
]
context
[
'
browse
'
]
=
True
context
[
'
browse
'
]
=
True
elif
not
any
(
argument
in
[
'
title
'
,
'
author
'
,
'
abstract
'
]
for
argument
in
self
.
request
.
GET
):
elif
not
any
(
self
.
request
.
GET
[
field
]
for
field
in
self
.
request
.
GET
):
context
[
'
recent
'
]
=
True
context
[
'
recent
'
]
=
True
return
context
return
context
def
browse
(
request
,
discipline
,
nrweeksback
):
"""
List all commentaries for discipline and period
"""
commentary_browse_list
=
Commentary
.
objects
.
vetted
(
discipline
=
discipline
,
latest_activity__gte
=
timezone
.
now
()
+
datetime
.
timedelta
(
weeks
=-
int
(
nrweeksback
)))
context
=
{
'
form
'
:
CommentarySearchForm
(),
'
discipline
'
:
discipline
,
'
nrweeksback
'
:
nrweeksback
,
'
commentary_browse_list
'
:
commentary_browse_list
}
return
render
(
request
,
'
commentaries/commentaries.html
'
,
context
)
def
commentary_detail
(
request
,
arxiv_or_DOI_string
):
def
commentary_detail
(
request
,
arxiv_or_DOI_string
):
commentary
=
get_object_or_404
(
Commentary
,
arxiv_or_DOI_string
=
arxiv_or_DOI_string
)
commentary
=
get_object_or_404
(
Commentary
,
arxiv_or_DOI_string
=
arxiv_or_DOI_string
)
comments
=
commentary
.
comment_set
.
all
()
comments
=
commentary
.
comment_set
.
all
()
...
...
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