mirror of https://github.com/eyhc1/rendercv.git
data_models: fix check_and_adjust_dates
This commit is contained in:
parent
6def22e618
commit
50681949cc
|
@ -389,8 +389,8 @@ class EntryBase(EntryWithDate):
|
||||||
# If only start_date is provided, assume it is an ongoing event, i.e.,
|
# If only start_date is provided, assume it is an ongoing event, i.e.,
|
||||||
# the end_date is present:
|
# the end_date is present:
|
||||||
self.end_date = "present"
|
self.end_date = "present"
|
||||||
end_date = Date.today()
|
|
||||||
else:
|
if self.end_date != "present":
|
||||||
end_date = get_date_object(self.end_date)
|
end_date = get_date_object(self.end_date)
|
||||||
|
|
||||||
if start_date > end_date:
|
if start_date > end_date:
|
||||||
|
@ -864,6 +864,12 @@ class SocialNetwork(RenderCVBaseModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_username(cls, username: str, info: pydantic.ValidationInfo) -> str:
|
def check_username(cls, username: str, info: pydantic.ValidationInfo) -> str:
|
||||||
"""Check if the username is provided correctly."""
|
"""Check if the username is provided correctly."""
|
||||||
|
if "network" not in info.data:
|
||||||
|
# the network is either not provided or not one of the available social
|
||||||
|
# networks. In this case, don't check the username, since Pydantic will
|
||||||
|
# raise an error for the network.
|
||||||
|
return username
|
||||||
|
|
||||||
network = info.data["network"]
|
network = info.data["network"]
|
||||||
|
|
||||||
if network == "Mastodon":
|
if network == "Mastodon":
|
||||||
|
|
Loading…
Reference in New Issue