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
0e577360
Commit
0e577360
authored
Jan 03, 2022
by
Hervé MENAGER
Browse files
reformat/cleanup code in contribution wizard module
parent
f90c4f5d
Pipeline
#72546
failed with stages
in 10 minutes and 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/views/contribute.py
View file @
0e577360
...
...
@@ -26,7 +26,6 @@ FORMS = [
(
"TestCytotoxDescriptionFormSet"
,
ippidb_forms
.
TestCytotoxDescriptionFormSet
),
(
"TestPKDescriptionFormSet"
,
ippidb_forms
.
TestPKDescriptionFormSet
),
(
"SaveInDB"
,
ippidb_forms
.
SaveInDBForm
),
# ("TestsForm", ippidb_forms.TestsFormSet),
]
FORMS_TAB_TITLE
=
{
...
...
@@ -75,9 +74,7 @@ FORMS_DESC = {
"CompoundForm"
:
gettext_lazy
(
"CompoundForm_desc"
),
"TestsForm"
:
gettext_lazy
(
"TestsForm_desc"
),
"ActivityDescriptionFormSet"
:
gettext_lazy
(
"ActivityDescriptionFormSet_desc"
),
"TestCytotoxDescriptionFormSet"
:
gettext_lazy
(
"TestCytotoxDescriptionFormSet_desc"
),
"TestCytotoxDescriptionFormSet"
:
gettext_lazy
(
"TestCytotoxDescriptionFormSet_desc"
),
"TestPKDescriptionFormSet"
:
gettext_lazy
(
"TestPKDescriptionFormSet_desc"
),
"SaveInDB"
:
gettext_lazy
(
"SaveInDB_desc"
),
}
...
...
@@ -412,17 +409,10 @@ class IppiWizard(
with
transaction
.
atomic
():
# Step 1-2 Biblio
bibliography
=
form_dict
[
"BibliographyForm"
].
save
()
# print("Step 1&2: Biblio #%i" % bibliography.pk)
# Step 3 & 6 Ppi
ppi
=
form_dict
[
"PpiForm"
].
save
()
# print("Step 3&6: Ppi #%i" % ppi.pk)
# Step 4 Architecture
# form_dict["ProteinDomainComplexTypeForm"]
# TODO !!!!
# print("Step 4: TODO")
# Step 5 Complexes
complexes
=
dict
()
for
f
in
form_dict
[
"ProteinDomainComplexForm"
]:
...
...
@@ -443,9 +433,6 @@ class IppiWizard(
raise
Exception
(
"Unknown complex type %s"
%
complex_type
)
models
.
PpiComplex
.
objects
.
create
(
ppi
=
ppi
,
complex
=
complex
,
cc_nb
=
cc_nb
)
complexes
[
f
.
cleaned_data
[
"protein"
].
pk
]
=
complex
# print("Step 5: %i complexes" % len(complexes))
# Step 7 Compounds
compounds
=
dict
()
created_compounds
=
0
...
...
@@ -492,8 +479,6 @@ class IppiWizard(
ca
.
nb_copy_compounds
=
1
ca
.
activation_mode
=
"U"
ca
.
save
()
# print("Step 7: %i compounds, %i of which are new" % (len(compounds), created_compounds))
# Step 8.1 Activity Tests
# We set the dicts to translates attributes into model
bound_complexes
=
[
...
...
@@ -510,11 +495,6 @@ class IppiWizard(
)
form_dict
[
"ActivityDescriptionFormSet"
].
is_valid
()
form_dict
[
"ActivityDescriptionFormSet"
].
save
()
# print("Step 8.1: %i activity tests and %i results" % (
# len(activity_tests),
# sum([t.compoundactivityresult_set.count() for t in activity_tests])
# ))
# Step 8.2 Cytotox Tests
if
self
.
show_cytotox_test
():
# We set the dicts to translates attributes into model
...
...
@@ -523,13 +503,6 @@ class IppiWizard(
form_dict
[
"TestCytotoxDescriptionFormSet"
].
instance
=
bibliography
form_dict
[
"TestCytotoxDescriptionFormSet"
].
is_valid
()
form_dict
[
"TestCytotoxDescriptionFormSet"
].
save
()
# print("Step 8.2: %i cytotox tests and %i results" % (
# len(cytotox_tests),
# sum([t.compoundcytotoxicityresult_set.count() for t in cytotox_tests])
# ))
# else:
# print("Step 8.2: skipping cytotox tests")
# Step 8.3 PK Tests
if
self
.
show_pharmacokinetic_test
():
# We set the dicts to translates attributes into model
...
...
@@ -538,13 +511,6 @@ class IppiWizard(
form_dict
[
"TestPKDescriptionFormSet"
].
instance
=
bibliography
form_dict
[
"TestPKDescriptionFormSet"
].
is_valid
()
form_dict
[
"TestPKDescriptionFormSet"
].
save
()
# print("Step 8.3: %i PK tests and %i results" % (
# len(pk_tests),
# sum([t.compoundpkresult_set.count() for t in pk_tests])
# ))
# else:
# print("Step 8.3: skipping PK tests")
# re-save the ppi to update its name (
ppi
.
save
()
...
...
@@ -555,7 +521,6 @@ class IppiWizard(
if
not
created
:
# update its date of modification
contribution
.
save
()
# super().done(form_list=form_list, **kwargs)
messages
.
success
(
self
.
request
,
f
"Congratulations! Dear
{
contribution
.
contributor
.
username
}
,"
...
...
Write
Preview
Markdown
is supported
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