Skip to content

Commit

Permalink
Fix content model
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Sep 18, 2024
1 parent 09fb2a5 commit 08c275a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions content/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@admin.register(Content)
class ContentAdmin(admin.ModelAdmin):
list_display = ["title", "content_id"]
autocomplete_fields = ["created_by", "modified_by"]
10 changes: 6 additions & 4 deletions content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@ class DocumentType(models.IntegerChoices):
WORD = 1, _("Word")
PDF = 2, _("PDF")

class DocumenetStatus(models.IntegerChoices):
class DocumentStatus(models.IntegerChoices):
PENDING = 1, _("Pending")
TEXT_EXTRACTED = 2, _("Text extracted")
ADDED_TO_VECTOR = 3, _("Added to vector")
DELETED_FROM_VECTOR = 4, _("Deleted from vector")
FAILURE = 5, _("Failure")

title = models.CharField(max_length=100)
document_type = models.IntegerField(choices=DocumentType.choices)
document_type = models.IntegerField(choices=DocumentType.choices, default=DocumentType.WORD)
document_file = models.FileField(upload_to="documents", blank=True)
extracted_file = models.FileField(upload_to="documents", blank=True)
extracted_file = models.FileField(upload_to="documents-extracts", null=True, blank=True)
content_id = models.UUIDField(default=uuid.uuid4, editable=False)
description = models.TextField(help_text="Content text")
document_status = models.PositiveSmallIntegerField(choices=DocumentStatus.choices, default=DocumentStatus.PENDING)
tag = models.ManyToManyField("Tag", blank=True)
is_deleted = models.BooleanField(default=False)
deleted_at = models.DateTimeField(blank=True)
deleted_at = models.DateTimeField(null=True, blank=True)
deleted_by = models.ForeignKey("user.User", null=True, blank=True, on_delete=models.PROTECT)

0 comments on commit 08c275a

Please sign in to comment.