Posts Tagged ‘django

It’s funny what a day’s wrestling with a hard problem can lead to as inspiration. I’m going to start with a piece of Django code that someone else wrote: Django Activity Stream, a simple piece of code that lets you track “everything” the actors in your system do: every bookmark made, every comment made, every […]


An awesome truth!

Posted by Elf Sternberg as Uncategorized

From twitter: has migrated to Django. If you don’t understand this, please register with your local unemployment office.

Today’s little snippet: Filtering a loosely coupled many-to-many relationship.  As revealed earlier,  I don’t really “get” the difficulty with many-to-many relationships.  I don’t even get the difficulty with signals; if you define the many-to-many manually, handling signals on it is trivial compared to trying to do it manually in one of the referring classes. Today, […]

The correct call for posting to a user’s facebook wall with Python and pyfacebook, after you’ve established both user authentication via FacebookConnect and gotten stream_publish permission, is: message = render_to_string(template_path, fb_context), action_links = simplejson.dumps( [{‘text': “Check Us Out!”, ‘href': “”}]), target_id = ‘nf’) See that ‘nf’ down there in target_id?  It’s not on any […]

One of the nifty things that Django provides is the {% url backreference %} syntax, which allows you to name the targets in your list of URL objects and then refer to them by an explicit name. You can sometimes use the function name instead, and Django has a way of turning the function name back into the […]

At (and some other sites, but I’ll use as my example), one of the most interesting features is that your username is one of the first-level “commands” you can send to the application: “” is a valid URL, and points to my collection of bookmarks. At the same, there are other first-level commands […]

Introduction When you roll around the web you see lots of web applications that show off some localized capability to get data from a back-end in a semi-real-time manner. The most famous is the “search suggestion” drop-down that comes off Google or Bing, and those are wonderful, but often the Javascript for the drop down […]

Most people encountering the Ajax components of Django for the first time usually encounter this pairing: from django.utils import simplejson … return HttpResponse(simplejson.dumps(some_python_obj)) For most applications, this is enough.  But I’m especially fond of iterators, generators, functors and closures, dense components that express one thought well: the structure of a tree, or the rows of […]


Python can be just as ugly as PHP…

Posted by Elf Sternberg as PHP, python

I was reading through the WordPress source code, trying to figure out a problem for a contractor, when I saw the function compact().  When I saw it I boggled, read the description, and shook my head. Compact() takes a list of variable names as strings, and returns a hash of those variable names and their […]

A couple of weeks ago I bought the book “The Definitive Guide to Django,” and I’ve come to realize, to my frustration, that the book is already outdated.  My big headache this week was dealing with the administration interface, which the Django people swear is one of the coolest features of the entire application server.  […]

Subscribe to Feed



January 2018
« Nov