Skip to content

Tables

hypha.apply.projects.tables

BaseInvoiceTable

Bases: Table

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'data-tippy-content': lambda record: invoice_number, 'data-tippy-placement': 'top', 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

InvoiceDashboardTable

Bases: BaseInvoiceTable

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'data-tippy-content': lambda record: invoice_number, 'data-tippy-placement': 'top', 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

project class-attribute instance-attribute

project = Column(verbose_name=gettext_lazy('Project Name'))

Meta

fields class-attribute instance-attribute
fields = ['requested_at', 'invoice_number', 'status', 'project']
model class-attribute instance-attribute
model = Invoice
order_by class-attribute instance-attribute
order_by = ['-requested_at']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}

render_project

render_project(value)
Source code in hypha/apply/projects/tables.py
def render_project(self, value):
    text = (textwrap.shorten(value.title, width=30, placeholder="..."),)
    return text[0]

FinanceInvoiceTable

Bases: BaseInvoiceTable

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'data-tippy-content': lambda record: invoice_number, 'data-tippy-placement': 'top', 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

vendor_name class-attribute instance-attribute

vendor_name = Column(verbose_name=gettext_lazy('Vendor Name'), empty_values=())

selected class-attribute instance-attribute

selected = LabeledCheckboxColumn(accessor=A('pk'), attrs={'input': {'class': 'js-batch-select'}, 'th__input': {'class': 'js-batch-select-all'}})

Meta

fields class-attribute instance-attribute
fields = ['selected', 'invoice_date', 'requested_at', 'vendor_name', 'invoice_number', 'invoice_amount', 'status']
model class-attribute instance-attribute
model = Invoice
orderable class-attribute instance-attribute
orderable = True
sequence class-attribute instance-attribute
sequence = fields
order_by class-attribute instance-attribute
order_by = ['-requested_at', 'invoice_date']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}
row_attrs class-attribute instance-attribute
row_attrs = {'data-record-id': lambda record: id}

render_vendor_name

render_vendor_name(record)
Source code in hypha/apply/projects/tables.py
def render_vendor_name(self, record):
    if record.project.vendor:
        return record.project.vendor
    return record.project.user

InvoiceListTable

Bases: BaseInvoiceTable

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'data-tippy-content': lambda record: invoice_number, 'data-tippy-placement': 'top', 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

project class-attribute instance-attribute

project = Column(verbose_name=gettext_lazy('Project Name'))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='project__submission__page')

lead class-attribute instance-attribute

lead = Column(verbose_name=gettext_lazy('Lead'), accessor='project__lead')

Meta

fields class-attribute instance-attribute
fields = ['requested_at', 'invoice_number', 'status', 'project', 'lead', 'fund']
model class-attribute instance-attribute
model = Invoice
orderable class-attribute instance-attribute
orderable = True
order_by class-attribute instance-attribute
order_by = ['-requested_at']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}

render_project

render_project(value)
Source code in hypha/apply/projects/tables.py
def render_project(self, value):
    text = (textwrap.shorten(value.title, width=30, placeholder="..."),)
    return text[0]

AdminInvoiceListTable

Bases: BaseInvoiceTable

invoice_number class-attribute instance-attribute

invoice_number = LinkColumn('funds:projects:invoice-detail', verbose_name=gettext_lazy('Invoice Number'), args=[A('project__pk'), A('pk')], attrs={'td': {'class': 'js-title'}, 'a': {'data-tippy-content': lambda record: invoice_number, 'data-tippy-placement': 'top', 'class': "truncate inline-block w-[calc(100%-2rem)] after:content-[''] after:block"}})

status class-attribute instance-attribute

status = Column(attrs={'td': {'data-actions': render_invoice_actions, 'class': 'js-actions'}})

requested_at class-attribute instance-attribute

requested_at = DateColumn(verbose_name=gettext_lazy('Submitted'))

invoice_date class-attribute instance-attribute

