|
@@ -1,9 +1,18 @@
|
|
|
# textdocs/models.py
|
|
# textdocs/models.py
|
|
|
from django.db import models
|
|
from django.db import models
|
|
|
from django.urls import reverse
|
|
from django.urls import reverse
|
|
|
|
|
+from django.conf import settings # Import settings
|
|
|
|
|
|
|
|
class Document(models.Model):
|
|
class Document(models.Model):
|
|
|
"""Represents a single document with its fixed sections."""
|
|
"""Represents a single document with its fixed sections."""
|
|
|
|
|
+
|
|
|
|
|
+ # NEW: Link to the user who created the document
|
|
|
|
|
+ author = models.ForeignKey(
|
|
|
|
|
+ settings.AUTH_USER_MODEL,
|
|
|
|
|
+ on_delete=models.CASCADE,
|
|
|
|
|
+ related_name='documents'
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
title = models.CharField(max_length=255)
|
|
title = models.CharField(max_length=255)
|
|
|
introduction = models.TextField(help_text="The introductory section of the document.")
|
|
introduction = models.TextField(help_text="The introductory section of the document.")
|
|
|
main_body = models.TextField(help_text="The main content or analysis.")
|
|
main_body = models.TextField(help_text="The main content or analysis.")
|