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
6a96b7ce
Commit
6a96b7ce
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Fix ordering of theses
parent
a8a52c14
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theses/views.py
+10
-13
10 additions, 13 deletions
theses/views.py
with
10 additions
and
13 deletions
theses/views.py
+
10
−
13
View file @
6a96b7ce
...
...
@@ -4,7 +4,7 @@ from django.utils import timezone
from
django.shortcuts
import
get_object_or_404
,
render
from
django.contrib.auth.decorators
import
permission_required
from
django.contrib
import
messages
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.core.urlresolvers
import
reverse_lazy
from
django.http
import
HttpResponseRedirect
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.views.generic.list
import
ListView
...
...
@@ -86,24 +86,24 @@ class ThesisListView(ListView):
# Context is not saved to View object by default
self
.
pre_context
=
self
.
kwargs
# Browse i
s
discipline is given
# Browse i
f
discipline is given
if
'
discipline
'
in
self
.
kwargs
:
self
.
pre_context
[
'
browse
'
]
=
True
# Queryset for browsing
if
self
.
kwargs
.
get
(
'
browse
'
,
False
):
return
self
.
model
.
objects
.
vetted
()
.
filter
(
discipline
=
self
.
kwargs
[
'
discipline
'
],
latest_activity__gte
=
timezone
.
now
()
+
datetime
.
timedelta
(
weeks
=-
int
(
self
.
kwargs
[
'
nrweeksback
'
]))
,
)
return
(
self
.
model
.
objects
.
vetted
()
.
filter
(
discipline
=
self
.
kwargs
[
'
discipline
'
],
latest_activity__gte
=
timezone
.
now
()
+
datetime
.
timedelta
(
weeks
=-
int
(
self
.
kwargs
[
'
nrweeksback
'
]))
)
.
order_by
(
'
-latest_activity
'
)
)
# Queryset for searchform is processed by managers
form
=
self
.
form
(
self
.
request
.
GET
)
if
form
.
is_valid
()
and
form
.
has_changed
():
return
self
.
model
.
objects
.
search_results
(
form
)
return
self
.
model
.
objects
.
search_results
(
form
)
.
order_by
(
'
-latest_activity
'
)
self
.
pre_context
[
'
recent
'
]
=
True
return
self
.
model
.
objects
.
vetted
()
return
self
.
model
.
objects
.
vetted
()
.
order_by
(
'
-latest_activity
'
)
def
get_context_data
(
self
,
**
kwargs
):
# Update the context data from `get_queryset`
...
...
@@ -120,8 +120,5 @@ def thesis_detail(request, thesislink_id):
thesislink
=
get_object_or_404
(
ThesisLink
,
pk
=
thesislink_id
)
form
=
CommentForm
()
author_replies
=
comments
.
filter
(
is_author_reply
=
True
)
context
=
{
'
thesislink
'
:
thesislink
,
'
author_replies
'
:
author_replies
,
'
form
'
:
form
}
context
=
{
'
thesislink
'
:
thesislink
,
'
form
'
:
form
}
return
render
(
request
,
'
theses/thesis_detail.html
'
,
context
)
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