Django Admin Fu, part 2

Continuing with the Django Admin Fu post part 1.

Action with Intermediate Page

Sometimes you may need an admin action that, when submitted, takes the user to a form where they provides some additional detail. The docs mention a bit about providing intermediate pages, but not a lot. It states:

Generally, something like [writing a intermediate page through the admin] isn’t considered a great idea. Most of the time, the best practice will be to return an HttpResponseRedirect and redirect the user to a view you’ve written, passing the list of selected objects in the GET query string. This allows you to provide complex interaction logic on the intermediary pages.

I do see where the docs are coming from and it would probably be easier to do as advised, but I think there could be something said about keeping all admin logic within the admin page. Doing something like the following would take the user to an intermediate form.

Django Admin Fu, part 1

I've been putting some time into building out the Django Admin site for one of my company's projects. Here are some notes I've taken about straying away from the beaten path. I find surprisingly little information about how to do these things on StackOverflow or elsewhere. These were put used when working with Django 1.6.7.

Fake The Model, Make The View

You may want a form on the Django Admin that exists along side the model views but doesn't actually represent a model. This strays somewhat from what the Django Admin is set up to do (some on the #django channel on Freenode have stated that the admin should only be for CRUD operations on Django models.) None-the-less, if you do want to inject a form into the admin along side your models, this is a method that worked for me.

It revolves around generating a fake model that you register to your app's admin view. After that, you create a model admin that inherits from the standard ModelAdmin.

See more in part 2.

Learning AngularJS

Here is a quick dump of some of the better resources that I came across while learning AngularJS.

StackOverflow: How to 'think in AngularJS' - Great for getting the appropriate mindset.'s AngularJS series by John Lindquist - Excellently cut up into discrete segments to cover fundamentals.

Introduction to AngularJS - First in a series of developing an Angular app. Then watch [End to End](End to End with Angular JS), Security, Frontend Workflows, Testing

SublimeText3 Setup

As I was transitioning from SublimeText2 to SublimeText3, it became apparent that I should keep a copy of my favorite text editor's plugins and settings.