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

Course Content

In-Depth Python OOP

In-Depth Python OOP

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

Challenge: AuthMixin

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
toggle bottom row

Challenge: AuthMixin

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 3
toggle bottom row

Challenge: AuthMixin

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 3
Switch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt