add "status" to Document, no function yet
This commit is contained in:
parent
edd8ceb858
commit
03c13e2238
2 changed files with 26 additions and 0 deletions
18
sdbs_pile/pile/migrations/0007_document_status.py
Normal file
18
sdbs_pile/pile/migrations/0007_document_status.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-29 09:42
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pile', '0006_auto_20200329_1132'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='document',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('REF', 'Referential'), ('STD', 'Standard'), ('FRG', 'Fragment')], default='STD', max_length=3),
|
||||
),
|
||||
]
|
|
@ -32,6 +32,12 @@ class DocumentManager(models.Manager):
|
|||
return self.get_queryset().annotate(tag_count=Count('tags')).filter(tag_count=0)
|
||||
|
||||
|
||||
class DocumentStatus(models.TextChoices):
|
||||
REFERENCE = "REF", "Referential"
|
||||
STANDARD = "STD", "Standard"
|
||||
FRAGMENT = "FRG", "Fragment"
|
||||
|
||||
|
||||
class Document(SoftDeletableModel):
|
||||
title = models.CharField(max_length=512, null=False, blank=False)
|
||||
author = models.CharField(max_length=512, null=False, blank=True)
|
||||
|
@ -40,6 +46,8 @@ class Document(SoftDeletableModel):
|
|||
external_url = models.URLField(null=True, blank=True)
|
||||
file = models.FileField(null=True, blank=True, storage=FileSystemStorage(location='docs'))
|
||||
public = models.BooleanField(default=True, null=False, blank=False)
|
||||
status = models.CharField(null=False, blank=False,
|
||||
max_length=3, choices=DocumentStatus.choices, default=DocumentStatus.STANDARD)
|
||||
tags = models.ManyToManyField(Tag, related_name="documents", blank=True)
|
||||
uploaded = models.DateTimeField(auto_now_add=True, null=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue