Grants export add admin link
@@ -38,6 +38,7 @@ class GrantResource(ResourceUsersByIdsMixin):
submission_tags = Field()
submission_admin_link = Field()
submission_pycon_link = Field()
+ grant_admin_link = Field()
USERS_SUBMISSIONS: Dict[int, List[Submission]] = {}
def dehydrate_age_group(self, obj: Grant):
@@ -95,11 +96,16 @@ class GrantResource(ResourceUsersByIdsMixin):
]
)
+ def dehydrate_grant_admin_link(self, obj: Grant):
+ return f"https://admin.pycon.it/admin/grants/grant/?q={'+'.join(obj.full_name.split(' '))}"
+
def before_export(self, queryset: QuerySet, *args, **kwargs):
super().before_export(queryset, *args, **kwargs)
conference_id = queryset.values_list("conference_id").first()
- submissions = Submission.objects.prefetch_related("tags", "rankings").filter(
+ submissions = Submission.objects.prefetch_related(
+ "rankings__tag", "rankings__submission"
+ ).filter(
speaker_id__in=self._PREFETCHED_USERS_BY_ID.keys(),
conference_id=conference_id,
)
