官术网_书友最值得收藏!

Class-Based Views are not always Class-Based Generic Views

Most people confuse Class-Based Views and Class-Based Generic Views. Their names are similar, but they are not the same things. This has led to some interesting misconceptions as follows:

  • The only generic views are the ones bundled with Django: Thankfully, this is wrong. There is no special magic in the generic class-based views that are provided.
    You are free to roll your own set of generic class-based views. You can also use a third-party library such as django-vanilla-views (http://django-vanilla-views.org/), which has a simpler implementation of the standard generic views. Remember that using custom generic views might make your code unfamiliar to others.
  • Class-based views must always derive from a generic view: Again, there is nothing magical about the generic view classes. Though, 90 percent of the time, you will find a generic class such as View to be ideal for use as a base class, you are free to implement similar features yourself.
主站蜘蛛池模板: 通州区| 绥芬河市| 闵行区| 西充县| 葫芦岛市| 建瓯市| 赣榆县| 永吉县| 阜城县| 灵璧县| 瓦房店市| 绥中县| 阜平县| 肇源县| 锡林郭勒盟| 新乡县| 德兴市| 漳州市| 保德县| 县级市| 大渡口区| 青州市| 长武县| 武穴市| 庆阳市| 龙泉市| 禄丰县| 木兰县| 攀枝花市| 娄烦县| 正安县| 珲春市| 嘉峪关市| 齐河县| 承德市| 武平县| 丰县| 贺州市| 凤山县| 武穴市| 利津县|