Пример #1
0
 def get_context_data(self, **kwargs):
     result = super().get_context_data(**kwargs)
     accept = self.request.event.accept_template
     ack = self.request.event.ack_template
     reject = self.request.event.reject_template
     update = self.request.event.update_template
     result["accept"] = MailTemplateForm(instance=accept,
                                         read_only=True,
                                         event=self.request.event)
     result["ack"] = MailTemplateForm(instance=ack,
                                      read_only=True,
                                      event=self.request.event)
     result["reject"] = MailTemplateForm(instance=reject,
                                         read_only=True,
                                         event=self.request.event)
     result["update"] = MailTemplateForm(instance=update,
                                         read_only=True,
                                         event=self.request.event)
     pks = [
         template.pk if template else None
         for template in [accept, ack, reject, update]
     ]
     result["other"] = [
         MailTemplateForm(instance=template,
                          read_only=True,
                          event=self.request.event)
         for template in self.request.event.mail_templates.exclude(
             pk__in=[pk for pk in pks if pk])
     ]
     return result
Пример #2
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     accept = self.request.event.accept_template
     ack = self.request.event.ack_template
     reject = self.request.event.reject_template
     update = self.request.event.update_template
     context['accept'] = MailTemplateForm(instance=accept,
                                          read_only=True,
                                          event=self.request.event)
     context['ack'] = MailTemplateForm(instance=ack,
                                       read_only=True,
                                       event=self.request.event)
     context['reject'] = MailTemplateForm(instance=reject,
                                          read_only=True,
                                          event=self.request.event)
     context['update'] = MailTemplateForm(instance=update,
                                          read_only=True,
                                          event=self.request.event)
     pks = [
         template.pk if template else None
         for template in [accept, ack, reject, update]
     ]
     context['other'] = [
         MailTemplateForm(instance=template,
                          read_only=True,
                          event=self.request.event)
         for template in self.request.event.mail_templates.exclude(
             pk__in=[pk for pk in pks if pk])
     ]
     return context
Пример #3
0
 def get_context_data(self, *args, **kwargs):
     ctx = super().get_context_data(*args, **kwargs)
     accept = self.request.event.accept_template
     ack = self.request.event.ack_template
     reject = self.request.event.reject_template
     update = self.request.event.update_template
     ctx['accept'] = MailTemplateForm(instance=accept,
                                      read_only=True,
                                      event=self.request.event)
     ctx['ack'] = MailTemplateForm(instance=ack,
                                   read_only=True,
                                   event=self.request.event)
     ctx['reject'] = MailTemplateForm(instance=reject,
                                      read_only=True,
                                      event=self.request.event)
     ctx['update'] = MailTemplateForm(instance=update,
                                      read_only=True,
                                      event=self.request.event)
     ctx['other'] = [
         MailTemplateForm(instance=template,
                          read_only=True,
                          event=self.request.event)
         for template in self.request.event.mail_templates.exclude(
             pk__in=[accept.pk, ack.pk, reject.pk, update.pk])
     ]
     return ctx