mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-04-27 18:21:23 +08:00
Move sex and age fields from questionnaire to user and add planning role restrictions
This commit is contained in:
parent
724132e396
commit
e0eba6ca21
25 changed files with 157 additions and 320 deletions
|
@ -7,4 +7,5 @@ class DocumentsConfig(AppConfig):
|
|||
|
||||
def ready(self) -> None:
|
||||
import documents.signals
|
||||
|
||||
return super().ready()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 5.1.3 on 2024-11-23 17:01
|
||||
# Generated by Django 5.1.3 on 2024-12-03 16:27
|
||||
|
||||
import django.utils.timezone
|
||||
import documents.models
|
||||
|
@ -29,17 +29,19 @@ class Migration(migrations.Migration):
|
|||
"document_type",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("pdf", "PDF"),
|
||||
("image", "Image"),
|
||||
("video", "Video"),
|
||||
("doc", "Word Document"),
|
||||
("excel", "Excel Document"),
|
||||
("ppt", "Powerpoint Document"),
|
||||
("memorandum", "Memorandum"),
|
||||
("hoa", "HOA"),
|
||||
(
|
||||
"documented procedures manual",
|
||||
"Documented Procedures Manual",
|
||||
),
|
||||
("other", "Other"),
|
||||
],
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
("number_pages", models.IntegerField()),
|
||||
("ocr_metadata", models.TextField(blank=True, null=True)),
|
||||
(
|
||||
"file",
|
||||
models.FileField(upload_to=documents.models.Document.upload_to),
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Generated by Django 5.1.3 on 2024-11-24 05:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("documents", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="document",
|
||||
name="metadata",
|
||||
field=models.TextField(null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="document",
|
||||
name="document_type",
|
||||
field=models.CharField(
|
||||
choices=[("memorandum", "Memorandum"), ("hoa", "HOA")], max_length=32
|
||||
),
|
||||
),
|
||||
]
|
|
@ -1,22 +0,0 @@
|
|||
# Generated by Django 5.1.3 on 2024-11-24 06:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("documents", "0002_document_metadata_alter_document_document_type"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="document",
|
||||
name="metadata",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="document",
|
||||
name="ocr_metadata",
|
||||
field=models.TextField(blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -1,26 +0,0 @@
|
|||
# Generated by Django 5.1.3 on 2024-11-26 15:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("documents", "0003_remove_document_metadata_document_ocr_metadata"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="document",
|
||||
name="document_type",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("memorandum", "Memorandum"),
|
||||
("hoa", "HOA"),
|
||||
("documented procedures manual", "Documented Procedures Manual"),
|
||||
("other", "Other"),
|
||||
],
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
from django.db import models
|
||||
from django.utils.timezone import now
|
||||
import uuid
|
||||
|
@ -12,7 +11,6 @@ class Document(models.Model):
|
|||
("hoa", "HOA"),
|
||||
("documented procedures manual", "Documented Procedures Manual"),
|
||||
("other", "Other"),
|
||||
|
||||
)
|
||||
document_type = models.CharField(
|
||||
max_length=32, choices=DOCUMENT_TYPE_CHOICES, null=False, blank=False
|
||||
|
|
|
@ -35,8 +35,14 @@ class DocumentSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Document
|
||||
fields = ["id", "name", "document_type",
|
||||
"number_pages", "ocr_metadata", "date_uploaded"]
|
||||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"document_type",
|
||||
"number_pages",
|
||||
"ocr_metadata",
|
||||
"date_uploaded",
|
||||
]
|
||||
read_only_fields = [
|
||||
"id",
|
||||
"name",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
from io import BytesIO
|
||||
from documents.models import Document
|
||||
from django.db.models.signals import post_save
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue