According to django docs, viewname is either a function name or a url template name. But accessing a URL like this one back (MyView.as_view ()) turns into a NoReverseMatch exception. Is there a way to change the presentation of a class by function name?
You can use named url patterns , or you can do something like the following (in views.py )
views.py
my_function = MyView.as_view()
now the opposite will work: reverse('myviews.my_function')
reverse('myviews.my_function')