The code in this example:
posts.add_url_rule('/', view_func=ListView.as_view('list'))
posts.add_url_rule('/<slug>/', view_func=DetailView.as_view('detail'))
I don't understand the parameter passed in the function as_view
above, what is the purpose of list
and detail
here?
It creates the endpoint for the routing system, so you can use url_for('posts.list')
or similar, the API docs are here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With