-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
from django.contrib import admin | ||
|
||
from content.models import Content | ||
|
||
# Register your models here. | ||
|
||
|
||
@admin.register(Content) | ||
class ContentAdmin(admin.ModelAdmin): | ||
list_display = ["title", "content_id"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
import uuid | ||
|
||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class Tag(models.Model): | ||
name = models.CharField(max_length=20) | ||
description = models.CharField(max_length=50, null=True, blank=True) | ||
|
||
|
||
class Content(models.Model): | ||
# TODO need to create UserResource models for user model | ||
class DocumentType(models.IntegerChoices): | ||
WORD = 1, _("Word") | ||
PDF = 2, _("PDF") | ||
|
||
class DocumenetStatus(models.IntegerChoices): | ||
PENDING = 1, _("Pending") | ||
TEXT_EXTRACTED = 2, _("Text extracted") | ||
ADDED_TO_VECTOR = 3, _("Added to vector") | ||
DELETED_FROM_VECTOR = 4, _("Deleted from vector") | ||
|
||
# Create your models here. | ||
title = models.CharField(max_length=100) | ||
document_type = models.IntegerField(choices=DocumentType.choices) | ||
document_file = models.FileField(upload_to="documents") | ||
extracted_file = models.FileField(upload_to="documents") | ||
content_id = models.UUIDField(default=uuid.uuid4, editable=False) | ||
description = models.TextField() | ||
tag = models.ManyToManyField("Tag") | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
created_by = models.ForeignKey("user.User", on_delete=models.PROTECT) | ||
is_deleted = models.BooleanField(default=False) | ||
deleted_at = models.DateTimeField(null=True) | ||
deleted_by = models.ForeignKey("user.User", null=True, on_delete=models.PROTECT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |