mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-19 12:59:36 +02:00
feat: add Attachment model and implement file permission checks for media access
This commit is contained in:
parent
433599dc20
commit
aa216f5688
7 changed files with 93 additions and 46 deletions
|
@ -287,6 +287,16 @@ class AdventureImage(models.Model):
|
|||
|
||||
def __str__(self):
|
||||
return self.image.url
|
||||
|
||||
class Attachment(models.Model):
|
||||
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||
user_id = models.ForeignKey(
|
||||
User, on_delete=models.CASCADE, default=default_user_id)
|
||||
file = models.FileField(upload_to='attachments/')
|
||||
adventure = models.ForeignKey(Adventure, related_name='attachments', on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return self.file.url
|
||||
|
||||
class Category(models.Model):
|
||||
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue