Use real images with lazy loading in sas albums and user pictures

This commit is contained in:
2025-02-19 00:12:30 +01:00
parent e8db68b960
commit f7ff77b88f
6 changed files with 51 additions and 30 deletions

View File

@ -39,6 +39,8 @@ class PictureSchema(ModelSchema):
compressed_url: str
thumb_url: str
album: str
report_url: str
edit_url: str
@staticmethod
def resolve_sas_url(obj: Picture) -> str:
@ -56,6 +58,14 @@ class PictureSchema(ModelSchema):
def resolve_thumb_url(obj: Picture) -> str:
return obj.get_download_thumb_url()
@staticmethod
def resolve_report_url(obj: Picture) -> str:
return reverse("sas:picture_ask_removal", kwargs={"picture_id": obj.id})
@staticmethod
def resolve_edit_url(obj: Picture) -> str:
return reverse("sas:picture_edit", kwargs={"picture_id": obj.id})
class PictureRelationCreationSchema(Schema):
picture: NonNegativeInt