invoice_date = DateColumn(verbose_name=gettext_lazy('Invoice date'))

project class-attribute instance-attribute

project = Column(verbose_name=gettext_lazy('Project Name'))

selected class-attribute instance-attribute

selected = LabeledCheckboxColumn(accessor=A('pk'), attrs={'input': {'class': 'js-batch-select'}, 'th__input': {'class': 'js-batch-select-all'}})

Meta

fields class-attribute instance-attribute
fields = ['selected', 'invoice_date', 'requested_at', 'invoice_number', 'status', 'project']
model class-attribute instance-attribute
model = Invoice
orderable class-attribute instance-attribute
orderable = True
sequence class-attribute instance-attribute
sequence = fields
order_by class-attribute instance-attribute
order_by = ['-requested_at']
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'invoices-table'}
row_attrs class-attribute instance-attribute
row_attrs = {'data-record-id': lambda record: id}

render_project

render_project(value)
Source code in hypha/apply/projects/tables.py
def render_project(self, value):
    text = (textwrap.shorten(value.title, width=30, placeholder="..."),)
    return text[0]

BaseProjectsTable

Bases: Table

title class-attribute instance-attribute

title = LinkColumn('funds:projects:detail', text=lambda r: shorten(title, width=30, placeholder='...'), args=[A('pk')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status'))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

end_date class-attribute instance-attribute

end_date = DateColumn(verbose_name=gettext_lazy('End Date'), accessor='proposed_end')

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = (
            '<svg class="icon"><use xlink:href="#exclamation-point"></use></svg>'
        )
    else:
        display = ""

    display += f"{ record.report_config.outstanding_reports() } outstanding"
    return mark_safe(display)

ProjectsDashboardTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:projects:detail', text=lambda r: shorten(title, width=30, placeholder='...'), args=[A('pk')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status'))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

end_date class-attribute instance-attribute

end_date = DateColumn(verbose_name=gettext_lazy('End Date'), accessor='proposed_end')

Meta

fields class-attribute instance-attribute
fields = ['title', 'status', 'fund', 'reporting', 'last_payment_request', 'end_date']
model class-attribute instance-attribute
model = Project
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
orderable class-attribute instance-attribute
orderable = False
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = (
            '<svg class="icon"><use xlink:href="#exclamation-point"></use></svg>'
        )
    else:
        display = ""

    display += f"{ record.report_config.outstanding_reports() } outstanding"
    return mark_safe(display)

ProjectsAssigneeDashboardTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:projects:detail', text=lambda r: shorten(title, width=30, placeholder='...'), args=[A('pk')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status'))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

end_date class-attribute instance-attribute

end_date = DateColumn(verbose_name=gettext_lazy('End Date'), accessor='proposed_end')

Meta

fields class-attribute instance-attribute
fields = ['title', 'fund', 'lead', 'reporting', 'last_payment_request', 'end_date']
model class-attribute instance-attribute
model = Project
orderable class-attribute instance-attribute
orderable = False
exclude class-attribute instance-attribute
exclude = ['status']
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = (
            '<svg class="icon"><use xlink:href="#exclamation-point"></use></svg>'
        )
    else:
        display = ""

    display += f"{ record.report_config.outstanding_reports() } outstanding"
    return mark_safe(display)

PAFForReviewDashboardTable

Bases: Table

date_requested class-attribute instance-attribute

date_requested = DateColumn(verbose_name=gettext_lazy('Date requested'), accessor='created_at', orderable=True)

title class-attribute instance-attribute

title = LinkColumn('funds:projects:detail', text=lambda r: shorten(title, width=30, placeholder='...'), accessor='project__title', args=[A('project__pk')], orderable=False)

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='pk', orderable=False)

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='project__submission__page', orderable=False)

assignee class-attribute instance-attribute

assignee = Column(verbose_name=gettext_lazy('Assignee'), accessor='user', orderable=False)

Meta

