Budget models
https://redmine.teklia.com/issues/8453
A new Django app is introduced at arkindex.budget, with two new models:
-
Budget-
id: UUID, primary key. -
name: CharField, up to 100 characters. It cannot be null, and must use a minimum length validator to require a length above 0, to make sure we can't just have a budget named"". -
total: DecimalField with 12 total digits and 3 decimal places defaulting to 0. It can be negative, so there is no particular validation. -
__str__should return the name.
-
-
BudgetEntry-
id: UUID, primary key. -
created: DateTimeField withauto_now_add=True. -
budget: Foreign key toBudget. Deleting a budget cascades into deleting its entries. -
description: CharField with up to 255 characters. It cannot be null, and must use a minimum length validator to require a length above 0, to make sure we can't have entries with no description. -
value: DecimalField with 12 total digits and 3 decimal places, with no default value. -
user: Nullable foreign key tousers.User, representing the user who caused this change in the budget, when we know who it is. -
process: Nullable foreign key toprocess.Process, representing the process involved in this change in the budget, when there is one. -
__str__should return the description.
-
A new Corpus.budget nullable foreign key allows assigning a corpus to a budget.
The CorpusSerializer should include a new read-only budget_id field to return the ID of the budget assigned to the corpus. This should affect ListCorpus and RetrieveCorpus.