What does a class followed by method does in Python

Question:

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?

Asked By: Carlitos_30

||

Answers:

I think as_view is a classmethod

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

Login.as_view()

Answered By: Nishant Chauhan
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.