Replies: 2 comments
-
|
does trying to figure out how they connect -- usually a generic somewhere can help |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
As shown in the short example code, APIUser doesn't inherit. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We have a user model and different types of users. Very simplified, we have users, and some users can have API access. Then there's a OneToOne from an
APIUsermodel to theUsermodel.When a
Useris anAPIUserI can useuser.apiuser. Which has a type ofAPIUser.However when it's the User is not an APIUser then Django will raise
RelatedObjectDoesNotExistwhen trying to accessapiuser.What's the recommended way to type hint this on the User model?
Beta Was this translation helpful? Give feedback.
All reactions