Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iPPIDB
ippidb-web
Commits
e1e2eb31
Commit
e1e2eb31
authored
Jan 04, 2022
by
Hervé MENAGER
Browse files
add contributor detail page (first draft, WIP)
parent
3d2695de
Pipeline
#72633
failed with stage
in 11 minutes and 28 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/templates/about-contributor-card.html
0 → 100644
View file @
e1e2eb31
{% extends "about.html" %}
{% block title %}inhibitors of Protein-Protein Interaction Database{% endblock %}
{% block pagetitle %}Contributors{% endblock%}
{% block view_content %}
<div
class=
"row"
>
{{ object.get_contributor_firstname | capfirst }} {{ object.get_contributor_lastname | capfirst }} || {{ object.get_orcid_url }}
</div>
{% endblock %}
\ No newline at end of file
ippisite/ippidb/templates/about-contributors.html
View file @
e1e2eb31
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<tbody>
<tbody>
{% for contributor in object_list %}
{% for contributor in object_list %}
<tr>
<tr>
<td>
{{ contributor.get_contributor_firstname | capfirst }} {{ contributor.get_contributor_lastname | capfirst }}
</td>
<td>
<a
href=
"{{ contributor.id }}"
>
{{ contributor.get_contributor_firstname | capfirst }} {{ contributor.get_contributor_lastname | capfirst }}
</
a></
td>
<td><a
href=
"{{ contributor.get_orcid_url }}"
target=
"_blank"
>
{{ contributor.get_orcid }}
</a></td>
<td><a
href=
"{{ contributor.get_orcid_url }}"
target=
"_blank"
>
{{ contributor.get_orcid }}
</a></td>
</tr>
</tr>
{% endfor %}
{% endfor %}
...
...
ippisite/ippidb/urls.py
View file @
e1e2eb31
...
@@ -61,7 +61,8 @@ urlpatterns = [
...
@@ -61,7 +61,8 @@ urlpatterns = [
name
=
"physicochemistry"
,
name
=
"physicochemistry"
,
),
),
re_path
(
r
"^about-pca/$"
,
views
.
about_pca
,
name
=
"pca"
),
re_path
(
r
"^about-pca/$"
,
views
.
about_pca
,
name
=
"pca"
),
re_path
(
r
"^about-contributors/$"
,
views
.
ContributorsListView
.
as_view
(),
name
=
"contributors"
),
re_path
(
r
"^about-contributors/$"
,
views
.
ContributorListView
.
as_view
(),
name
=
"contributors"
),
re_path
(
r
"^about-contributors/(?P<pk>\d+)$"
,
views
.
ContributorDetailView
.
as_view
(),
name
=
"contributor_card"
),
re_path
(
r
"^targetcentric/$"
,
views
.
PDBView
.
as_view
(),
name
=
"cavities"
),
re_path
(
r
"^targetcentric/$"
,
views
.
PDBView
.
as_view
(),
name
=
"cavities"
),
re_path
(
r
"^targetcentric/networks$"
,
views
.
NetworkView
.
as_view
(),
name
=
"networks"
),
re_path
(
r
"^targetcentric/networks$"
,
views
.
NetworkView
.
as_view
(),
name
=
"networks"
),
re_path
(
r
"^api/"
,
include
(
ROUTER
.
urls
)),
re_path
(
r
"^api/"
,
include
(
ROUTER
.
urls
)),
...
...
ippisite/ippidb/views/__init__.py
View file @
e1e2eb31
...
@@ -32,7 +32,8 @@ from .about import (
...
@@ -32,7 +32,8 @@ from .about import (
about_pca
,
about_pca
,
about_pharmacology
,
about_pharmacology
,
about_physicochemistry
,
about_physicochemistry
,
ContributorsListView
,
ContributorListView
,
ContributorDetailView
,
)
)
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -103,7 +104,8 @@ __all__ = [
...
@@ -103,7 +104,8 @@ __all__ = [
about_pca
,
about_pca
,
about_pharmacology
,
about_pharmacology
,
about_physicochemistry
,
about_physicochemistry
,
ContributorsListView
,
ContributorListView
,
ContributorDetailView
,
PdbViewSet
,
PdbViewSet
,
DistanceViewSet
,
DistanceViewSet
,
PDBView
,
PDBView
,
...
...
ippisite/ippidb/views/about.py
View file @
e1e2eb31
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
iPPI-DB global statistics views
iPPI-DB global statistics views
"""
"""
import
re
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth
import
get_user_model
from
django.db.models
import
F
,
Count
,
FloatField
,
QuerySet
from
django.db.models
import
F
,
Count
,
FloatField
,
QuerySet
from
django.db.models.functions
import
Cast
,
Floor
from
django.db.models.functions
import
Cast
,
Floor
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
import
json
import
json
...
@@ -324,7 +324,7 @@ def get_contributor_firstname(self):
...
@@ -324,7 +324,7 @@ def get_contributor_firstname(self):
orcid
=
self
.
get_orcid
()
orcid
=
self
.
get_orcid
()
if
orcid
is
not
None
:
if
orcid
is
not
None
:
data
=
self
.
__orcid_json
data
=
self
.
__orcid_json
return
data
[
'
first_name
'
]
return
data
[
"
first_name
"
]
@
cached_orcid_json
@
cached_orcid_json
...
@@ -335,7 +335,7 @@ def get_contributor_lastname(self):
...
@@ -335,7 +335,7 @@ def get_contributor_lastname(self):
orcid
=
self
.
get_orcid
()
orcid
=
self
.
get_orcid
()
if
orcid
is
not
None
:
if
orcid
is
not
None
:
data
=
self
.
__orcid_json
data
=
self
.
__orcid_json
return
data
[
'
last_name
'
]
return
data
[
"
last_name
"
]
User
.
add_to_class
(
"get_orcid"
,
get_orcid
)
User
.
add_to_class
(
"get_orcid"
,
get_orcid
)
...
@@ -345,9 +345,11 @@ User.add_to_class("get_contributor_firstname", get_contributor_firstname)
...
@@ -345,9 +345,11 @@ User.add_to_class("get_contributor_firstname", get_contributor_firstname)
User
.
add_to_class
(
"get_contributor_lastname"
,
get_contributor_lastname
)
User
.
add_to_class
(
"get_contributor_lastname"
,
get_contributor_lastname
)
class
Contributor
s
ListView
(
ListView
):
class
ContributorListView
(
ListView
):
"""
"""
Contributors list view
Contributors list view
This view lists the users with at least one accepted contribution
"""
"""
model
=
User
model
=
User
...
@@ -359,3 +361,20 @@ class ContributorsListView(ListView):
...
@@ -359,3 +361,20 @@ class ContributorsListView(ListView):
socialaccount__isnull
=
False
,
contributions_count__gt
=
0
socialaccount__isnull
=
False
,
contributions_count__gt
=
0
)
)
return
qs
return
qs
class
ContributorDetailView
(
DetailView
):
"""
Contributor detail view
"""
model
=
User
template_name
=
"about-contributor-card.html"
def
get_queryset
(
self
):
qs
=
super
().
get_queryset
()
qs
=
qs
.
annotate
(
contributions_count
=
Count
(
"contribution"
)).
filter
(
socialaccount__isnull
=
False
,
contributions_count__gt
=
0
)
return
qs
Write
Preview
Supports
Markdown
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