def __init__(self, *args, **kwargs): super(NoticeForm, self).__init__(*args, **kwargs) if self.instance.pk: self.fields['email_content'].widget.mce_attrs['app_instance_id'] = self.instance.pk else: self.fields['email_content'].widget.mce_attrs['app_instance_id'] = 0 initial_list = [] if self.instance.pk: initial_list.append(str(self.instance.num_days)) initial_list.append(str(self.instance.notice_time)) initial_list.append(str(self.instance.notice_type)) self.fields['notice_time_type'].initial = initial_list self.fields['email_content'].help_text = get_notice_token_help_text(self.instance)
def __init__(self, *args, **kwargs): super(NoticeForm, self).__init__(*args, **kwargs) if self.instance.pk: self.fields['email_content'].widget.mce_attrs['app_instance_id'] = self.instance.pk else: self.fields['email_content'].widget.mce_attrs['app_instance_id'] = 0 initial_list = [] if self.instance.pk: initial_list.append(str(self.instance.num_days)) initial_list.append(str(self.instance.notice_time)) initial_list.append(str(self.instance.notice_type)) self.fields['notice_time_type'].initial = initial_list self.fields['email_content'].help_text = get_notice_token_help_text(self.instance)