1. 19
  1.  

  2. 6

    Totally agree, class-based views with mixins are an insanity.

    Once upon a time in 2012, I worked for a couple of month on a project that used class-based views for everything. I remember a particular view that was 11-lines long, and to understand it I either had to read the documentation for 20 minutes, or dive into Django source code and read it directly. Which I did, because it was a faster way.

    It was looking so unnecessary that I rewrote it as a function-view and it ended up being 7 lines long and guess what? It also was a simple linear code that was very easy to understand without consulting the documentation or reading source code of invoked functions.

    And some people continue to write them and insist on using them for years and years. Ugh.

    1. 2

      I like how each decision is explained step by step, making the reasoning clear. I would recommend it to my colleagues if I was still using Django :)

      Class based views and fat models is why I left Django. It felt to me that those two approaches are counterproductive and working with such code was a struggle for me. I was enjoying using Django since before 1.x until everyone started incorporating those two patterns.

      I am happy to hear that I am not the only one that finds an explicit code more reasonable and pleasant to work with.

      1. 2

        really wish there was a timestamp on this post.