« Django now has fast tests | Encouraging Web Interaction for University Students »
5 second review: Reading this book will make you a much better Django Programmer.
In full disclosure, I was sent a review copy of this book by the publisher, but I had already pre-ordered it on Amazon, and the copy I am reviewing is that copy. The review copy is now the office copy :)
I will do an overview, and then a specific breakdown of what I thought after reading each chapter. This is currently only the first half of the book, but the book is already worth it's price (perhaps in gold). This covers chapters 1-6, which is basically the normal URLs/Models/Views/Templates stuff. The later sections appear to cover more specialized and advanced use cases. You can download the table of contents also.
Also note, that you can see my further reviews and some other peoples over on Readernaut
Pro Django is certainly not for the beginner. It assumes a pretty decent amount of Django experience (or at least the ability to learn/reference it easily). I think that this is a good thing, because it doesn't get bogged down in silly details and explanations when what we want is upper level content. If you have been doing Django stuff for a couple months, I think this book is amazingly good at pushing you to the next level of knowledge in the field.
I certainly recommend reading James Bennett's Practical Django Projects (once version 2 gets released) before this one, as it is an easier introduction. These two books together provide an amazing 1-2 knockup punch to getting you to be a great Django developer. Now onto the review.
This chapter goes over the basics of Django and the philosophy that it has. It is a great introduction into how to be a good member of the Django community. It is available for free on the Apress website, and I recommend reading it, because I felt inspired by the prologue, and I think that Marty explains the value of the community around Django very well.
Links from the books pages are provided as links from prodjango.com, which is nice at first, but the obfuscation of the URLs is a pain later in the book. It is used as a way to hide information ("The django irc channel", with a link) instead of #django in irc.freenode.net. Also, I have read some of the URLs linked to, but knowing where they go helps me decide if i need to read them.
With one of the best descriptions that I have read of metaclassing in python, this chapter starts off guns a-blazing. It tries to show some of the more advanced Python features that Django uses, and stresses that Django is merely Python. I loved the explanation of the gentlemen's agreement on interfaces, including file-like objects. The explanation of metaclassing is finished up with a great example of implementing a plugin system for a password validator. The code ends up being around 40-50 lines, flowing through my brain like a river, and beautiful. It was also explained in a way that allowed me to see the abstract value of the ideas, and not simply how it is useful in this specific implementation.
It also includes a really heady implementation of decorators that blew my mind a little bit. With my current intermediate level of python knowledge, it provided a reference for things that I mostly knew, and went into depth in the parts that were in need of it. A great start to the book. As of page 45, my brain is already going full throttle and I'm looking forward to what this book has in store.
I found this chapter to be a little less amazing than the previous, but still solid. It didn't quite flow as well for me, and I had to think about things a lot more. I didn't have a great understanding of how all of the subject matter fit together. This might just be the fact that I'm not as acquainted with the topics.
It has a cool example of creating a field that stores pickled data and returns it as a normal object. As the chapter progressed the value of the explanations earlier in the chapter start to gel a bit, but not totally. I think that this is one that re-reading, at least for me, will be really valuable after I'm finished. It provided a great reference to all of the different fields, and why we should care about them. I really like the continuing theme of "this is a brief explanation of what X is, and this is an in depth explanation of why you should care"
This chapter does a good job of showing how URLs and Views are inextricably linked. Your URLConf basically just hands off data to views, and it goes over all the interesting things that you can do in this space. It flowed well, was just the right length, and left me really appreciating the value of decorators around views.
The concept of using a decorator on the view function in the URLConf, instead of around the view definition, is novel. The ability to manipulate the arguments to the view in the URLConf file, returning objects instead of strings to the views is very powerful. Using decorators to abstract boilerplate is a really powerful pattern.
The explanation of views and making them more generic was good, but I already knew it from Practical Django Projects. This obviously lead into generic views. He also discussed using a Class as a view (and the downside of trying to reverse() it), but it was lacking a discussion of Class-based Generic Views which I thought was coming. This is going to be implemented by 1.2, so it might have been a good time to at least mention it.
This chapter is not as interesting to me, because I don't plan to be doing a lot of work on front end forms. However, there is still a great explanation of the way that forms work on the backend (almost exactly like models). The harsh warning about verifying user input is good, because user input is indeed evil.
In example at the end of the chapter, Marty goes through how to create a form that can be saved and restored, no matter what the contents. It ends up being implemented in a decorator, which blew my mind. All you have is a view that handles a valid form, and a decorator gives you the ability to save and resume that same form, simply by posting an md5hash to it. Pretty Crazy. It also goes into Widgets and how to create your own to display forms. There is a bit of a lack of how to include Javascript and CSS inline in your forms, but talks about how to embed custom attributes. Also, there is no mention of creating forms from Models! I feel that this is probably one of the most common operations I do with forms. This might have been excluded because it is already well known and un-interesting.
This chapter explains one of the simpler parts of Django. It is pretty neat that you can understand pretty much how the entire template system works in a chapter of about 20 pages. I knew a decent bit about it before, but this chapter certainly made my knowledge more concrete.
There is a really neat example at the end of the chapter about writing themes for a website. It goes through a really in depth usage of the Template system, including introspecting nodes. I've needed to do something like this for my own stuff, and this example is invaluable. It also talks about how to easily create tags and filters by yourself.
At this point I'm at page 163 of around 300. There is still a ton of great knowledge in this book, and I'm excited to read the rest of it.
Comments have been close for this post.
Posted at 6:24 p.m. on January 21, 2009
Comments: 14
Tags: book , django , marty-alchin , pro-django , review
Large Problems in Django, Mostly Solved: Delayed Execution
1 month Ago (Comments: 10)
Django Inspect: A generic introspection API for Django models
5 months, 2 weeks Ago (Comments: 7)
The role of designers in the Django community
5 months, 3 weeks Ago (Comments: 23)
Large Problems in Django, Mostly Solved: Documentation
5 months, 3 weeks Ago (Comments: 7)
6 months, 3 weeks Ago (Comments: 0)
I may not have gone where I intended to go, but I think I have ended up where I intended to be.
- Douglas Adams


