2 개의 버튼이있는 modelform이있어서 다른 기능을 수행하려고합니다. 내 modelform :다른 기능을 modelform 버튼 django에서 수행
나는에 다른 기능을 수행 할class jobpostForm(ModelForm):
class Meta:
model = jobpost
fields = ('job_title','job_type','job_location','job_description','start_date','end_date','country','how_to_apply')
widgets = {
'job_type':RadioSelect(),
'job_location':TextInput(attrs={'size':'70'}),
'job_description':Textarea(attrs={'cols':200, 'rows':10}),
'start_date':TextInput(attrs={
'class': 'datepicker',
'data-date-format': 'mm/dd/yyyy',
}),
'end_date':TextInput(attrs={
'class': 'datepicker',
'data-date-format': 'mm/dd/yyyy',
}),
}
def __init__(self, *args, **kwargs):
#super(jobpostForm, self).__init__(*args, **kwargs)
#self.fields['start_date'].widget.attrs['class'] = 'datepicker'
super(jobpostForm, self).__init__(*args, **kwargs)
#self.fields['ref_id'].widget = forms.HiddenInput()
self.helper = FormHelper()
self.helper.form_class = 'horizontal-form'
self.helper.form_id = 'id-jobpostform'
self.helper.form_class = 'blueForms'
self.helper.form_method = 'post'
self.helper.form_action = '/portal/next/post/'
self.helper.add_input(Submit('submit_addcontent', 'Preview'))
self.helper.add_input(Submit('submit_addcontent', 'Submit'))
super(jobpostForm, self).__init__(*args, **kwargs)
제출 preview.How 내가 내보기에서 액세스 할 수 있습니까? 여러 가지 방법으로 상황에 접근 할 수있는 GET 요청에 대한 데이터
와
- :
나는 이것을 한번도 시도한 적이 없다. 어디서 이걸 배웠습니까? – catherine
이것을 확인하십시오 https://django-crispy-forms.readthedocs.org/en/d-0/tags.html –
아, 좋아 ... 나는 장고에 내장 된 기능이라고 생각했다. 제 3 자 앱에서 가져온 것입니다. 그 이후로, 나는 제 프로젝트에서 제 3 자 앱을 사용하지 않습니다. 나는 장고에 붙어 ... – catherine