Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
0db00446
Commit
0db00446
authored
7 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add disease filter in compound view
Former-commit-id: d0f86f34e2ca979d310a4b3e6e1a2a91feac8fb4
parent
07d40c93
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
ippisite/ippidb/templates/compound_list.html
+21
-2
21 additions, 2 deletions
ippisite/ippidb/templates/compound_list.html
ippisite/ippidb/views.py
+10
-2
10 additions, 2 deletions
ippisite/ippidb/views.py
with
31 additions
and
4 deletions
ippisite/ippidb/templates/compound_list.html
+
21
−
2
View file @
0db00446
...
...
@@ -40,7 +40,7 @@
{% for ppi in selected_ppis %}
<div
class=
"form-check col-12"
>
<label
class=
"form-check-label"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
checked
value=
"{{ ppi.id }}"
onchange=
"this.form.submit()"
name=
"ppi"
style=
"width: auto; margin-right:
inherit!
;"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
checked
value=
"{{ ppi.id }}"
onchange=
"this.form.submit()"
name=
"ppi"
style=
"width: auto; margin-right:
1em
;"
>
{{ ppi.name }}
</label>
</div>
...
...
@@ -48,12 +48,31 @@
{% for ppi in ppis|slice:":5" %}
<div
class=
"form-check col-12"
>
<label
class=
"form-check-label"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
value=
"{{ ppi.id }}"
onchange=
"this.form.submit()"
name=
"ppi"
style=
"width: auto; margin-right:
inherit!
;"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
value=
"{{ ppi.id }}"
onchange=
"this.form.submit()"
name=
"ppi"
style=
"width: auto; margin-right:
1em
;"
>
{{ ppi.name }}
</label>
</div>
{% endfor %}
</fieldset>
<fieldset
class=
"form-group row border border-info m-2"
>
<div
class=
"bg-info col-12"
><legend>
Disease
</legend></div>
{% for disease in selected_diseases %}
<div
class=
"form-check col-12"
>
<label
class=
"form-check-label"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
checked
value=
"{{ disease.id }}"
onchange=
"this.form.submit()"
name=
"disease"
style=
"width: auto; margin-right: 1em;"
>
{{ disease.name }}
</label>
</div>
{% endfor %}
{% for disease in diseases|slice:":5" %}
<div
class=
"form-check col-12"
>
<label
class=
"form-check-label"
>
<input
class=
"form-check-input text-right"
type=
"checkbox"
value=
"{{ disease.id }}"
onchange=
"this.form.submit()"
name=
"disease"
style=
"width: auto; margin-right: 1em;"
>
{{ disease.name }}
</label>
</div>
{% endfor %}
</fieldset>
</form>
</div>
<main
class=
"col-12 col-md-9 col-xl-10 pl-md-5 bd-content"
role=
"main"
>
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/views.py
+
10
−
2
View file @
0db00446
...
...
@@ -5,7 +5,7 @@ from django.http import HttpResponseRedirect, Http404
from
django.core.paginator
import
Paginator
,
EmptyPage
,
PageNotAnInteger
from
formtools.wizard.views
import
SessionWizardView
,
NamedUrlSessionWizardView
from
.forms
import
IdForm
,
BibliographyForm
,
PDBForm
,
ProteinForm
,
ProteinDomainComplexTypeForm
,
ProteinDomainComplexForm
,
PpiForm
,
PpiComplexForm
,
ProteinFormSet
,
ActivityForm
,
CompoundForm
,
CompoundFormSet
from
.models
import
Protein
,
Bibliography
,
ProteinDomainComplex
,
RefCompoundBiblio
,
TestActivityDescription
,
Compound
,
Ppi
from
.models
import
Protein
,
Bibliography
,
ProteinDomainComplex
,
RefCompoundBiblio
,
TestActivityDescription
,
Compound
,
Ppi
,
Disease
from
.ws
import
get_pdb_uniprot_mapping
...
...
@@ -193,8 +193,12 @@ def compound_list(request):
# if filtering on "action on PPI"
if
request
.
GET
.
get
(
'
ppi
'
):
compounds
=
compounds
.
filter
(
compoundaction__ppi__id__in
=
request
.
GET
.
getlist
(
'
ppi
'
))
if
request
.
GET
.
get
(
'
disease
'
):
compounds
=
compounds
.
filter
(
compoundaction__ppi__diseases__id__in
=
request
.
GET
.
getlist
(
'
disease
'
))
selected_ppis
=
Ppi
.
objects
.
filter
(
id__in
=
request
.
GET
.
getlist
(
'
ppi
'
))
ppis
=
Ppi
.
objects
.
exclude
(
id__in
=
request
.
GET
.
getlist
(
'
ppi
'
))
selected_diseases
=
Disease
.
objects
.
filter
(
id__in
=
request
.
GET
.
getlist
(
'
disease
'
))
diseases
=
Disease
.
objects
.
exclude
(
id__in
=
request
.
GET
.
getlist
(
'
disease
'
))
# handle pagination in compounds list
paginator
=
Paginator
(
compounds
,
5
)
page
=
request
.
GET
.
get
(
'
page
'
)
...
...
@@ -206,4 +210,8 @@ def compound_list(request):
except
EmptyPage
:
# If page is out of range (e.g. 9999), deliver last page of results.
compounds
=
paginator
.
page
(
paginator
.
num_pages
)
return
render
(
request
,
'
compound_list.html
'
,
{
'
compounds
'
:
compounds
,
'
selected_ppis
'
:
selected_ppis
,
'
ppis
'
:
ppis
})
return
render
(
request
,
'
compound_list.html
'
,
{
'
compounds
'
:
compounds
,
'
selected_ppis
'
:
selected_ppis
,
'
ppis
'
:
ppis
,
'
selected_diseases
'
:
selected_diseases
,
'
diseases
'
:
diseases
})
This diff is collapsed.
Click to expand it.
Preview
0%
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