Add: reverse url lookup for PostFileModel

This commit is contained in:
Aroy-Art 2025-03-14 21:43:22 +01:00
parent e768bbc5dd
commit c3dd0d70ba
Signed by: Aroy
GPG key ID: 583642324A1D2070

View file

@ -1,4 +1,5 @@
from django.db import models
from django.urls import reverse
def get_upload_to(instance, filename, folder):
@ -61,3 +62,6 @@ class PostFileModel(models.Model):
def __str__(self):
return str(self.name.first())
def get_absolute_url(self):
return reverse("serve_file", args=[self.hash_blake3])