Sep. 8th, 2009

elfs: (Default)

If you’ve created Django Application A, and then Django Application B, it is acceptable (and even sometimes necessary) for Application B to reference Application A.  The canonical example is Django contrib.auth; everyone references that beast.  It is not acceptable for you to go and edit Application A to reference Application B.  That is officially Doin’ It Wrong.

In a smarter world, you will never use a Django ManyToMany field.  You will create an individual class referencing both objects of the many-to-many relationship.  You will inevitably need more smarts than a mere two-column table, and a separate class, however small and insignificant, will provide both self-documentation and a chance to define the __unicode__() method for administration. Django is smart enough to hook up the relationships under the hood.

Unit testing is goddamned hard when your application is married to FacebookConnect.  A smarter relationship uses the SocialAuth layer, with additional proxies for information and posting handlers.  That way, not only can your application send updates to Facebook walls, but it can also update its activity on Twitter, and allow authentication via Google, and so on.  By using the SocialAuth layer, you can create a pseudo-layer that handles testing.  You’re still beholding to testing the SocialAuth stuff yourself.

If you’re using SocialAuth, push all of your user-related smarts into the UserProfile object, and always refer to it.  Build your UserProfile object to own the proxy to the user’s authenticated relationships with social media.  After login, leave the user alone!  Better yet, use middleware to attach the profile to the request object automagically if and when it’s present, and live with it.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com
elfs: (Default)
The Heirarchy of Digital Distractions.

Omaha-approved. Especially the apex.
elfs: (Default)
Mr Potato Head
Mr Potato Head
That disclaimer in the lower right-hand side wasn't there on Friday, so it makes me wonder if maybe Legal got to the artist and the display people and said, "You know, we're going to need a disclaimer."

I guess what the artists is trying to say is that these clothes, whatever they are, are not in the uniform mold of Mr. Potato Head and the millions of clones. But the disclaimer was interesting.

The Lincoln Park Pirates roll
The Lincoln Park Pirates roll
To understand this photo, you have to be familiar with Frank Hayes's song, The Lincoln Park Pirates, which is a protest against a tow truck company in... Chicago, I think.

Anyway, Seattle has recently upgraded to these electronic meters that give out stickers you put on the inside of your window. These stickers often say "Good until... " and a time, up to two hours in the future. The thing about these stickers is that they're good anywhere in Seattle: you're not limited to the one parking spot you paid the meter for. Because the meter doesn't know where you're parked, you can get a parking sticker and the machine will tell you it's "Good until 5:00pm" on a street where it's illegal to park between 3:00pm and 7:00pm.

So, at 3:00pm, when the streets convert over to "all-lanes," the tow trucks go to work.

Larouchite
Larouchite
On the way home, there were Larouchites crawling all over one corner of Westlake Center Square. They tried to get my attention, but I breezed past them.

The Scientologists passing out pamphlets at the other end of the square were at least civil.

I was pleased to see that Metro did not rip out one of my favorite works of public art, Saccadoscopoeia, in order to make space for the new light rail ticket dispensers. Instead, the dispensers have been set up in the middle of the floor in a cluster. Unfortunately, Saccadoscopoeia was not operating today, so I didn't get any good photos. And I have to thank Peter Watts for teaching me what saccades are.

Exit
Exit
And finally, for the past three weeks when I've been taking the light rail, I've been going down this set of stairs. It says merely "Exit" on the top there. A transit cop at the bottom took pains to tell me that it was an emergency exit only. I actually showed him the photograph and said, "It doesn't say emergency exit. It just says exit." He explained, in not great English, that he had had a talk with the transit people and they insisted that they had agreed this was an emergency exit. In that case, I suggested it be labeled correctly. He agreed. He was remarkably civil about it.

Profile

elfs: (Default)
Elf Sternberg

December 2025

S M T W T F S
 12345 6
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 8th, 2026 08:13 pm
Powered by Dreamwidth Studios