Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iric-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
bioinfo_iric
iric-data
Commits
9e471a8f
Commit
9e471a8f
authored
4 years ago
by
Jean-Philippe Laverdure
Browse files
Options
Downloads
Patches
Plain Diff
reformat to use ListView
parent
a231e96f
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
portal/urls.py
+1
-1
1 addition, 1 deletion
portal/urls.py
portal/views/secure/dataset.py
+11
-8
11 additions, 8 deletions
portal/views/secure/dataset.py
with
12 additions
and
9 deletions
portal/urls.py
+
1
−
1
View file @
9e471a8f
...
@@ -106,7 +106,7 @@ urlpatterns = [
...
@@ -106,7 +106,7 @@ urlpatterns = [
path
(
'
secure/dataset/<slug:iric_data_id>
'
,
DataSetInitDetailsView
.
as_view
(),
name
=
'
user.dataset-details-view-iric-data-id
'
),
path
(
'
secure/dataset/<slug:iric_data_id>
'
,
DataSetInitDetailsView
.
as_view
(),
name
=
'
user.dataset-details-view-iric-data-id
'
),
path
(
'
secure/dataset/download/<int:pk>
'
,
DataSetDownload
.
as_view
(),
name
=
'
user.dataset-download
'
),
path
(
'
secure/dataset/download/<int:pk>
'
,
DataSetDownload
.
as_view
(),
name
=
'
user.dataset-download
'
),
path
(
'
secure/dataset/download/<slug:iric_data_id>
'
,
DataSetDownload
.
as_view
(),
name
=
'
user.dataset-download-iric-data-id
'
),
path
(
'
secure/dataset/download/<slug:iric_data_id>
'
,
DataSetDownload
.
as_view
(),
name
=
'
user.dataset-download-iric-data-id
'
),
path
(
'
secure/user/<s
lug
:sim>/datasets
'
,
DataSetFileListJSONView
.
as_view
(),
name
=
'
admin.user-dataset-json-list
'
),
path
(
'
secure/user/<s
tr
:sim>/datasets
'
,
DataSetFileListJSONView
.
as_view
(),
name
=
'
admin.user-dataset-json-list
'
),
# ShareGroups
# ShareGroups
path
(
'
secure/sharegroups/list/json/
'
,
ShareGroupJSONListView
.
as_view
(),
name
=
'
secure.sharegroup-json-list
'
),
path
(
'
secure/sharegroups/list/json/
'
,
ShareGroupJSONListView
.
as_view
(),
name
=
'
secure.sharegroup-json-list
'
),
...
...
This diff is collapsed.
Click to expand it.
portal/views/secure/dataset.py
+
11
−
8
View file @
9e471a8f
...
@@ -7,21 +7,21 @@ from django.contrib import messages
...
@@ -7,21 +7,21 @@ from django.contrib import messages
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
django.db.models
import
Q
from
django.db.models
import
Q
from
django.http
import
(
HttpResponse
,
HttpResponseForbidden
,
from
django.http
import
(
HttpResponse
,
HttpResponseForbidden
,
HttpResponseRedirect
)
HttpResponseRedirect
,
JsonResponse
)
from
django.template
import
defaultfilters
as
filters
from
django.template
import
defaultfilters
as
filters
from
django.template.loader
import
render_to_string
from
django.template.loader
import
render_to_string
from
django.urls
import
reverse
,
reverse_lazy
from
django.urls
import
reverse
,
reverse_lazy
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext
from
django.utils.translation
import
ugettext
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic
import
(
CreateView
,
DeleteView
,
DetailView
,
from
django.views.generic
import
(
CreateView
,
DeleteView
,
DetailView
,
ListView
,
TemplateView
,
UpdateView
)
TemplateView
,
UpdateView
)
from
portal.forms
import
DataSetDisplayFieldsForm
,
DataSetForm
from
portal.forms
import
DataSetDisplayFieldsForm
,
DataSetForm
from
portal.models
import
DataFile
,
DataSet
,
Lab
,
Profile
,
ShareGroup
from
portal.models
import
DataFile
,
DataSet
,
Lab
,
Profile
,
ShareGroup
from
portal.views
import
(
ActivePageViewMixin
,
AjaxDatatableBackboneMixin
,
from
portal.views
import
(
ActivePageViewMixin
,
AjaxDatatableBackboneMixin
,
CreateViewMixin
,
DeleteViewMixin
,
JSONListView
,
CreateViewMixin
,
DeleteViewMixin
,
JSONListView
,
JSONView
,
LogMixin
,
StaffViewMixin
,
LogMixin
,
StaffViewMixin
,
SuccessMessageMixin
,
SuccessMessageMixin
,
UpdateViewMixin
)
UpdateViewMixin
)
logger
=
logging
.
getLogger
(
'
debug
'
)
logger
=
logging
.
getLogger
(
'
debug
'
)
...
@@ -305,13 +305,13 @@ class DataSetFileListView(DataSetDetailsView):
...
@@ -305,13 +305,13 @@ class DataSetFileListView(DataSetDetailsView):
return
HttpResponse
(
'
\n
'
.
join
(
files
+
annotations
),
content_type
=
"
text/plain
"
)
return
HttpResponse
(
'
\n
'
.
join
(
files
+
annotations
),
content_type
=
"
text/plain
"
)
class
DataSetFileListJSONView
(
StaffViewMixin
,
JSON
View
):
class
DataSetFileListJSONView
(
StaffViewMixin
,
List
View
):
model
=
DataSet
model
=
DataSet
slug_url_kwarg
=
'
iric_data_id
'
slug_url_kwarg
=
'
iric_data_id
'
slug_field
=
'
iric_data_id
'
slug_field
=
'
iric_data_id
'
def
get_queryset
(
self
):
def
get_queryset
(
self
):
profile
=
Profile
.
objects
.
filter
(
accountname
=
self
.
kwargs
.
get
(
'
s
lug
'
))
profile
=
Profile
.
objects
.
filter
(
accountname
=
self
.
kwargs
.
get
(
'
s
im
'
))
return
super
().
get_queryset
().
filter
(
return
super
().
get_queryset
().
filter
(
Q
(
created_by
=
profile
)
Q
(
created_by
=
profile
)
|
Q
(
share_profiles
=
profile
)
|
Q
(
share_profiles
=
profile
)
...
@@ -321,8 +321,11 @@ class DataSetFileListJSONView(StaffViewMixin, JSONView):
...
@@ -321,8 +321,11 @@ class DataSetFileListJSONView(StaffViewMixin, JSONView):
def
get_data
(
self
):
def
get_data
(
self
):
o
=
self
.
get_object
()
o
=
self
.
get_object
()
meta
data
=
{
data
=
{
'
name
'
:
o
.
name
,
'
name
'
:
o
.
name
,
'
iric_data_id
'
:
o
.
iric_data_id
'
iric_data_id
'
:
o
.
iric_data_id
}
}
return
metadata
return
data
def
render_to_response
(
self
,
context
,
**
response_kwargs
):
return
JsonResponse
(
self
.
get_data
(),
**
response_kwargs
)
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