Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: AuthMixin | Polymorphism and Abstraction
In-Depth Python OOP
course content

Contenu du cours

In-Depth Python OOP

In-Depth Python OOP

1. OOP Concepts
2. Inheritance
3. Encapsulation
4. Polymorphism and Abstraction
5. Magic Methods

book
Challenge: AuthMixin

Tâche

Swipe to start coding

Let's make your code more flexible.

  1. Define the AuthMixin class.
  2. Cut the login and logout methods from the User class and insert them into the AuthMixin body.
  3. Move the is_authenticated class attribute to the AuthMixin.
  4. Inherit the User class from the AuthMixin.

Note

After performing all the actions, you will have an authorization mixin (AuthMixin) that can be used for different user classes.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 3
toggle bottom row

book
Challenge: AuthMixin

Tâche

Swipe to start coding

Let's make your code more flexible.

  1. Define the AuthMixin class.
  2. Cut the login and logout methods from the User class and insert them into the AuthMixin body.
  3. Move the is_authenticated class attribute to the AuthMixin.
  4. Inherit the User class from the AuthMixin.

Note

After performing all the actions, you will have an authorization mixin (AuthMixin) that can be used for different user classes.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 4. Chapitre 3
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
We're sorry to hear that something went wrong. What happened?
some-alt