Пример #1
0
        def _to_row(error_doc):
            def _fmt_url(doc_id):
                view_name = 'render_form_data' \
                    if error_doc.doc_type in ["XFormInstance", "XFormArchived", "XFormError"] \
                    else 'download_form'
                return "<a class='ajax_dialog' href='%(url)s'>%(text)s</a>" % {
                    "url": reverse(view_name, args=[self.domain, doc_id]),
                    "text": _("View Form")
                }

            def _fmt_date(somedate):
                time = tz_utils.adjust_datetime_to_timezone(
                    somedate, pytz.utc.zone, self.timezone.zone)
                return time.strftime("%Y-%m-%d %H:%M:%S")

            return [
                _fmt_url(error_doc.get_id), error_doc.metadata.username
                if error_doc.metadata else EMPTY_USER,
                _fmt_date(error_doc.received_on),
                xmlns_to_name(self.domain,
                              error_doc.xmlns,
                              app_id=getattr(error_doc, 'app_id', None))
                if error_doc.metadata else EMPTY_FORM,
                SubmissionErrorType.display_name_by_doc_type(
                    error_doc.doc_type), error_doc.problem or EMPTY_ERROR
            ]
Пример #2
0
 def _to_row(error_doc):
     def _fmt_url(doc_id):
         return "<a class='ajax_dialog' href='%s'>View Form</a>" % reverse('download_form', args=[self.domain, doc_id])
     
     def _fmt_date(somedate):
         time = tz_utils.adjust_datetime_to_timezone(somedate, pytz.utc.zone, self.timezone.zone)
         return time.strftime("%Y-%m-%d %H:%M:%S")
     
     return [_fmt_url(error_doc.get_id),
             error_doc.metadata.username if error_doc.metadata else EMPTY_USER,
             _fmt_date(error_doc.received_on),
             xmlns_to_name(self.domain, error_doc.xmlns, app_id=getattr(error_doc, 'app_id', None)) if error_doc.metadata else EMPTY_FORM,
             SubmissionErrorType.display_name_by_doc_type(error_doc.doc_type),
             error_doc.problem or EMPTY_ERROR]
Пример #3
0
 def _to_row(error_doc):
     def _fmt_url(doc_id):
         view_name = 'render_form_data' \
             if error_doc.doc_type in ["XFormInstance", "XFormArchived", "XFormError"] \
             else 'download_form'
         return "<a class='ajax_dialog' href='%(url)s'>%(text)s</a>" % {
             "url": reverse(view_name, args=[self.domain, doc_id]),
             "text": _("View Form")
         }
     
     def _fmt_date(somedate):
         time = tz_utils.adjust_datetime_to_timezone(somedate, pytz.utc.zone, self.timezone.zone)
         return time.strftime("%Y-%m-%d %H:%M:%S")
     
     return [_fmt_url(error_doc.get_id),
             error_doc.metadata.username if error_doc.metadata else EMPTY_USER,
             _fmt_date(error_doc.received_on),
             xmlns_to_name(self.domain, error_doc.xmlns, app_id=getattr(error_doc, 'app_id', None)) if error_doc.metadata else EMPTY_FORM,
             SubmissionErrorType.display_name_by_doc_type(error_doc.doc_type),
             error_doc.problem or EMPTY_ERROR]