Home > Mobile >  What does a class followed by method does in Python
What does a class followed by method does in Python

Time:10-01

In Django urls there is this code:

 path("login/", Login.as_view(), name="loggps")

Login is a class and as_view() is a method but is not in the Login class, probably is in a Parent class.

What does Class.method does in Python?

CodePudding user response:

I think as_view is a classmethod

class Login:
    @classmethod
    def as_view(self):
        print("hi")

Login.as_view()

  • Related