Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
iPPIDB
ippidb-web
Commits
9d86faa8
Commit
9d86faa8
authored
8 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
experiment in trying to save Model objects as json for the wizard
Former-commit-id: b2181d605c00bb890226f2c4213d22f2498aa534
parent
24f2716d
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/db.sqlite3.REMOVED.git-id
+1
-1
1 addition, 1 deletion
ippisite/db.sqlite3.REMOVED.git-id
ippisite/ippidb/views.py
+18
-4
18 additions, 4 deletions
ippisite/ippidb/views.py
with
19 additions
and
5 deletions
ippisite/db.sqlite3.REMOVED.git-id
+
1
−
1
View file @
9d86faa8
067f156ca37c93920f1a15dac26337a9956fccbb
\ No newline at end of file
ea2455328a1ef5effe52858804d0c303950ec7cf
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ippisite/ippidb/views.py
+
18
−
4
View file @
9d86faa8
...
...
@@ -2,10 +2,11 @@ import ippidb
from
django.shortcuts
import
render
from
django.http
import
HttpResponseRedirect
from
django.forms.models
import
model_to_dict
from
formtools.wizard.views
import
SessionWizardView
,
NamedUrlSessionWizardView
from
.forms
import
IdForm
,
BibliographyForm
,
PDBForm
,
ProteinForm
,
ProteinDomainComplexTypeForm
,
ProteinDomainComplexForm
,
PpiForm
,
ProteinFormSet
from
.models
import
Protein
from
.models
import
Protein
,
Bibliography
,
Taxonomy
from
.ws
import
get_pdb_uniprot_mapping
def
index
(
request
):
...
...
@@ -46,6 +47,19 @@ class IppiWizard(NamedUrlSessionWizardView):
def
get_template_names
(
self
):
return
[
TEMPLATES
[
self
.
steps
.
current
]]
def
get_form_instance
(
self
,
step
):
if
self
.
steps
.
current
==
'
BibliographyForm
'
:
data
=
self
.
storage
.
get_step_data
(
'
IdForm
'
)
obj
=
Bibliography
(
**
data
)
return
obj
if
self
.
steps
.
current
==
'
ProteinForm
'
:
data
=
self
.
storage
.
get_step_data
(
'
PDBForm
'
).
getlist
(
'
set
'
)
proteins
=
[]
for
data_item
in
data
:
data_item
[
'
organism
'
]
=
Taxonomy
.
objects
.
get
(
pk
=
data_item
[
'
organism
'
])
proteins
.
append
(
Protein
(
**
data_item
))
return
Ol
(
proteins
)
def
process_step
(
self
,
form
):
"""
This method overrides the one used to postprocess the form data.
...
...
@@ -54,8 +68,8 @@ class IppiWizard(NamedUrlSessionWizardView):
"""
if
self
.
steps
.
current
==
'
IdForm
'
:
form
.
instance
.
autofill
()
self
.
instance_dict
[
'
BibliographyForm
'
]
=
form
.
instance
el
if
self
.
steps
.
current
==
'
PDBForm
'
:
return
model_to_dict
(
form
.
instance
)
if
self
.
steps
.
current
==
'
PDBForm
'
:
uniprot_ids
=
get_pdb_uniprot_mapping
(
form
.
cleaned_data
[
'
pdb_id
'
])
proteins
=
[]
for
uniprot_id
in
uniprot_ids
:
...
...
@@ -66,7 +80,7 @@ class IppiWizard(NamedUrlSessionWizardView):
p
.
uniprot_id
=
uniprot_ids
[
0
]
p
.
autofill
()
proteins
.
append
(
p
)
self
.
instance_dict
[
'
ProteinForm
'
]
=
Ol
(
proteins
)
return
{
'
set
'
:
[
model_to_dict
(
p
,
exclude
=
[
'
molecular_functions
'
])
for
p
in
proteins
]}
return
self
.
get_form_step_data
(
form
)
def
done
(
self
,
form_list
,
**
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