Ok thanks,let me clean up and test with a simpler mixin; the short answer helped as it maybe points to the forms . Not sure but …eventhough in the layout ive defined the fields to be used exactly but maybe the issue was with the fields= ‘all’?
class CommonLayout (Layout):
def __init__(self, *args, **kwargs):
super().__init__(
Div(
Div(Field('StudyActionNo',readonly=True), style="font-family: Dancing Script", css_class='col-md-2'),
Div (Field('StudyName',readonly=True), css_class='col-md-3'),
Div (Field('ProjectPhase', readonly=True), css_class='col-md-3'),
Div (Field('InitialRisk', readonly=True), css_class='col-md-2'),
Div (Field('ResidualRisk', readonly=True), css_class='col-md-2'),
#Div (Field('QueSeries', readonly=True), css_class='col-md-3'),
#-somehow not working Div (Field('DueDate', readonly=True), css_class='col-md-2'),
css_class='row',
),
Div (
Div (Field('Guidewords', rows=1 ,readonly=True), css_class='col-md-5'),
Div (Field('Deviation', rows=1 ,readonly=True), css_class='col-md-5'),
Div (Field('Revision', rows=1 ,readonly=True), css_class='col-md-2'),
Div (Field('Cause', rows=8 ,readonly=True), css_class='col-md-12'),
Div (Field('Safeguard', rows=8, readonly=True), css_class='col-md-12'),
#Div (Field('Consequence',rows=8, readonly=True,style="font-family: Great Vibes;font-size: 60px"), css_class='col-md-12'), - Left this commented as it shows how to add style to text box directly
Div (Field('Consequence',rows=8, readonly=True), css_class='col-md-12'),
Div (Field('Recommendations',rows=8, readonly=True), css_class='col-md-12'),
css_class='row',#-dont know why i have to put this in so it aligns to left
),
#needs these hidden fields otherwise it passes blank values into the model- need to see if can do some other way
Div (
Div (Field('Facility', type="hidden")),
Div (Field('DueDate', type="hidden")), #yhs added for testing duedate gone missing upon submission
Div (Field('Disipline', type="hidden")),
Div (Field('Subdisipline', type="hidden")),
Div (Field('Organisation', type="hidden")),
Div (Field('QueSeries', type="hidden")),
),
)
class frmUpdateActioneeForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(frmUpdateActioneeForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.form_show_labels = True
self.helper.form_method = 'POST'
self.fields['Response'].required = True #yhs added. now response is compulsory. need to test if upload empty sheets. what will happen?
#self.helper.add_input(Submit('Upload', 'Next...', css_class='btn btn-outline-dark float-right col-md-1'))
#self.helper.add_input(Submit('Cancel', 'Cancel', css_class='btn btn-outline-dark float-right col-md-1'))
self.helper.layout = Layout(
CommonLayout(),
Div (
Div ('Response', required=True, css_class='col-md-12'),#YHS Testing
#Div ('Attachment', css_class='col-md-12'),
Div ('FutureAction', css_class='col-md-12'),
css_class='row',
),
)
class Meta:
model = ActionItems
fields = '__all__'