Bases: SubmissionStatsMixin
, FilterView
template_name
class-attribute
instance-attribute
template_name = 'funds/submissions_result.html'
filterset_class
class-attribute
instance-attribute
filter_action
class-attribute
instance-attribute
excluded_fields
class-attribute
instance-attribute
excluded_fields = SUBMISSIONS_TABLE_EXCLUDED_FIELDS
get_filterset_kwargs
get_filterset_kwargs(filterset_class, **kwargs)
Source code in hypha/apply/funds/views/results.py
| def get_filterset_kwargs(self, filterset_class, **kwargs):
new_kwargs = super().get_filterset_kwargs(filterset_class)
new_kwargs.update(self.excluded)
new_kwargs.update(kwargs)
return new_kwargs
|
get_queryset
Source code in hypha/apply/funds/views/results.py
| def get_queryset(self):
return (
self.filterset_class._meta.model.objects.current()
.exclude_draft()
.defer(
"search_data",
"drupal_id",
"submit_time",
"workflow_name",
"search_document",
"live_revision_id",
"draft_revision_id",
"summary",
)
)
|
get_context_data
get_context_data(**kwargs)
Source code in hypha/apply/funds/views/results.py
| def get_context_data(self, **kwargs):
search_term = self.request.GET.get("query")
if self.object_list:
submission_values = self.object_list.value()
count_values = submission_values.get("value__count")
total_value = format_submission_sum_value(submission_values)
if value := submission_values.get("value__avg"):
average_value = round(value)
else:
average_value = 0
else:
count_values = 0
total_value = 0
average_value = 0
return super().get_context_data(
search_term=search_term,
filter_action=self.filter_action,
count_values=count_values,
total_value=total_value,
average_value=average_value,
**kwargs,
)
|