Answer the question
In order to leave comments, you need to log in
Correct use of type annotation?
There is a paydantic class with a default variable value defined in it
class AdUrlMixin(BaseModel):
url: Optional[HttpUrl] = None
class CommonMixin(AdUrlMixin):
.......
def create_ad(request: HttpRequest, request_body: CommonMixin):
....
result = get_result(request_body.id, request_body.url)
def get_resutl(id: str, url=Optional[HttpUrl] ):
....
get_any_result(id, url)
def get_any_result(id: str, url=Optional[HttpUrl]):
if url return url else None
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question