1
0

vault backup: 2025-12-26 02:09:22
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 2m29s

This commit is contained in:
2025-12-26 02:09:22 +01:00
parent 3fddadfe50
commit 50366b9b9c
288 changed files with 58893 additions and 750 deletions

View File

@@ -0,0 +1,4 @@
from .file_model import File
__all__ = ['File']

View File

@@ -0,0 +1,39 @@
from django.db import models
class File(models.Model):
name = models.CharField(max_length=500, help_text="Display name or filename")
path = models.CharField(max_length=1000, blank=True, help_text="Path relative to content root")
mime_type = models.CharField(max_length=100, help_text="MIME type of the entity (e.g. application/pdf, application/x-folder)")
parent = models.ForeignKey(
'self',
on_delete=models.CASCADE,
null=True,
blank=True,
related_name='children',
help_text="Parent folder or parent document (for sidecars/sub-entries)"
)
# File storage
file_content = models.FileField(upload_to='uploads/', null=True, blank=True, help_text="Uploaded file content")
# Content storage
text = models.TextField(blank=True, help_text="Text content, OCR, or embedded query")
external_url = models.URLField(blank=True, help_text="External link (e.g. YouTube)")
# Metadata
metadata = models.JSONField(default=dict, blank=True, help_text="Frontmatter (created_at, user, etc.)")
# Ownership and house-keeping
user = models.ForeignKey('quiz.QuizUser', on_delete=models.CASCADE, related_name='files')
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
verbose_name = "File"
verbose_name_plural = "Files"
def __str__(self):
return f"[{self.mime_type}] {self.name}"