diff --git a/ippisite/ippidb/forms.py b/ippisite/ippidb/forms.py index f4de40caa0caaf6dbc221ebc8d2b9e4d9bf01430..6e62583a5759a0e825dacf99763d58f6b80b7bb5 100644 --- a/ippisite/ippidb/forms.py +++ b/ippisite/ippidb/forms.py @@ -215,6 +215,19 @@ UNIT_CONCENTRATION = ( ('nano', 'nM'), ('pico','pM'), ) + + +ADMINISTRATION_MODE = [ + ("Enteral", + [('', "Oral"), ('', "Sublingual"), ('', "Rectal")]), + ("Parenteral", + [('', "Inhalational"), ('', "Intravenous"), ('', "Intramuscular"), ('', "Subcutaneous"), ('', "Intra-arterial"), ('', "Intra-articular"), ('', "Intrathecal"), ('', "Intradermal"), ('', "Transdermal")]), + ("Local", + [('', "Skin topical"), ('', "Intranasal"), ('', "Ocular drops"), ('', "Mucosal-throat"), ('', "Vagina"), ('', "Mouth"), ('', "Ear"), ('', "Transdermal")]), +] + + + class BaseTestsFormSet(BaseFormSet): def add_fields(self, form, index): super(BaseTestsFormSet, self).add_fields(form, index) @@ -226,16 +239,17 @@ class BaseTestsFormSet(BaseFormSet): form.fields["activityDesc_protein_bound_construct"] = forms.ModelChoiceField(queryset=TestActivityDescription.objects.values_list('protein_bound_construct', flat=True).distinct(),empty_label=None, widget=forms.Select(attrs={'class': 'form-control'})) form.fields["activityRes_compound"] = forms.ChoiceField(widget=forms.Select(attrs={'class': 'form-control'})) form.fields["activityRes_activity_type"] = forms.ModelChoiceField(required=False,widget=forms.Select(attrs={'class': 'form-control'}),queryset=CompoundActivityResult.objects.values_list('activity_type',flat=True).distinct(),empty_label=None) - form.fields["unit_concentration"] = forms.CharField(required=True, widget=forms.Select(choices=UNIT_CONCENTRATION, attrs={'class':'form-control'})) + form.fields["activityRes_unit_concentration"] = forms.CharField(required=True, widget=forms.Select(choices=UNIT_CONCENTRATION, attrs={'class':'form-control'})) form.fields["activityRes_activity"] = forms.IntegerField(forms.NumberInput(attrs={'class': 'form-control'})) form.fields["cytotoxDesc_name"] = forms.ModelChoiceField(queryset=TestCytotoxDescription.objects.values_list('test_name', flat=True).distinct(), empty_label=None, required=False, widget=forms.Select(attrs={'required':'required', 'class':'form-control'})) form.fields["cytotoxDesc_cell_line"] = forms.ModelChoiceField(queryset=CellLine.objects.all(), empty_label=None, widget=forms.Select(attrs={'class': 'form-control'}),required=False) form.fields["cytotoxDesc_compound_concentration"] = forms.DecimalField(required=False) + form.fields["cytotoxRes_unit_concentration"] = forms.CharField(required=True, widget=forms.Select(choices=UNIT_CONCENTRATION, attrs={'class':'form-control'})) form.fields["cytotoxRes_compound"] = forms.ChoiceField(widget=forms.Select(attrs={'class': 'form-control'}),required=False) form.fields["cytotoxRes_toxicity"] = forms.ModelChoiceField(queryset=CompoundCytotoxicityResult.objects.values_list('toxicity', flat=True).distinct(), empty_label=None,required=False,widget=forms.Select(attrs={'class': 'form-control'})) form.fields["pkDesc_name"] = forms.ModelChoiceField(queryset=TestPKDescription.objects.values_list('test_name', flat=True).distinct(), empty_label=None,required=False, widget=forms.Select(attrs={'required':'required', 'class':'form-control'})) form.fields["pkDesc_organism"] = forms.ModelChoiceField(queryset=Taxonomy.objects.all(),empty_label=None, widget=forms.Select(attrs={'class': 'form-control'}),required=False) - form.fields["pkDesc_administration_mode"] = forms.ModelChoiceField(required=False,widget=forms.Select(attrs={'class': 'form-control'}),queryset=TestPKDescription.objects.values_list('administration_mode',flat=True).distinct(),empty_label=None) + form.fields["pkDesc_administration_mode"] = forms.CharField(required=True, widget=forms.Select(choices=ADMINISTRATION_MODE, attrs={'class':'form-control'})) form.fields["pkDesc_dose"] = forms.IntegerField(required=False) form.fields["pkDesc_dose_interval"] = forms.IntegerField(required=False) form.fields["pkDesc_concentration"] = forms.DecimalField(required=False) diff --git a/ippisite/ippidb/static/js/ippidb.js b/ippisite/ippidb/static/js/ippidb.js index 078d920e13896cce890c506a7191d7f51c0fb3f8..a473a89e357063464f3a1131e19596bd2a09c14c 100644 --- a/ippisite/ippidb/static/js/ippidb.js +++ b/ippisite/ippidb/static/js/ippidb.js @@ -160,3 +160,4 @@ $(document).ready(function() { } }); }); + diff --git a/ippisite/ippidb/templates/CompoundForm.html b/ippisite/ippidb/templates/CompoundForm.html index 15e4c870d3207fee847e7d9933dd34be842dea5e..e61474db2432937ce9909ce917a64c6bc2c79249 100644 --- a/ippisite/ippidb/templates/CompoundForm.html +++ b/ippisite/ippidb/templates/CompoundForm.html @@ -76,6 +76,9 @@ </table> <input class="submit_button" type="submit" value="{% trans "Next step" %}"/> </form> + <div style="display:none;"> + Empty form: {{ wizard.form.empty_form }} + </div> </div> </div> diff --git a/ippisite/ippidb/templates/TestsForm.html b/ippisite/ippidb/templates/TestsForm.html index db617c9a9874138a3765e87f7ac9a9a19e210fad..f1d48db37897a754b3b3790b03d901a297d815bc 100644 --- a/ippisite/ippidb/templates/TestsForm.html +++ b/ippisite/ippidb/templates/TestsForm.html @@ -47,7 +47,7 @@ {{ form.test_type }} <label class="form-control-placeholder">Test type</label> </div> - <div class="input_field form-group"> + <div id="test-type" class="input_field form-group"> {{ form.activityDesc_type }} <label class="form-control-placeholder">Activity type</label> </div> @@ -81,7 +81,7 @@ <label class="form-control-placeholder">Activity type</label> </div> <div class="input_field form-group"> - {{ form.unit_concentration }} + {{ form.activityRes_unit_concentration }} <label class="form-control-placeholder">Concentration unit</label> </div> <div class="input_field form-group"> @@ -111,6 +111,10 @@ {{ form.cytotoxDesc_compound_concentration }} <label class="form-control-placeholder">Compound concentration</label> </div> + <div class="input_field form-group"> + {{ form.cytotoxRes_unit_concentration }} + <label class="form-control-placeholder">Concentration unit</label> + </div> </div> </div> <div class="div_test_cytotoxicity_res"> @@ -210,11 +214,19 @@ <div> <input type="button" id="ck-button-long" class="add-test" value="Add Test" onclick="cloneMoreEmpty('.div_test:last', 'TestsForm');"/> </div> + + {% endfor %} {% endif %} </table> <input class="submit_button" type="submit" name="{{ wizard.steps.next }}" value="{% trans "Submit" %}"/> </form> + <div style="display:none;"> + Empty form: + {% for field in wizard.form.empty_form %} + test: {{ field }} + {% endfor %} + </div> </div> </div> {% endblock %} \ No newline at end of file