Comments
1 David, biologeek says...
> As of page 45, my brain is already going full throttle and I'm looking forward to what this book has in store.
I'm reading the book, I'm around that page and that's the exact feeling I have for now :-)
> the obfuscation of the URLs is a pain later in the book.
I agree, a prodjango.com/links/ page with both shortcuts (ordered by chapter) and target can be a solution.
Posted at 1:31 a.m. on January 22, 2009
2 Erik Vorhes says...
It looks like the link to the table of contents points to Practical Django Projects, not Pro Django. Still, thanks for this--I'll be picking this up as soon as possible.
Posted at 2:28 a.m. on January 22, 2009
3 Eric Holscher says...
Thanks, Fixed.
Posted at 2:32 a.m. on January 22, 2009
4 Jason says...
You know all those things when you are using Django that you say, 'it would be cool if Django could do so and so', this book tells you how to make those things. I really like the book, I think most people will need to read it twice for everything to sink in.
Posted at 3:05 a.m. on January 22, 2009
5 Brian N says...
Thanks for the review, I look forward to part 2. Does the book cover Django 1.0?
Posted at 3:10 a.m. on January 22, 2009
6 David Grant says...
I bought Practical Django Projects which was unfortunately not so useful because it was a bit out-of-date once Django 1.0 came out. Looks like I'm going to have to get this book for sure, if only for chapters 2 and 4.
Posted at 3:19 a.m. on January 22, 2009
7 Tomcask says...
nice work in review, I find very interesting Readernaut website, Please is possible give me a invitation?
Thanks.
Posted at 7:18 a.m. on January 22, 2009
8 Rock Howard says...
I am also working my way through this book. I think that it is worthwhile to note that the chapter on templates includes a worked templatetag example called "jinja" that escapes to jinja processing for the tagged section. That neatly illustrates the level of "cool" in this book.
Posted at 12:07 p.m. on January 22, 2009
9 Aaron says...
I should have this book at my doorstep this week. Thanks for the writeup, it looked like a good book and your quick review quantified that for me.
Posted at 3:15 p.m. on January 22, 2009
10 Eric Holscher says...
Indeed Rock, that example was awesome!
@Jason, I agree, I'm only halfway through, and it's really dense material. The second reading will probably allow me to really imprint the info on my brain :)
@Tomcask, I tried to send you an invite, but you have already signed up. One of my coworkers is the creator, so you should be getting an invite soonish.
@All, thanks for all the great comments.
Posted at 5:35 p.m. on January 22, 2009
11 Dave Smith says...
Pro Django was on my "some day" list until reading your review. I picked up a copy last night. Chapter 2 is worth the price of the book even if you <i>aren't</i> using Django. It's like climbing up a steep hill and suddenly seeing a great view for the first time.
Posted at 5:48 p.m. on January 23, 2009
12 tomcask says...
@eric thanks for invitation , i hope it.
Posted at 6:24 p.m. on January 23, 2009
13 John Matthew says...
I've ordered the book based on this review. Thanks Eric and Marty
Posted at 9:38 p.m. on January 23, 2009
14 ZK@Web Marketing Blog says...
I admit, I have not been on this webpage in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. I thank you to help making people more aware of possible issues. Great stuff as usual....
Posted at 11:07 a.m. on June 29, 2009