X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=django_simple%2Ftodo%2Fforms.py;fp=django_simple%2Ftodo%2Fforms.py;h=45e78bf31a54d9284dc97b576181155a1afe2795;hb=d82a989eec06a167258ff6d644dd77292310ddda;hp=c279f08e7374cf5a64969ef65bc8f3e1998d7aca;hpb=4be82ca096484d9b43a91d42cd0b8168949233e5;p=django_unres.git diff --git a/django_simple/todo/forms.py b/django_simple/todo/forms.py index c279f08..45e78bf 100644 --- a/django_simple/todo/forms.py +++ b/django_simple/todo/forms.py @@ -495,6 +495,65 @@ class TaskForm_remd_a(forms.Form): self.add_error('md_2d',msg) +class TaskForm_dock(forms.Form): + name = forms.CharField(max_length=40,widget=forms.TextInput(attrs={'size':40, 'maxlength':40})) + + file1 = forms.FileField(label='Upload a PDB file1',required=False, + help_text='starting structure for chain1') + pdbid = forms.CharField(min_length=4,max_length=6,required=False, + widget=forms.TextInput(attrs={'size':6, 'maxlength':6, 'title':'PDB code or PDB code:chain id'}), + label='or PDB code (:chain)') + + + file2 = forms.FileField(label='Upload a PDB file2',required=False, + help_text='starting structure for chain2') + pdbid2 = forms.CharField(min_length=4,max_length=6,required=False, + widget=forms.TextInput(attrs={'size':6, 'maxlength':6, 'title':'PDB code or PDB code:chain id'}), + label='or PDB code (:chain)') + + + md_nstep = forms.IntegerField(label='NSTEP',initial=200000, + help_text='total number of steps') + md_seed = forms.IntegerField(label='SEED',initial=-39912345, + help_text='seed for random number generator') + + def clean(self): + cleaned_data = super(TaskForm_dock, self).clean() + + file1 = cleaned_data.get("file1") + pdbid = cleaned_data.get("pdbid") + file2 = cleaned_data.get("file2") + pdbid2 = cleaned_data.get("pdbid2") + + + if not (file1 or pdbid): + msg = 'no PDB file or code for chain1' + self.add_error('file1', msg) + + if not (file2 or pdbid2): + msg = 'no PDB file or code for chain2' + self.add_error('file2', msg) + + if pdbid: + msg=pdb_code_chain(pdbid) + if msg != '': + self.add_error('pdbid',msg) + + if file1: + msg=pdb_missing_res_chain(file1,'') + if msg != '': + self.add_error('file1',msg) + + if pdbid2: + msg=pdb_code_chain(pdbid2) + if msg != '': + self.add_error('pdbid2',msg) + + if file2: + msg=pdb_missing_res_chain(file2,'') + if msg != '': + self.add_error('file2',msg) + class TaskForm_list(forms.Form): name = forms.CharField(max_length=40,disabled=True,required=False)