About class-based views in django and flask?
欧阳克
欧阳克 2017-06-22 11:51:58
0
2
726

I was reading the Flask documentation recently and found that in Django and Flask, views are both based on functions and classes (called plug-in views in Flask). I don’t quite understand the difference between these two views. Since I have just started, I have always used functional views. What is the difference between these two views? In formal development, are functional views or class-based views used more?

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(2)
曾经蜡笔没有小新

There is no difference, it’s just a different style when writing code.

Class-based views emphasize defining all views in one place,
Function-based views are defined where they are used.

阿神

Class-based views facilitate logic reuse. You can write common logic in multiple views in a base class, and the view class that inherits this base class can have this logic.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!