Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Yet Another Python ORM
I’ve developed a Python ORM that is intended to be a lightweight, high-performance alternative to SQLObject, SQLAlchemy, the Django ORM, etc. Each of the preceding projects attempts to implement a comprehensive feature set. This ORM, however, is intended to be minimal, with as minimal of a configuration as required. -
Some very usable django apps
I was looking for some easy to plug-in django appsfor my new service.Here are some I decided to use:django-taggingdjango-registrationdjango-threadedcommentsdjango-votingThey seem to be rock stable, and easy to use.Check back soon for more info about the new website. -
ImageField and edit_inline revisited
A while back I wrote about using edit inline with image and file fields. Specifically, I suggested adding an uneditable BooleanField as the core field of the related model. This means you don’t have to set the ImageField or FileField to be core (which would cause confusing behaviour). Removing the related model The downside to having an uneditable core field is that you can’t remove the related model instance using admin. At the time, I wasn’t trouble by this so I just left it. In a recent project I needed to associate photos with articles, use edit_inline for the photos and be able to remove them. So here’s an extended workaround. As well as the uneditable BooleanField (“keep”) which keeps the ArticlePhoto from being deleted, we now have a “remove” BooleanField which the user can tick in admin to cause the ArticlePhoto to be deleted. The check for this is in the save() method. class ArticlePhoto(models.Model): article = models.ForeignKey(Article, related_name='photos', edit_inline=models.TABULAR, min_num_in_admin=5) keep = models.BooleanField(core=True, default=True, editable=False) remove = models.BooleanField(default=False) image = CustomImageField() def save(self): if not self.id and not self.image: return if self.remove: self.delete() else: super(ArticlePhoto, self).save() It’s a pretty easy way to work around the problem and gives … -
Beautiful and free icons
While building websites there can be the need for a beautiful and meaningful icon. Up to now I haven't seen many icon collections that satisfied me, either the icon itself is badly drawn or you can't assign an accurate meaning. But that is different with the silk icons of Mark James... Somehow I embosomed his collection, it's the first where I have a look when I need an icon - and not until yesterday. The collection is free (doesn't happen that often), the icons in 16x16 pixels are beautiful and good to use for the things use usually use an icon for ;) There is also an overview over all icons with their titles where you can derive their purpose. All 1000 icons are in the PNG format, the collection currently is in version 1.3. If you like beautiful icons, have a look! -
Beautiful and free icons
While building websites there can be the need for a beautiful and meaningful icon. Up to now I haven't seen many icon collections that satisfied me, either the icon itself is badly drawn or you can't assign an accurate meaning. But that is different with the silk icons of Mark James... Somehow I embosomed his collection, it's the first where I have a look when I need an icon - and not until yesterday. The collection is free (doesn't happen that often), the icons in 16x16 pixels are beautiful and good to use for the things use usually use an icon for ;) There is also an overview over all icons with their titles where you can derive their purpose. All 1000 icons are in the PNG format, the collection currently is in version 1.3. If you like beautiful icons, have a look! -
Beautiful and free icons
While building websites there can be the need for a beautiful and meaningful icon. Up to now I haven't seen many icon collections that satisfied me, either the icon itself is badly drawn or you can't assign an accurate meaning. But that is different with the silk icons of Mark James... Somehow I embosomed his collection, it's the first where I have a look when I need an icon - and not until yesterday. The collection is free (doesn't happen that often), the icons in 16x16 pixels are beautiful and good to use for the things use usually use an icon for ;) There is also an overview over all icons with their titles where you can derive their purpose. All 1000 icons are in the PNG format, the collection currently is in version 1.3. If you like beautiful icons, have a look! -
Sailing on…
Almost four years ago, Adrian posted about a job opening at this little newspaper in the middle of the country. He wrote that World Online is […] one of the most innovative online-news operations in the world. Our main sites […] have garnered an impressive batch of industry awards – and tremendous industry attention – over the past few years. […] We strive for innovation, nimble development and the use of best practices. -
Test IE6 on PC with IE7
If you created webpages you probably want the page to look nearly the same in all browsers. Because there are still many Internet Explorer 6 users out there you should adjust your site for this browser, too. But that's not that easy if you have installed the IE7 because you don't have the IE6 anymore. But a VirtualPC image of Microsoft finds a remedy. It comes with Windows XP and IE6 (or IE7 if you still have the IE6 and want to test IE7). Simply open it in the (free) VirtualPC software and enjoy the IE6 browserworld! go to Download -
Test IE6 on PC with IE7
If you created webpages you probably want the page to look nearly the same in all browsers. Because there are still many Internet Explorer 6 users out there you should adjust your site for this browser, too. But that's not that easy if you have installed the IE7 because you don't have the IE6 anymore. But a VirtualPC image of Microsoft finds a remedy. It comes with Windows XP and IE6 (or IE7 if you still have the IE6 and want to test IE7). Simply open it in the (free) VirtualPC software and enjoy the IE6 browserworld! go to Download -
Test IE6 on PC with IE7
If you created webpages you probably want the page to look nearly the same in all browsers. Because there are still many Internet Explorer 6 users out there you should adjust your site for this browser, too. But that's not that easy if you have installed the IE7 because you don't have the IE6 anymore. But a VirtualPC image of Microsoft finds a remedy. It comes with Windows XP and IE6 (or IE7 if you still have the IE6 and want to test IE7). Simply open it in the (free) VirtualPC software and enjoy the IE6 browserworld! go to Download -
TYPO3: Limit creatable elements per page
Sometimes it is necessary to limit the creatable elements on a page. This is especially useful if you only want to save specific elements within a SysFolder, e.g. within "users" there should be only users. Within the TSConfig of the appropriate page add the following TypoScript having db_tablename be the database table with the elements you want to limit to: mod.web_list.allowedNewTables = db_tablename,db_tablename_2 -
TYPO3: Limit creatable elements per page
Sometimes it is necessary to limit the creatable elements on a page. This is especially useful if you only want to save specific elements within a SysFolder, e.g. within "users" there should be only users. Within the TSConfig of the appropriate page add the following TypoScript having db_tablename be the database table with the elements you want to limit to: mod.web_list.allowedNewTables = db_tablename,db_tablename_2 -
TYPO3: Limit creatable elements per page
Sometimes it is necessary to limit the creatable elements on a page. This is especially useful if you only want to save specific elements within a SysFolder, e.g. within "users" there should be only users. Within the TSConfig of the appropriate page add the following TypoScript having db_tablename be the database table with the elements you want to limit to: mod.web_list.allowedNewTables = db_tablename,db_tablename_2 -
getting ReviewBoard running
I made some notes on getting Review Board up and running. I thought they might be useful for someone else wishing to do the same… I implemented review board on a virtual machine, with the VM running Ubuntu Gutsy. I … Continue reading → -
StaticGenerator 1.2
StaticGenerator for Django has been updated to version 1.2. This is a minor release, though it is backwards incompatible. -
djangopeople.net, GeoDjango and PostGIS
Michael Trier's "This Week In Django" podcast is turning into something of a gem mine. I'm particularly taken with one website he mentioned, djangopeople.net. Plus, thoughts on GeoDjango and PostGIS, and the iPhone's Wi-Fi Locations technology. -
Twitter user timeline with a Django templatetag
A simple templatetag for adding to the template context a variable with the user timeline from Twitter. It uses the CachedContextUpdatingNode snippet for caching from Jacob Kaplan-Moss. The reason that is necessary to cache content is because Twitter limits the number of accesses to the API. This only works if the cache is enabled on your settings.py. class TwitterNode(CachedContextUpdatingNode): cache_timeout = 1800 # 30 Minutes, maybe you want to change this def __init__(self, username, varname): self.username = username self.varname = varname def make_datetime(self, created_at): return datetime.fromtimestamp(mktime(strptime(created_at, '%a %b %d %H:%M:%S +0000 %Y'))) def get_cache_key(self, context): return 'twitter_user_timeline_cache' def get_content(self, context): try: response = urllib.urlopen('http://twitter.com/statuses/user_timeline/%s.json' % self.username).read() json = simplejson.loads(response) except: return {self.varname : None} for i in range(len(json)): json[i]['created_at'] = self.make_datetime(json[i]['created_at']) return {self.varname : json} @register.tag def twitter_user_timeline(parser, token): bits = token.contents.split() if len(bits) != 4: raise TemplateSyntaxError, "twitter_user_timeline tag takes exactly three arguments" if bits[2] != 'as': raise TemplateSyntaxError, "second argument to twitter_user_timeline tag must be 'as'" return TwitterNode(bits[1], bits[3]) Usage: {% twitter_user_timeline username as twitter_entries %} {% if twitter_entries %} {% for entry in twitter_entries %} {{ entry.created_at|date:"d M Y H:i" }} - {{ entry.text }} {% endfor %} {% endif %} Use the source, Luke. -
Twitter user timeline with a Django templatetag
A simple templatetag for adding to the template context a variable with the user timeline from Twitter. It uses the CachedContextUpdatingNode snippet for caching from Jacob Kaplan-Moss. The reason that is necessary to cache content is because Twitter limits the number of accesses to the API. This only works if the cache is enabled on your settings.py. class TwitterNode(CachedContextUpdatingNode): cache_timeout = 1800 # 30 Minutes, maybe you want to change this def __init__(self, username, varname): self.username = username self.varname = varname def make_datetime(self, created_at): return datetime.fromtimestamp(mktime(strptime(created_at, '%a %b %d %H:%M:%S +0000 %Y'))) def get_cache_key(self, context): return 'twitter_user_timeline_cache' def get_content(self, context): try: response = urllib.urlopen('http://twitter.com/statuses/user_timeline/%s.json' % self.username).read() json = simplejson.loads(response) except: return {self.varname : None} for i in range(len(json)): json[i]['created_at'] = self.make_datetime(json[i]['created_at']) return {self.varname : json} @register.tag def twitter_user_timeline(parser, token): bits = token.contents.split() if len(bits) != 4: raise TemplateSyntaxError, "twitter_user_timeline tag takes exactly three arguments" if bits[2] != 'as': raise TemplateSyntaxError, "second argument to twitter_user_timeline tag must be 'as'" return TwitterNode(bits[1], bits[3]) Usage: {% twitter_user_timeline username as twitter_entries %} {% if twitter_entries %} {% for entry in twitter_entries %} {{ entry.created_at|date:"d M Y H:i" }} - {{ entry.text }} {% endfor %} {% endif %} Use the source, Luke. -
OpenCalais beats me to the punch
I've been playing with various entity and information extraction frameworks for the past couple weeks with the goal of creating an web service for extracting the major topics from news articles. SP far, my work, such that it is, has shown promise, but is not as robust or reliable as I would have hoped. I just noticed that Reuters has apparantly been working along the same lines and have opened their work to the public. On the one hand, I feel beaten. On the other, their service does not appear to be much better than my own - although they'll have a larger set of people re-training their decision trees than I'll ever have. I've been using posts from my own blog as my testing ground, so I thought I'd throw my last post through and see what it churns out: Relations: PersonProfessional Organization: Entrepreneur Fund IndustryTerm: rubber Person: Len Gilbert, Tom Berreca, Darline Jean, Glenn Franxman, Matthew de Gannon, Sam Parker, Clark, Beth Higbee, Eleanor Cippel, Martha Stewart City: Naples Well, I don't even try to extract relations, so that's pretty cool. IndustryTerm is pretty puzzling, although I understand why they were fooled by it. My organization extraction appears … -
Overdue Catchup
I've had a very busy few months in every way conceivable - everything from my Django projects, to my day job, to life as a whole has been running in fast-forward. Here's a quick summary of the DjangoSites is coming along very well, with 1040 sites listed as of this evening. The quantity and quality is ever-increasing, and more and more sites are being claimed. There are still well over 300 unclaimed sites - is yours listed there? If so, drop an email with your DjangoSites username to djangosites@djangosites.org. After a server move late last year my Django OpenID project went offline for a little while. After a handful of requests from the blogosphere I've put it back online - see my original blog posting on the topic for more details, although I'm guessing that Simon Willison has something up his sleeve that'll trump my hack-job soon enougy. Over my Christmas holidays I launched Jutda, the 'corporate' face for my upcoming web projects built with Django. The word Jutda is from the Wagiman language, a dialect spoken by an ever-shrinking Aboriginal tribe in the Northern Territory of Australia. It means show the way, which is something I hope to do … -
Overdue Catchup
I've had a very busy few months in every way conceivable - everything from my Django projects, to my day job, to life as a whole has been running in fast-forward. Here's a quick summary of the DjangoSites is coming along very well, with 1040 sites listed as of this evening … -
Starting in with ReviewBoard
I’ve been meaning to dive into the project ReviewBoard since I first heard about it, many months ago. I had first heard of a similar critter – Google’s internal tool called Mondrian. I was pretty darn excited about that tool … Continue reading → -
Django on Ubuntu 7.10 (gutsy)
I slapped together a virtual machine to try out an instance of ReviewBoard. It’s been a little while since I fiddled with Ubuntu, so I grabbed the latest server release(7.10) and set it up. Then I settled in to get … Continue reading → -
A Mercurial mirror of Django's Subversion repository
Just wanted to post a quick note that I'm now publishing an experimental Mercurial mirror of the Django source code repository, including all tags and branches and even the djangoproject.com website source itself. Tom Tobin at The Onion has been maintaining a similar mirror of Django trunk for a while (and very helpfully answered some of my questions in IRC), but I wanted to do the whole tree. It's an experiment, which is to say it might go away at any time, so be warned! And let me know if you think it's useful. Components in the chain include svnsync, hgwebdir, Apache mod_cache, and even Pygments for source code colorizing. It's updated once per hour. My earlier experiments along these lines used hgsvn, which is cool because it tags each commit with the corresponding svn rev number. Unfortunately, hgsvn basically ground to a halt while trying to digest all 7000 revs, so I switched to Mercurial's built-in "convert" command. Mercurial doesn't yet support partial-tree cloning, so if you want your own copy you're going to be fetching the whole thing! It takes up about 350MB, which isn't bad considering it includes all 7000+ changesets. Have fun! http://hg.dpaste.com/django/ Update: I've replaced … -
New Projects
In the past couple weeks my curiosity has inspired me to create several new projects. Some are useful, others are simply proof-of-concept. Written in a variety of languages—Javascript, Python and Ruby—the following programs are works in progress. Please try them out and let me know what you think.