fields class-attribute instance-attribute
fields = ['date_requested', 'title', 'fund', 'status', 'assignee']
model class-attribute instance-attribute
model = PAFApprovals
template_name class-attribute instance-attribute
template_name = 'funds/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'paf-review-table'}

order_date_requested

order_date_requested(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_date_requested(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}created_at")

    return qs, True

render_status

render_status(record)
Source code in hypha/apply/projects/tables.py
def render_status(self, record):
    if record.user:
        return _("Waiting for approval")
    else:
        return _("Waiting for assignee")

ProjectsListTable

Bases: BaseProjectsTable

title class-attribute instance-attribute

title = LinkColumn('funds:projects:detail', text=lambda r: shorten(title, width=30, placeholder='...'), args=[A('pk')])

status class-attribute instance-attribute

status = Column(verbose_name=gettext_lazy('Status'), accessor='get_status_display', order_by=('status'))

fund class-attribute instance-attribute

fund = Column(verbose_name=gettext_lazy('Fund'), accessor='submission__page')

reporting class-attribute instance-attribute

reporting = Column(verbose_name=gettext_lazy('Reporting'), accessor='pk')

last_payment_request class-attribute instance-attribute

last_payment_request = DateColumn()

end_date class-attribute instance-attribute

end_date = DateColumn(verbose_name=gettext_lazy('End Date'), accessor='proposed_end')

Meta

fields class-attribute instance-attribute
fields = ['title', 'status', 'lead', 'fund', 'reporting', 'last_payment_request', 'end_date']
model class-attribute instance-attribute
model = Project
orderable class-attribute instance-attribute
orderable = True
order_by class-attribute instance-attribute
order_by = ('-end_date')
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

order_reporting

order_reporting(qs, is_descending)
Source code in hypha/apply/projects/tables.py
def order_reporting(self, qs, is_descending):
    direction = "-" if is_descending else ""

    qs = qs.order_by(f"{direction}outstanding_reports")

    return qs, True

render_reporting

render_reporting(record)
Source code in hypha/apply/projects/tables.py
def render_reporting(self, record):
    if not hasattr(record, "report_config"):
        return "-"

    if record.report_config.is_up_to_date():
        return "Up to date"

    if record.report_config.has_very_late_reports():
        display = (
            '<svg class="icon"><use xlink:href="#exclamation-point"></use></svg>'
        )
    else:
        display = ""

    display += f"{ record.report_config.outstanding_reports() } outstanding"
    return mark_safe(display)

order_end_date

order_end_date(qs, desc)
Source code in hypha/apply/projects/tables.py
def order_end_date(self, qs, desc):
    return qs.by_end_date(desc), True

ReportListTable

Bases: Table

project class-attribute instance-attribute

project = LinkColumn('funds:projects:reports:detail', text=lambda r: shorten(title, width=30, placeholder='...'), args=[A('pk')])

report_period class-attribute instance-attribute

report_period = Column(accessor='pk')

submitted class-attribute instance-attribute

submitted = DateColumn()

lead class-attribute instance-attribute

lead = Column(accessor='project__lead')

Meta

fields class-attribute instance-attribute
fields = ['project', 'submitted']
sequence class-attribute instance-attribute
sequence = ['project', 'report_period', '...']
model class-attribute instance-attribute
model = Report
template_name class-attribute instance-attribute
template_name = 'application_projects/tables/table.html'
attrs class-attribute instance-attribute
attrs = {'class': 'projects-table'}

render_report_period

render_report_period(record)
Source code in hypha/apply/projects/tables.py
def render_report_period(self, record):
    return f"{record.start} to {record.end_date}"

render_invoice_actions

render_invoice_actions(table, record)
Source code in hypha/apply/projects/tables.py
def render_invoice_actions(table, record):
    user = table.context["user"]
    actions = get_invoice_possible_transition_for_user(user, invoice=record)
    return json.dumps([str(slugify(action)) for action, _ in actions])