Skip to content

Staff assignments

hypha.apply.funds.views.staff_assignments

User module-attribute

User = get_user_model()

RoleColumn

Bases: Column

render

render(value, record)
Source code in hypha/apply/funds/views/staff_assignments.py
def render(self, value, record):
    return AssignedReviewers.objects.filter(
        reviewer=record,
        role=self.verbose_name,
        submission__status__in=active_statuses,
    ).count()

StaffAssignments

Bases: SingleTableMixin, ListView

model class-attribute instance-attribute

model = User

table_class class-attribute instance-attribute

table_class = StaffAssignmentsTable

table_pagination class-attribute instance-attribute

table_pagination = False

template_name class-attribute instance-attribute

template_name = 'funds/staff_assignments.html'

get_queryset

get_queryset()
Source code in hypha/apply/funds/views/staff_assignments.py
def get_queryset(self):
    # Only list staff.
    return self.model.objects.staff()

get_table_data

get_table_data()
Source code in hypha/apply/funds/views/staff_assignments.py
def get_table_data(self):
    table_data = super().get_table_data()
    reviewer_roles = ReviewerRole.objects.all().order_by("order")
    for data in table_data:
        for i, _role in enumerate(reviewer_roles):
            # Only setting column name with dummy value 0.
            # Actual value will be set in RoleColumn render method.
            setattr(data, f"role{i}", 0)
    return table_data

get_table_kwargs

get_table_kwargs()
Source code in hypha/apply/funds/views/staff_assignments.py
def get_table_kwargs(self):
    reviewer_roles = ReviewerRole.objects.all().order_by("order")
    extra_columns = []
    for i, role in enumerate(reviewer_roles):
        extra_columns.append((f"role{i}", RoleColumn(verbose_name=role)))
    return {
        "extra_columns": extra_columns,
    }