I have these classes:
from typing import List
from pydantic import BaseModel
class Payment(BaseModel):
rut: str = None,
worked_days: int = None,
base_salary: int = None,
gratification: int = None,
liquid_salary: int = None
class RemunerationBook(BaseModel):
payments: List[Payment] = []
After creating an object from RemunerationBook class, then creating the Payment and append it to the list.
lre = RemunerationBook()
payment = Payment()
lre.payments.append(payment)
print(lre)
I get this when printing:
payments=[Payment(rut=(None,), worked_days=(None,), base_salary=(None,), gratification=(None,), liquid_salary=None)]
Why every attribute is in a list, except the last one?