refactor data_models.py

This commit is contained in:
Sina Atalay 2024-01-29 17:31:24 +01:00
parent 15d4ae1725
commit 216967a3ed
1 changed files with 6 additions and 5 deletions

View File

@ -1,9 +1,8 @@
""" """
This module contains all the necessary classes to store CV data. The YAML input file is This module contains all the necessary classes to store CV data. The YAML input file is
transformed into instances of these classes (i.e., the input file is read) in the transformed into instances of these classes (i.e., the input file is read) with the
[input_reader](https://sinaatalay.github.io/rendercv/code_documentation/input_reader/) [`read_input_file`](utilities.md#read_input_file) function. RenderCV utilizes these
module. RenderCV utilizes these instances to generate a CV. These classes are called instances to generate a CV. These classes are called data models.
data models.
The data models are initialized with data validation to prevent unexpected bugs. During The data models are initialized with data validation to prevent unexpected bugs. During
the initialization, we ensure that everything is in the correct place and that the user the initialization, we ensure that everything is in the correct place and that the user
@ -810,6 +809,8 @@ class CurriculumVitae(RenderCVBaseModel):
# ====================================================================================== # ======================================================================================
# ====================================================================================== # ======================================================================================
Design = ClassicThemeOptions
class RenderCVDataModel(RenderCVBaseModel): class RenderCVDataModel(RenderCVBaseModel):
"""This class binds both the CV and the design information together.""" """This class binds both the CV and the design information together."""
@ -818,7 +819,7 @@ class RenderCVDataModel(RenderCVBaseModel):
title="Curriculum Vitae", title="Curriculum Vitae",
description="The data of the CV.", description="The data of the CV.",
) )
design: ClassicThemeOptions = pydantic.Field( design: Design = pydantic.Field(
title="Design", title="Design",
description="The design information.", description="The design information.",
discriminator="theme", discriminator="theme",