Add: reverse url lookup for PostFileModel
This commit is contained in:
parent
e768bbc5dd
commit
c3dd0d70ba
1 changed files with 4 additions and 0 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Reference in a new issue