Back when I first launched this site (about a year ago now), I mentioned that I’d someday release the blog application I’d written to power it. So far I’ve been held up by two large problems:
So I’ve been on a mission to clean up the code and get it to a point where I wouldn’t be embarrassed to release it; along the way I’ve been purging features that I don’t actually use, and adding new ones based on features added to Django and useful third-party applications released by the community.
These days, there are two major things holding me up:
Today marks the initial release of another little application that got spun off from the blog software: a generic contact-form system that started out simple and then grew a bit (“a bit” — I’m being somewhat facetious here) as I worked to make it more reusable outside of the blog context it was originally designed for.
Full documentation is online and included in the downloadable package, but here’s the short and sweet overview:
ContactForm class (built with newforms) which handles the simplest case of collecting a name, email address and message, and sending them to your site staff.
ContactForm to make it easy to add new functionality by subclassing it and overriding only the bits you need to change (credit for the good parts of its API go to Jacob, credit for any bad parts probably go to me).
ContactForm or a subclass, and which accepts various parameters to control its behavior.
This one’s definitely still “under development”, and there are probably bugs in it, but I wanted to get it out in the wild to help shake them out; bug reports are welcome (please use the Google Code issue tracker rather than posting bug reports in comments here).
In the meantime, I’ve also been hacking a bit on two other applications: the user-registration app now has a distutils-enabled package you can download, as well as full documentation, and I’m working on adding a few more features to it (be wary of doing an SVN checkout — there be dragons in the code right now), and template_utils has gone through a few bugfixes and enhancements and is now officially on its third release.
I’ve also got one more app planned before I can go back to finishing up blogging once and for all, but I’ve already got most of it fleshed out; I’ve also recently come into possession of a shiny new Joyent Accelerator, and in honor of that I’ll migrate this site over to it as soon as the new codebase (and a minor redesign) are done.
Once that’s all out the door, I’ve got a couple ideas for my next personal project, and so far none of them involve spinning off a bunch of different applications first, so hopefully they’ll take a little less time. The snippets site is also due for some love, I think, so I’ll be going through the issue tracker, looking for bugs and feature requests to deal with. If you’ve got ideas, be sure to submit them :)
While I’m on the subject of useful third-party apps, I should mention that World Online’s own Christian Metts, a gentleman, scholar, designer and no slouch when it comes to writing nifty code, has released typogrify, a set of incredibly handy template filters for those of us who like to have our typography be as beautiful as our code. You should check it out :)
Comments for this entry are closed. If you'd like to share your thoughts on this entry with me, please contact me directly.
Two ideas:
Anyway, thanks for sharing your code!
Not trying to be mean here, but please report stuff to the issue trackers for the actual projects they concern and not here in comments on blog entries; it’s much, much easier to keep track of stuff that way, and has the advantage of letting you look first to see if someone else has reported the same thing.
Darn you. Now I’m going to have to make Typogrify presentable. I so totally had better things to do today. :)
Hey James,
In a somewhat (I think) related matter, I was able to mash-up your Hacking FreeComment Django tip (http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment) with what-I-take-to-your “Unobtrusive comment moderation” Django snippet (http://www.djangosnippets.org/snippets/112/).
Specifically, I was able to add the e-mail-sent-when-comment-made goodness of the FreeComment hack entry using the signals methodology demonstrated in the “Unobstrusive” Django snippet.
All it takes is dropping in the three lines of “Hacking FreeComment” code: mail_subject = ‘New comment posted on %s “%s”’ % (self.site.name, self.get_content_object().title) mail_body = ‘On %s, %s posted the following comment on “%s”:nn%s’ % (self.submit_date.strftime(“%A, %B %d, %Y at %I:%M %p”), self.person_name, self.get_content_object().title, self.comment) mail_managers(mail_subject, mail_body, fail_silently=True)
into your “Unbostrusive” snippet. I put ‘em between lines 28 & 29 ‘cause I want to know every time an e-mails sent, regardless of whether it’s spam or too old or whatever. (But I can change this later by moving the lines in the snipped logic!)
A couple of things to watch out for is substituting “instance” for “self” in the three “Hacking FreeComment” lines. And making sure your model has a “title” (or changing the code to match whatever your model does have).
Oh, and adding the from django.core.mail import mail_managers to whichever file you drop the Django snippet into. I decided on the relevant project’s urls.py. Is that the best place?
So, the bottom line is you can have your hack and eat it too (so to speak)!
Thanks for both entries!