Challenge: AuthMixin
Oppgave
Swipe to start coding
Let's make your code more flexible.
- Define the
AuthMixinclass. - Cut the
loginandlogoutmethods from theUserclass and insert them into theAuthMixinbody. - Move the
is_authenticatedclass attribute to theAuthMixin. - Inherit the
Userclass from theAuthMixin.
Note
After performing all the actions, you will have an authorization mixin (
AuthMixin) that can be used for different user classes.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 3
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Oppsummer dette kapittelet
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 2.78
Challenge: AuthMixin
Sveip for å vise menyen
Oppgave
Swipe to start coding
Let's make your code more flexible.
- Define the
AuthMixinclass. - Cut the
loginandlogoutmethods from theUserclass and insert them into theAuthMixinbody. - Move the
is_authenticatedclass attribute to theAuthMixin. - Inherit the
Userclass from theAuthMixin.
Note
After performing all the actions, you will have an authorization mixin (
AuthMixin) that can be used for different user classes.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 4. Kapittel 3
single