Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
InSillyClo-web
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
InSillyClo
InSillyClo-web
Commits
bd6b3021
Commit
bd6b3021
authored
2 weeks ago
by
Bryan BRANCOTTE
Browse files
Options
Downloads
Patches
Plain Diff
add PCR field edition view
parent
5e2926ce
No related branches found
No related tags found
2 merge requests
!13
Edit view job
,
!7
Simulator
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/InSillyCloWeb/assemblies/forms.py
+27
-1
27 additions, 1 deletion
src/InSillyCloWeb/assemblies/forms.py
src/InSillyCloWeb/assemblies/urls.py
+1
-0
1 addition, 0 deletions
src/InSillyCloWeb/assemblies/urls.py
src/InSillyCloWeb/assemblies/views.py
+21
-1
21 additions, 1 deletion
src/InSillyCloWeb/assemblies/views.py
with
49 additions
and
2 deletions
src/InSillyCloWeb/assemblies/forms.py
+
27
−
1
View file @
bd6b3021
import
insillyclo.main
from
crispy_forms
import
layout
from
crispy_forms.helper
import
FormHelper
from
django
import
forms
...
...
@@ -5,7 +6,7 @@ from django.forms import modelformset_factory
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
gettext
as
_
from
assemblies.models
import
Assembly
,
InputPart
from
assemblies.models
import
Assembly
,
InputPart
,
SimulatorJob
SEP_CHOICES
=
(
(
"
.
"
,
"
Dot
"
),
...
...
@@ -54,6 +55,31 @@ class SimulatorDataForm(forms.Form):
)
class
PCRModelForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
SimulatorJob
fields
=
(
'
pcr_pairs_str
'
,)
helper
=
FormHelper
()
helper
.
form_tag
=
False
primers_file
=
forms
.
FileField
(
required
=
False
,
label
=
_
(
'
Primers file
'
),
help_text
=
_
(
'
A CSV file where the header is
\"
primerId;sequence
\"
.
\n
Note that the separator is
\"
;
\"
.
'
),
)
def
save
(
self
,
commit
=
True
):
instance
:
SimulatorJob
=
super
().
save
(
commit
=
commit
)
if
not
commit
or
self
.
cleaned_data
[
'
primers_file
'
]
is
None
:
return
instance
output_fp
=
instance
.
job_dir
/
insillyclo
.
main
.
DEFAULT_CONCENTRATIONS_FILENAME
with
open
(
output_fp
,
'
wb
'
)
as
fh
:
for
chunk
in
self
.
cleaned_data
[
'
primers_file
'
].
chunks
():
fh
.
write
(
chunk
)
return
instance
class
AssemblyForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Assembly
...
...
This diff is collapsed.
Click to expand it.
src/InSillyCloWeb/assemblies/urls.py
+
1
−
0
View file @
bd6b3021
...
...
@@ -68,6 +68,7 @@ urlpatterns = [
path
(
'
assembly-simulator/create/<str:step>/
'
,
simulator_wizard
,
name
=
'
simulator-create-step
'
),
path
(
'
assembly-simulator/create/
'
,
simulator_wizard
,
name
=
'
simulator-create
'
),
path
(
'
assembly-simulator/<slug:uuid>/
'
,
views
.
JobSimulatorResult
.
as_view
(),
name
=
'
simulator-detail
'
),
path
(
'
assembly-simulator-job/<slug:uuid>/pcr/
'
,
views
.
JobPCREdit
.
as_view
(),
name
=
'
simulator-pcr-edit
'
),
path
(
'
assembly/<int:pk>/download/
'
,
views
.
AssemblyDetailDownloadView
.
as_view
(),
name
=
'
assembly-download
'
),
path
(
'
assembly/<int:pk>/delete/
'
,
views
.
AssemblyDeleteView
.
as_view
(),
name
=
'
assembly-delete
'
),
path
(
'
fragment
'
,
views
.
show_fragment
,
name
=
'
fragment
'
),
...
...
This diff is collapsed.
Click to expand it.
src/InSillyCloWeb/assemblies/views.py
+
21
−
1
View file @
bd6b3021
...
...
@@ -7,7 +7,7 @@ from django.http import HttpResponse
from
django.shortcuts
import
render
,
redirect
from
django.urls
import
reverse_lazy
from
django.utils.translation
import
gettext_lazy
as
_
from
django.views.generic
import
ListView
,
DetailView
,
View
,
DeleteView
from
django.views.generic
import
ListView
,
DetailView
,
View
,
DeleteView
,
UpdateView
from
django.views.generic.detail
import
SingleObjectMixin
from
.
import
mixins
...
...
@@ -114,3 +114,23 @@ class JobSimulatorResult(DetailView):
model
=
models
.
SimulatorJob
slug_field
=
'
uuid
'
slug_url_kwarg
=
'
uuid
'
class
JobPCREdit
(
UpdateView
,
):
model
=
models
.
SimulatorJob
form_class
=
forms
.
PCRModelForm
slug_field
=
'
uuid
'
slug_url_kwarg
=
'
uuid
'
success_url
=
reverse_lazy
(
"
assemblies:home
"
)
template_name
=
"
assemblies/form_host.html
"
def
form_valid
(
self
,
form
):
self
.
object
.
run_simulator
()
return
super
().
form_valid
(
form
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
context
[
"
title
"
]
=
_
(
"
PCR primers to use for gel simulation
"
)
return
context
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