Skip to content
Snippets Groups Projects
Commit cb8ffb60 authored by Rachel TORCHET's avatar Rachel TORCHET
Browse files

Update templates and add formset for ProteinDomainComplexForm step

Former-commit-id: dd7136370f6e1e34a14350d5db56ba31d606822d
parent f4155a91
No related branches found
No related tags found
No related merge requests found
Showing with 21 additions and 32 deletions
...@@ -102,17 +102,13 @@ class ComplexCompositionForm(forms.Form): ...@@ -102,17 +102,13 @@ class ComplexCompositionForm(forms.Form):
def __init__(self,*args,**kwargs): def __init__(self,*args,**kwargs):
super(ComplexCompositionForm, self).__init__(*args, **kwargs) super(ComplexCompositionForm, self).__init__(*args, **kwargs)
""" TODO : Filter based on submited PDBid"""
self.fields['complex_protein'].queryset=Protein.objects.filter(pk__in=[569,570]) self.fields['complex_protein'].queryset=Protein.objects.filter(pk__in=[569,570])
class BaseProteinDomainComplexFormSet(BaseModelFormSet): ComplexCompositionFormSet = formset_factory(ComplexCompositionForm, extra=2)
def __init__(self, *args, **kwargs): formset= ComplexCompositionFormSet()
super(BaseProteinDomainComplexFormSet,self).__init__(*args, **kwargs) print(formset.is_valid())
self.queryset = ProteinDomainComplex.objects.none()
ProteinDomainComplexFormSet = modelformset_factory(ProteinDomainComplex, form=ProteinDomainComplexForm, formset=BaseProteinDomainComplexFormSet, extra=2)
formset= ProteinDomainComplexFormSet()
#print(formset)
class PpiForm(ModelForm): class PpiForm(ModelForm):
...@@ -154,7 +150,7 @@ class BaseCompoundFormSet(BaseFormSet): ...@@ -154,7 +150,7 @@ class BaseCompoundFormSet(BaseFormSet):
form.fields["molecule"] = forms.CharField(widget=forms.Select(choices=TYPE_MOLECULE)) form.fields["molecule"] = forms.CharField(widget=forms.Select(choices=TYPE_MOLECULE))
form.fields["molecule_comp"] = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Molecule composition', 'required':'required'})) form.fields["molecule_comp"] = forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Molecule composition', 'required':'required'}))
CompoundFormSet = formset_factory(CompoundForm, formset=BaseCompoundFormSet, extra=2, max_num=500, can_delete=True) CompoundFormSet = formset_factory(CompoundForm, formset=BaseCompoundFormSet, max_num=500, can_delete=True)
formset = CompoundFormSet() formset = CompoundFormSet()
......
...@@ -13,6 +13,9 @@ Description: IPPI-DB Theme ...@@ -13,6 +13,9 @@ Description: IPPI-DB Theme
.clear_all{ .clear_all{
font-size: 14px; font-size: 14px;
color: #007bff;
text-decoration: none;
font-family: "BrandonGrotesqueReg"
} }
#main-header{ #main-header{
...@@ -616,7 +619,6 @@ font-size: 42px; ...@@ -616,7 +619,6 @@ font-size: 42px;
padding: 10px; padding: 10px;
min-height: 150px; min-height: 150px;
text-align: center; text-align: center;
min-height: 350px;
border-top: 1px solid #2D96FA; border-top: 1px solid #2D96FA;
} }
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
{% endif %} {% endif %}
</table> </table>
<input class="submit_button" type="submit" value="{% trans "Next step" %}"/> <input class="submit_button" type="submit" value="{% trans "Next step" %}"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<!--<div class="add_form"> <!--<div class="add_form">
<div id="{{ form.compound_name.id_for_label }}" onclick="">Add compound<div> <div id="{{ form.compound_name.id_for_label }}" onclick="">Add compound<div>
</div>--> </div>-->
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
<input type="hidden" name="ippi_wizard-current_step" value="CompoundForm" id="id_ippi_wizard-current_step"/> <input type="hidden" name="ippi_wizard-current_step" value="CompoundForm" id="id_ippi_wizard-current_step"/>
</table> </table>
<input type="submit" value="{% trans "Next step" %}"/> <input type="submit" value="{% trans "Next step" %}"/>
<a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
{% endif %} {% endif %}
</table> </table>
<input class="submit_button" type="submit" value="{% trans "Get Infos" %}"/> <input class="submit_button" type="submit" value="{% trans "Get Infos" %}"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
{% endif %} {% endif %}
</table> </table>
<input class="submit_button" type="submit" value="{% trans "Next step" %}"/> <input class="submit_button" type="submit" value="{% trans "Next step" %}"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -45,11 +45,9 @@ ...@@ -45,11 +45,9 @@
</div> </div>
{% endif %} {% endif %}
</table> </table>
<input type="hidden" name="ippi_wizard-current_step" value="PpiForm" id="id_ippi_wizard-current_step"/>
<input type="hidden" name="ippi_wizard-current_step" value="PpiAndPpiComplexForm" id="id_ippi_wizard-current_step"/>
<input class="submit_button" type="submit" name="{{ wizard.steps.next }}" value="{% trans "Next step" %}"/> <input class="submit_button" type="submit" name="{{ wizard.steps.next }}" value="{% trans "Next step" %}"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</form> </form>
<div> </div>
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -28,23 +28,22 @@ ...@@ -28,23 +28,22 @@
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
<table> <table>
{{ wizard.management_form }} {{ wizard.form.errors}}
{{ wizard.form.non_field_errors}} {{ wizard.form.non_field_errors}}
{% if wizard.form.forms %} {% if wizard.form.forms %}
{{ wizard.form.management_form }} {{ wizard.form.management_form }}
{% for form in wizard.form.forms %} {% for form in wizard.form.forms %}
{% endfor %}
{% else %}
<div class="inline_box_complex_long"> <div class="inline_box_complex_long">
<div class="input_field"> {{ form.complex_type }}</div> <div class="input_field"> {{ form.complex_type }}</div>
<div class="input_field"> {{ form.complex_protein }}</div> <div class="input_field"> {{ form.complex_protein }}</div>
<div class="input_field"> {{ form.complex_domain }}</div> <div class="input_field"> {{ form.complex_domain }}</div>
<div class="input_field"> {{ form.ppc_copy_nb }}</div> <div class="input_field"> {{ form.ppc_copy_nb }}</div>
</div> </div>
{% endfor %}
{% endif %} {% endif %}
<input type="hidden" name="ippi_wizard-current_step" value="ProteinDomainComplexForm" id="id_ippi_wizard-current_step"/>
</table> </table>
<input type="hidden" name="ippi_wizard-current_step" value="ProteinDomainComplexForm" id="id_ippi_wizard-current_step"/>
<input class="submit_button" type="submit" value="{% trans "Next step" %}"/>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -90,8 +90,8 @@ If your PPI complex is not among them, please select « Custom »</p> ...@@ -90,8 +90,8 @@ If your PPI complex is not among them, please select « Custom »</p>
</div> </div>
{% endif %} {% endif %}
</table> </table>
<input class="submit_button" type="submit" value="{% trans "Next step" %}"/> <input type="hidden" name="ippi_wizard-current_step" value="ProteinDomainComplexTypeForm" id="id_ippi_wizard-current_step"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div> <input class="submit_button" type="submit" value="{% trans "Next step" %}"/>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
{% endif %} {% endif %}
</table> </table>
<input type="submit" value="{% trans "submit" %}"/> <input type="submit" value="{% trans "submit" %}"/>
<a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
{% block form %}{% endblock %} {% block form %}{% endblock %}
</div> </div>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
<div class="view-content"> <div class="view-content">
</div> </div>
<input class="submit_button" type="submit" name="{{ wizard.steps.next }}" value="{% trans "Next step" %}"/>
<div class="clear_button"><a href="{% url 'ippidb' %}?reset" class="clear_all">Clear all</a></div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -4,7 +4,7 @@ from django.shortcuts import render ...@@ -4,7 +4,7 @@ from django.shortcuts import render
from django.http import HttpResponseRedirect, Http404 from django.http import HttpResponseRedirect, Http404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from formtools.wizard.views import SessionWizardView, NamedUrlSessionWizardView from formtools.wizard.views import SessionWizardView, NamedUrlSessionWizardView
from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ComplexCompositionForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, ProteinDomainComplexFormSet, PpiForm, PpiComplexForm, ProteinFormSet,TestsForm, CompoundForm, CompoundFormSet from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ComplexCompositionForm, ComplexCompositionFormSet, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, PpiComplexForm, ProteinFormSet,TestsForm, CompoundForm, CompoundFormSet
from .models import Protein, Bibliography, ProteinDomainComplex, ProteinDomainBoundComplex, RefCompoundBiblio, TestActivityDescription, Compound, Ppi, Disease, Taxonomy from .models import Protein, Bibliography, ProteinDomainComplex, ProteinDomainBoundComplex, RefCompoundBiblio, TestActivityDescription, Compound, Ppi, Disease, Taxonomy
from .ws import get_pdb_uniprot_mapping from .ws import get_pdb_uniprot_mapping
...@@ -59,7 +59,7 @@ FORMS = [("IdForm", ippidb.forms.IdForm), ...@@ -59,7 +59,7 @@ FORMS = [("IdForm", ippidb.forms.IdForm),
("PDBForm", ippidb.forms.PDBForm), ("PDBForm", ippidb.forms.PDBForm),
("ProteinDomainComplexTypeForm", ("ProteinDomainComplexTypeForm",
ippidb.forms.ProteinDomainComplexTypeForm), ippidb.forms.ProteinDomainComplexTypeForm),
("ProteinDomainComplexForm", ippidb.forms.ComplexCompositionForm), ("ProteinDomainComplexForm", ippidb.forms.ComplexCompositionFormSet),
("PpiForm", ippidb.forms.PpiForm), ("PpiForm", ippidb.forms.PpiForm),
("CompoundForm", ippidb.forms.CompoundFormSet), ("CompoundForm", ippidb.forms.CompoundFormSet),
("TestsForm", ippidb.forms.TestsForm),] ("TestsForm", ippidb.forms.TestsForm),]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment