Core Concepts of Django ModelForms
Thursday, June 13, 2013 (permalink)
In my opinion, the concepts behind Django's model forms can be listed in just six (6) bullets. The bullets I've marked in bold at the top are the topic of this blog post, while the two of these that were covered in a previous blog post on Django ...
Read more ...The Easy Form Views Pattern Controversy
Friday, May 10, 2013 (permalink)
In the summer of 2010 Frank Wiles of Revsys exposed me to what I later called the "Easy Form Views" pattern when creating Django form function views. I used this technique in a variety of places, including Django Packages and the documentation for django-uni-form (which is rebooted as django-crispy-forms). At ...
Read more ...Tools we used to write Two Scoops of Django
Friday, May 03, 2013 (permalink)
Because of the ubiquitousness of reStructuredText in the lives of Python developers and the advocacy of it, it's not uncommon for people to assume we used it to write our book. However, that's not really the case.
The short Answer is we used:
- reStructuredText (RST)
- Google Documents
- Apple ...
Filepicker.io and South
Tuesday, April 23, 2013 (permalink)
I've heard good things about filepicker.io, which is a service that makes file uploading a much better experience. Unfortunately, the Django package for filepicker.io doesn't work with South. When I try to create a migration using the filepicker.io field using code like the following...
# products ...Off to Europe!
Saturday, April 20, 2013 (permalink)
I feel like I'm dreaming, but we're on our way to Europe!
A few weeks Audrey and I decided to move. While looking at possible rentals or even mortgages, we were idly (dreaming really... still paying off debts incurred from last year) looking at how much a room ...
Read more ...Two Scoops of Django is in print!
Wednesday, April 17, 2013 (permalink)
Since I was a child I wanted to be a published author. I've dreamt of people reading my book. While one could say that dream was fulfilled when we launched the e-book version in January, it's not the same as seeing the printed copy. Today I got to ...
Read more ...Generating NCX files with Python
Monday, April 15, 2013 (permalink)
With the help of fellow Python developer Matt Harrison's excellent Ebook Formatting: KF8, Mobi & EPUB, we managed to create pretty decent looking Kindle and ePub versions of Two Scoops of Django.
One of many things we did was focus on providing an excellent table of contents. Of course we ...
Read more ...Core Concepts of Django Forms
Friday, March 29, 2013 (permalink)
In my opinion, the concepts behind Django's non-model forms can be listed in just three (3) bullets:
- Forms render HTML.
- Forms are "just" Python constructs.
- Forms validate dictionaries (Python's Key/Value structure).
Let's dig in!
Forms render HTML.
If I construct a Django form:
# myapp/forms.py ...Overloading Django Form Fields
Wednesday, March 27, 2013 (permalink)
One of the patterns we get positive feedback for mentioning in our book is overloading form fields.
The problem this pattern handles is the use case of when we have a model with a field(s) that allows for blank values, how do we force users to enter values?
For ...
Read more ...Beginner's Guide to PyCon 2013 Part III
Sunday, March 10, 2013 (permalink)
This is Part III in a series of blog posts about PyCon US 2013. The goal is to provide a handy reference guide for first time attendees of the world's largest Python conference. Part I was mostly about tutorials, Part II was mostly about the first day of talks ...
Read more ...PyCon Tutorial: Wiring Up Django Packages
Friday, March 08, 2013 (permalink)
You just finished the Django tutorial. What now?
You learn how to Wire Up Django Packages!
This is a 3+ hour PyCon tutorial on March 14th at 1:20pm, in Santa Clara California at PyCon US.
In alphabetical order, the instructors:
- Audrey Roy
- Daniel Greenfeld (myself)
- Kenneth Love
Tutorial Description ...
We are not using PayPal
Saturday, March 02, 2013 (permalink)
In January Audrey Roy and I launched a book about Django called Two Scoops of Django: Best Practices for Django 1.5. We decided to not use PayPal. Here's why:
Open Source Events Get Burned By PayPal
PayPal has a long, sordid history of freezing the accounts of Python ...
Two Scoops of Django 1.5 Beta Released
Thursday, February 28, 2013 (permalink)
After thirty four days of hard work, Audrey Roy and I are proud to announce that we've released the beta of Two Scoops of Django: Best Practices for Django 1.5. It's been a monumental effort, a labor of love, and we hope you find our efforts worthy ...
Read more ...Beginner's Guide to PyCon 2013 Part II
Wednesday, January 23, 2013 (permalink)
This is Part II in a series of blog posts about PyCon US 2013. The goal is to provide a handy reference guide for first time attendees of the world's largest Python conference. Part I was mostly about tutorials, this post will be about registration and the first day ...
Read more ...Beginner's Guide to PyCon 2013 Part I
Tuesday, January 22, 2013 (permalink)
New to Python and thinking about going to the upcoming PyCon US for the first time? You know, that big Python conference taking place near San Francisco in March?
Or perhaps you signed up already and are getting worried about being overwhelmed by hundreds of tutorials, talks, and activities?
No ...
Read more ...Two Scoops of Django FAQ
Monday, January 21, 2013 (permalink)
The launch of the Two Scoops of Django: Best Practices for Django 1.5 book has gone pretty well. The response has been almost entirely positive and sales have been pretty brisk. We've gotten a ton of great, constructive editorial feedback, which we're sorting through as we race ...
Read more ...Our Django Book Has Launched
Thursday, January 17, 2013 (permalink)
We (Audrey Roy and I) wrote a book on Django! It's called Two Scoops of Django: Best Practices for Django 1.5, and you can buy it right now in e-book (PDF) form on the website: http://django.2scoops.org.
Django, like any framework, has tips, tricks, and pitfalls ...
Read more ...New Year's Resolutions for 2013
Monday, December 31, 2012 (permalink)
I'm one of those people who not only likes to make New Year's Resolutions, I like to blog about them.
Resolution
- Go to at least one technical conference in North America, South America, Europe, Asia, Africa, and Australia.
- Visit at least one new nation. It's hard to ...
New Year's Python Meme 2012
Friday, December 28, 2012 (permalink)
Tarek Ziade has a habit of ending the year with a Python-themed meme. I've matched his meme the times he previousstarted it, and as you can tell from the title of this blog post I'm matching him yet again.
1. What’s the coolest Python application, framework or ...
Developer Time
Tuesday, December 04, 2012 (permalink)
This blog post got started with a tweet.
That tweet got retweeted a lot by developers. And system administrators. And database administrators. And any creative type.
As of December 7th, 2012, it had been retweeted over 500 times, a personal best. Obviously I struck a chord that resonated with a ...
Read more ...Stay with the Django CBV defaults!
Tuesday, November 27, 2012 (permalink)
One virtue of Django Class Based Views (CBVs) is that they come with pretty good default settings. The virtue of this is you can really pare your code down in size and complexity.
For example, here is an implementation of CBVs based on a straight-forward Django model , stuffage.models.Stuff ...
Read more ...Case Study: URL Design for petcheatsheets.com
Wednesday, November 21, 2012 (permalink)
Backstory: On Saturday, November 17, 2012 Audrey Roy and I decided to participate in the Petcentric hackathon, a Los Angeles area Pet-themed product/coding contest held at Amplify. We arrived a bit late, but armed with Audrey's idea of creating a pet based reference sheet for owners, pet sitters ...
Read more ...Django GetOrCreateView
Tuesday, October 16, 2012 (permalink)
Today I decided to use the Django class based view (CBV) CreateView, but I wanted to avoid duplications and submit to the view from the front page of a site. The reason was I needed a simple newsletter signup form. This is what I cooked up and should work for ...
Read more ...Los Angeles Open Source Sprint on Nov 4th!
Sunday, October 14, 2012 (permalink)
Yet again, myself, Audrey Roy, and a small but elite cadre of volunteers are feverishly at work putting together another Los Angeles open source event. Our last effort went smashingly well, and like any good engineer, we're ready to scale up - this time to 150 attendees!
LA Open Source ...
Read more ...We need more PyCon US 2013 submissions!
Thursday, September 27, 2012 (permalink)
The PyCon US 2013 call for papers (CFP) ends tomorrow, September 28th, 2012. We need more talk and tutorial submissions. Talks are 30 or 45 minute efforts in front of the PyCon audience and are recorded for posterity. Tutorials are three hours long and are given to attendees who have ...
Read more ...Thoughts on my stack
Tuesday, September 04, 2012 (permalink)
I'm an open source developer. I use Python, Django, PostgreSQL, JQuery, MongoDB, Memcached, and Redis. I push production code to Linux servers.
And yet:
- My laptop runs Apple's Mac OS X.
- My primary editor is Sublime Text.
- My production servers are provided mostly by Heroku.
- All my sites ...
A Public Service Message to the Python Community
Monday, August 20, 2012 (permalink)
Hi, I'm Daniel Greenfeld. You might know me from my blog. I'm here to talk to you about a very import subject: Submitting your talk early to PyCon US.
Last year there were hundreds of talks were submitted for just a very few speaking slots. Unpaid volunteers labored ...
Read more ...Django Requirements 2012-08-15
Wednesday, August 15, 2012 (permalink)
A little over three months ago I blogged about my preferred requirements list. It's now nearly the eve of Django Dash, and I feel it's time to update the list. I'm going to bump the versions on some of the existing packages and add some new ones ...
Read more ...Curiosity has landed!
Monday, August 06, 2012 (permalink)
I'm terribly proud of what was accomplished last night: A car-sized robot weighing a whopping 8,580 pounds (3,893 kg) was landed on Mars. It is packed with scientific packages that will expand our knowledge of Mars, and has the power to use them for at least 14 ...
Read more ...Deadline for DjangoCon Financial Aid requests is tomorrow!
Thursday, August 02, 2012 (permalink)
For 2012, DjangoCon US has moved to Washington, DC, and everyone is invited! If you need financial support to get there, the Django Software Foundation and PyLadies have paired with a number of forward thinking sponsors to help get you there. All genders are eligible for assistance, so don't ...
Read more ...Attaching custom exceptions to functions and classes
Thursday, August 02, 2012 (permalink)
Having too many custom exceptions on a project can be a pain, but a few choices ones are really nice. The problem is that in complex libraries having to import both functions and exceptions becomes a drag. To mitigate having to remember to import custom exceptions, this is a handy ...
Read more ...Django Update View without slug in the url
Saturday, July 28, 2012 (permalink)
Today I wanted to use the Django Class Based View (CBV) UpdateView but without a slug identifier in the URL. For example, instead of /profiles/pydanny/ I would go to /my-crazy-profile/. Also, I needed to force authentication.
I've done this with Django functional views a few times times, but ...
Read more ...July 15th, 2012 LA Open Source Recap
Monday, July 16, 2012 (permalink)
On July 15th, 2012, at the July LA Hackathons Open Source event, over 60 Python, Django, Ruby, Ruby on Rails, PHP, JavaScript, Node.js, Perl, and Clojure developers arrived to work on a variety of projects. We went from 10 AM to 10 PM, and there was much coding and ...
Read more ...Simple HTTP Basic Auth Wall
Monday, July 09, 2012 (permalink)
I have a client who wanted their entire unlaunched public content site quickly but temporarily blocked for a short period of time. He wanted a universal password so he could send the site to reviewers, done quickly, and nothing else. In a few days the site will launch, and even ...
Read more ...PyCon Philippines 2012 Day 2
Thursday, July 05, 2012 (permalink)
The second day of PyCon Philippines 2012 had a really good turnout. My unofficial estimate is that we had about 90% of the attendees from the first day attend (with the unfortunate exception of most of the faculty and students of Agoo Computer College).
The day started with...
Lightning Talks ...
PyCon Philippines 2012 Day 1
Tuesday, July 03, 2012 (permalink)
PyCon Philippines 2012 (PyCon PH) happened just this past weekend at the University of the Philippines Diliman (UP Diliman) campus in Quezon City, which is part of Metro Manila.
I can assure you that PyCon PH was an wonderful, amazing, humbling experience. I'm hoping that this post and others ...
Read more ...Announcing PyCon Philippines!
Saturday, June 09, 2012 (permalink)
PyCon Philippines 2012, set to occur on June 30 and July 1, is the first Python programming conference held in the Philippines. PyCon is a volunteer run effort that brings together Python developers from a variety of backgrounds and skill levels into a friendly, cooperative environment in order to educate ...
Read more ...Django Class Based View: email form with CAPTCHA
Wednesday, May 23, 2012 (permalink)
Yesterday I showed how to implement a simple email form for Django using Class Based Views. Today I'm going to extend yesterday's work to use the excellent RECAPTCHA service to help reduce spam content.
This version requires pip installing the following into your virtualenv.
- pip install django-crispy-forms so ...
Simple Django email form using CBV
Tuesday, May 22, 2012 (permalink)
Here's a simple FormView Class Based Views for Django. Here is a sample of how to do one as a simple email form. There is no CAPTCHA in this example, that's the topic of a future blog post.
This version requires the following packages pip installed into your ...
Read more ...May 12th, 2012 LA Open Source Recap
Monday, May 21, 2012 (permalink)
On May 12th, 2012, over 50 Python, C++, Ruby, PHP, JavaScript, and Node.js developers arrived to code on a variety of projects. It was awesome! Tons of open source projects saw contributions, and people across languages and frameworks worked together.
Event Background
Less then two weeks before May 12 ...
10 reasons to go to DjangoCon Europe
Monday, May 14, 2012 (permalink)
You should go to DjangoCon Europe in lovely Zurich, Switzerland. Here are 10 reasons why:
1. Chocolate
So much of what we like about chocolate comes from Switzerland. For example, Milk Chocolate was invented in Switzerland.
2. Keynote speaker: Jacob Kaplan-Moss
Always a great speaker and fun to be around ...
CSS Hacking to make my code samples legible
Friday, May 11, 2012 (permalink)
I've been very happy with Pelican as a blog engine so far, and haven't even moved off the sample theme. There's just been one problem: Myself and others have had a lot of trouble reading the code snippets.
I didn't have time to cook up a ...
Read more ...Choosing an API framework for Django
Thursday, May 10, 2012 (permalink)
First off, out of the box, Django lets you construct API responses with a little work. All you need to do is something like this:
# Copied from https://docs.djangoproject.com/en/1.4/topics/class-based-views/#more-than-just-html
from django import http
from django.utils import simplejson as json
class JSONResponseMixin ...Django Requirements for a project
Wednesday, May 09, 2012 (permalink)
Today I'm starting a new project. I'm working as fast as I can and hope to launch on Friday. What are my package dependencies?
Django==1.4
Unlike my last quick project which was Flask, this effort really falls into Django's sweet spot. I need sessions, forms ...
Los Angeles Open Source Sprint on May 12th!
Tuesday, May 01, 2012 (permalink)
This is a day long coding event in Los Angeles for Open Source developers of all languages and skill levels to come and code like fiends. They'll be joined by dozens of either really smart coders or nice people like me. Sponsors are providing food, drinks, venue, and more ...
Read more ...Join us at DjangoCon Europe!
Tuesday, April 10, 2012 (permalink)
This year in June, the European edition of DjangoCon is going to be held in lovely Zurich, Switzerland. It is my great fortune and delight to announce that Audrey and I will be attending. Hooray!
Needless to say, we're extremely excited. My trip to Europe in 2007 was an ...
Read more ...Calendar About Nothing
Wednesday, March 28, 2012 (permalink)
On October 16th, 2011, which was one hundred and sixty-four days before I published this post, I resolved to get myself onto the Longest Streak list of Calendar About Nothing. Today, with this blog post, I've managed to do just that - get on the Longest Streaks.
Calendar About Nothing ...
Read more ...Launching our API at PyCon 2012
Friday, March 09, 2012 (permalink)
A few months ago me and my fiancee, Audrey Roy, launched our start up, Consumer Notebook. It's a Python powered product comparison site that combines the best features of Open Comparison, Yelp, Consumer Reports, and Pinterest. We've worked day and night to make it better, with countless members ...
Read more ...The sorry state of Python OAuth providers
Monday, March 05, 2012 (permalink)
This is one of those challenging posts to write. The people whose projects I'm going to describe have put in a lot of dedicated, hard work to overcome a challenging subject. Writing an OAuth consumer is a hard problem and writing an OAuth provider is an even harder problem ...
Read more ...You should Heroku
Tuesday, February 28, 2012 (permalink)
In mid-November me and my fiancee, Audrey Roy began our startup. We had been frustrated with trying to do on-line product research and came up with an idea to take the lessons learned from Django Packages / Open Comparison and apply them to a commercial effort. The result has been Consumer ...
Read more ...My PyCon 2012 Schedule
Wednesday, February 22, 2012 (permalink)
Here I was thinking that this year's PyCon wasn't going to be so busy because I didn't submit a talk or tutorial. Ha! What the heck was I thinking?
Here's what I've already got in the works.
Wednesday, March 7th
Me and Audrey are driving ...
Selected for PyCon StartUp Row
Tuesday, February 21, 2012 (permalink)
Me and Audrey have been working hard on Consumer Notebook, a Python/Django based project. We submitted it to PyCon StartUp row and found out this morning we've been accepted. Hooray!
From the PyCon StartUp Row winner's post, here is a little bit of what we're about ...
Read more ...django-uni-form end of life
Saturday, February 18, 2012 (permalink)
I started on django-uni-form in January 2009. In order to use Pinax on an internal social network for NASA HQ, we had to render all content, including forms, Section 508 compliant. Rather than rewrite the html for all 50+ forms that existed in the Pinax 0.5.x framework at ...
Read more ...
