Slaptijack Title

Archive for the ‘Programming’ Category

Django 1.2 is on the way

If you’re like me, you’re probably really excited about the changes coming in Django 1.2. The good news is that, as of April 7th, there are only 14 outstanding issues in the Django 1.2 release candidate. Of those 14 remaining issues, it sounds like one in particular is going to require a tremendous amount of [...]

Categories: Programming

Limit ForeignKey to Staff Users in Django

If you’ve ever built a site that has different kinds of users, you’ve probably run across the case where you want a limited number of users to appear in a particular list. For example, you may only want staff members to be assigned ownership of a particular object. If your site has a really huge [...]

Categories: Programming

No such table: django_admin_log

If you get this error when trying to save something in the Django admin, it’s probably because you forgot to synchronize the database after adding the admin application. If you are using a pre-1.2 version of Django, you can simply: $ ./managy.py syncdb Django 1.2 (which is currently in alpha) adds multi-database support. If you [...]

Categories: Programming

Convert milliarcseconds to degrees

I was recently working with a GPS device that returned coordinates in milliarcseconds (mas). Unfortunately, not all mapping applications (Google Maps, for example) can understand milliarcseconds. Therefore, I had to convert milliarcseconds to degrees. The key to the conversion is understanding that one degree is equivalent to 60 arcminutes (arcmin or MOA). Therefore, one degree [...]

Categories: Programming

Python CSV error on new-line character in unquoted field

I deal with a lot of people that prefer to open reports in Microsoft Excel. I’ve gotten used to generating CSV (comma separated value) files in Python for these folks. Ever so often, someone sends me a CSV file they have created via Excel. Invariably, I will get the following error when trying to read [...]

Categories: Programming