Giter Club home page Giter Club logo

django-cbv-inspector's Introduction

Django Class Based Views Inspector

Use the Django Class Based Views Inspector

What's a class based view anyway?

Django 1.3 came with class based generic views. These are really awesome, and very powerfully coded with mixins and base classes all over the shop. This means they're much more than just a couple of generic shortcuts, they also provide utilities which can be mixed in the much more complex views that you write yourself.

Great! So what's the point of the inspector?

All of this power comes at the expense of simplicity. Trying to work out exactly which method you need to customise on your UpdateView can feel a little like wading through spaghetti - it has 8 separate ancestors (plus object) spread across 3 different files. So working out that you wanted to tweak UpdateView.get_initial and what it's keyword arguments are is a bit of a faff.

That's where this comes in! Here's the manifesto:

Provide an easy interface to learning the awesomeness of class based views. It should offer at least the ability to view the MRO of a generic view, all of the methods which are available on a particular class (including all inherited methods) complete with signature and docstrings. Ideally you should then be able to see where that method has come from, and any super calls it's making should be identified. Wrap this all up in a shiny front end!

Tools to consider

  • Python's built in inspect module to work out what's going on and put it in the database
  • JQuery for shinyness
  • Backbone for JS structure
  • Piston for API
  • SASS/LESS and/or Bootstrap to make CSS less painful

Installation

Install as you normally would a Django site (requirements.txt provided).

e.g. (inside your virtualenv or whatever)

pip install -r requirements.txt

Sync the database (assuming you've got required database)

python manage.py syncdb

Run the migrations

python manage.py migrate cbv

Populate the database with fixtures

python manage.py loaddata cbv/fixtures/project.json

python manage.py loaddata cbv/fixtures/1.3.json

Run server and play around

python manage.py runserver

License

License is BSD-2.

django-cbv-inspector's People

Contributors

exonian avatar garrypolley avatar jturnbull avatar mellen avatar meshy avatar mjtamlyn avatar perry avatar rjmunro avatar ymebo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.