fix:create-document

This commit is contained in:
hungdztrau123
2024-05-31 09:08:28 +07:00
parent 0d76578906
commit 640d8b1c28
43 changed files with 470 additions and 208 deletions

View File

@@ -144,6 +144,7 @@ class Warehouse(MatchingModel):
choices=TYPE_WAREHOUSE,
default=WAREHOUSE,)
parent_warehouse = models.ForeignKey('self', on_delete=models.CASCADE, null=True, blank=True )
path = models.TextField(_("path"), null=True, blank=True)
class Meta(MatchingModel.Meta):
verbose_name = _("warehouse")
@@ -177,6 +178,15 @@ class Document(ModelWithOwner):
on_delete=models.SET_NULL,
verbose_name=_("storage path"),
)
warehouse = models.ForeignKey(
Warehouse,
blank=True,
null=True,
related_name="documents",
on_delete=models.SET_NULL,
verbose_name=_("warehouse"),
)
title = models.CharField(_("title"), max_length=128, blank=True, db_index=True)
@@ -207,15 +217,6 @@ class Document(ModelWithOwner):
verbose_name=_("tags"),
)
warehouses = models.ForeignKey(
Warehouse,
blank=True,
null=True,
related_name="documents",
on_delete=models.SET_NULL,
verbose_name=_("warehouses"),
)
checksum = models.CharField(
_("checksum"),
max_length=32,