align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

Class-Based Views: A DRY approach to view logic in Django

Class-Based Views (CBVs) provide incredible flexibility and re-usability at the cost of simplicity. This talk will attempt to demystify this essential tool to allow you write your own CBVs and manipulate the generic CBVs to do whatever you want.

First we'll skim some basics of object inheritance in Python and go over how this applies to CBVs. Then we'll take a no-magic look at how calls to a CBV happen with a simple "Hello, World!" example. Next we'll touch on some of the generic views and show how to bend them to your will. Finally we'll go over Mixins and CBV-related tools and talk about how to reuse logic across views.

Ethan Soergel is a software engineer at Dimagi who has also worked as a freelance Django developer. He is a CodeRaising mentor and enjoys teaching. After forcing himself to understand how they worked, Ethan developed an appreciation for the power of CBVs that he's eager to spread.

Drinks sponsored by Solano Labs:

Join or login to comment.

  • A former member
    A former member

    Hi everyone, here's the video from last night's talk:

    1 · October 25, 2013

    • Carlos

      thank you, Chris

      October 26, 2013

  • Max A.

    Next time you are going to have a large event that requires some travel for attendees, could you please use Google Maps or GPS to look up your address. By the time I got to Cambridge, the GPS was overloaded with Cambridge centers all over the area.

    People who get lost get discouraged and sometimes stop attending events like this one.

    October 24, 2013

    • Pran M.


      October 25, 2013

    • Pran M.

      Move used several GPS devices to get to 8CC and never had a problem. Beyond that, there's always just asking someone in the vicinity. Or you could say "If you don't hold events in my back yard I won't come." If you're given the full address of an event and still can't find it, it's not the host's problem.

      1 · October 25, 2013

  • Hari

    Enjoyed the talk and questions .. are the slides posted anywhere. ESP liked the one about the mro in a CBV.

    1 · October 24, 2013

  • Carlos

    Often CBV comes to be complicated to use :s, thanks for caring about this issue.

    1 · October 23, 2013

  • Ethan

    Hey Joseph, I've got a section at the end where I mention CBV external libraries, including Vanilla Views. My presentation will focus more on how to use CBVs, as people likely won't remember specific implementation details. Vanilla Views do seem pretty awesome, though!

    1 · October 16, 2013

  • Joseph D

    Wondering if this will get into the new Django Vanilla Views at all? Seems like a great take on CBV.

    1 · October 14, 2013

  • Javier B.

    Hope to learn a lot. thank you guys.

    1 · October 11, 2013

Our Sponsors

  • Jazkarta, Inc.

    Jazkarta is an agile web development firm based in Boston. We do Django!

  • Appsembler

    Professional hosting and support for Open edX, online learning platform

  • EnergySavvy

    Drinks at the October 2015 meetup.

  • Klaviyo

    Drinks at the August 2015 meetup.

  • Percipient Networks

    Drinks at the June 2015 meetup.

  • Seldera

    Drinks at the May 2015 meetup

  • eProvenance

    Drinks at the March and April 2015 meetups.

  • CustomMade

    Food and beer at the March 2013 meetup.

  • Propel Marketing

    Pizza at the May 28, 2012 meetup

  • Jana

    Beer at the May 28, 2012 meetup.

  • HubSpot

    Hosting space and pizza & beer for the January 2013 event.

  • Wanderu

    Hosting of the meetup at their offices and food at the April 2013 meetup

  • Kyruus

    Drinks at the April 26, 2013 meetup.

  • Akamai

    Hosting and food for the May 2013 meetup.

  • edX

    Pizza for the June 2013 meetup.

  • Addgene

    Drinks at the Aug. 15, 2013 meetup.

  • Startup Institute

    Drinks at the Sept. 2013 meetup.

  • Solano Labs

    Drinks at the Oct. 2013 meetup event

  • AppNeta

    Drinks at Mead Hall at the November 2013 meetup.

  • Zefr

    Drinks at the Feb. 27, 2014 meetup.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy