Category¶
This document provides the API references for the categories of contracts in the database. See ../tools/cpvs_importer for how these categories are built.
API References¶
-
class
models.
Category
¶ A category is a formal way to categorize public contracts within European Union. It is a tag assigned to a contract.
A category as an OneToMany relationship to
Contract
: each contract has one category, each category can have more than one contract. This relationship is thus defined in the contract model.A category has the following attributes:
-
description_en
¶
-
description_pt
¶ The official descriptions of the category in english and portuguese, respectively.
-
depth
¶ The depth of the attribute on the tree.
And has the following methods:
-
get_children
()¶ Returns all children categories, excluding itself.
-
get_ancestors
()¶ Returns all ancestor categories, excluding itself.
-
get_absolute_url
()¶ Returns the url of this category in the website.
-
contracts_count
()¶ Counts the number of all contracts that belong to this category or any of its children.
-
contracts_price
()¶ Sums the prices of all contracts that belong to this category or any of its children.
-