Skip to content
Snippets Groups Projects
Commit 1a815e2e authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

improve SessionFormWizard gears for IPPI-DB contributions

Former-commit-id: a5fa539b34073de3c8df4e4137a04d3a4e33bdf6
parent fce2cbad
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,10 @@ from django import forms
from django.db import models
from .models import Bibliography, Protein, ProteinDomainComplex, Ppi, PpiComplex
class IdForm(forms.Form):
id = forms.CharField(label="",max_length=100, widget=forms.TextInput(attrs={'placeholder': 'PubMed ID / DOI / Patent ID'}))
class IdForm(ModelForm):
class Meta:
model = Bibliography
fields = ['source','id_source']
class BibliographyForm(ModelForm):
class Meta:
......
......@@ -57,7 +57,17 @@ TEMPLATES = {"IdForm": "IdForm.html",
class IppiWizard(SessionWizardView):
def get_template_names(self):
return [TEMPLATES[self.steps.current]]
def process_step(self, form):
"""
This method overrides the one used to postprocess the form data.
The added code just sets the form model for use in later forms
when appropriate
"""
if self.steps.current=='IdForm':
self.instance_dict['BibliographyForm'] = form.instance
return self.get_form_step_data(form)
def done(self, form_list, **kwargs):
return render(self.request, '/admin-session/add.html', {
'form_data': [form.cleaned_data for form in form_list],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment