(backend) add creator field on document and allow filtering on it

We want to be able to limit the documents displayed on a logged-in user's
list view by the documents they created or by the documents that other
users created.

This is different from having the "owner" role on a document because this
can be acquired and even lost. What we want here is to be able to
identify documents by the user who created them so we add a new field.
This commit is contained in:
Samuel Paccoud - DINUM
2024-11-12 16:28:34 +01:00
committed by Anthony LC
parent 1899cff572
commit 23f90156bf
13 changed files with 453 additions and 68 deletions

View File

@@ -56,6 +56,7 @@ class DocumentFactory(factory.django.DjangoModelFactory):
title = factory.Sequence(lambda n: f"document{n}")
content = factory.Sequence(lambda n: f"content{n}")
creator = factory.SubFactory(UserFactory)
link_reach = factory.fuzzy.FuzzyChoice(
[a[0] for a in models.LinkReachChoices.choices]
)