Blog from the Loft

Thoughts without walls

Blog from the Loft header image 4

Entries Tagged as 'django'

Django and PyTextile Revisited

July 1st, 2008 · No Comments · django

I wrote a post earlier about PyTextile not working well in Django. James Bennet was nice enough to add some pointers to the issue. (Comments are working now on my Blog). Now that I am using textile more, I want to investigate and document the issue better.
Most importantly, the problem exists only with the0.96x version [...]

[Read more →]

Tags:

J2EE to Django, slides for the Presentation at Cambridge Python Meetup

June 29th, 2008 · No Comments · django

I gave a short presentation on Django to the Cambridge Python Users group earlier. Nate has a great writeup of the event and the other presentations that evening. I just want to share the slides here. The slides are just visual reminders and do not stand on their own. If you want more info free [...]

[Read more →]

Tags:

Django Tip: No leading slash for upload_to for FileField and ImageField

May 9th, 2008 · No Comments · django

This is a common mistake. When defining a FileField or an ImageField, you need to specify
where the files are stored. This is done by specifying a relative path in the upload_to
argument. Django will then store your files in a subdirectory as named, under the MEDIA_ROOT
directory. But, don’t put a leading slash in the relative path. [...]

[Read more →]

Tags:

Django Tip: Outputting list of items separated by commas, but only if it has more than one item

April 24th, 2008 · No Comments · django

How many times do you need to do this? You have a list of things to output. The list can be empty, has one element, or more. You want to separate each items with a separator for readability. What do you do?
1. The simple but not reader friendly way:
toppings = [ 'cheese','tomatos','pineapple' ]
or toppings = [...]

[Read more →]

Tags:

Emacs for OS X Leopard

January 30th, 2008 · No Comments · django, mac, technology

I have been using the text mode emacs up to now. On Windows (yikes!) I uses the xemacs with windows extension, which is pretty nice. Quick googling found me Carbon Emacs. It has been updated, universal binary and Leopard. Highly recommended !

[Read more →]

Tags:

gettext on Leopard for Django Internationalization

January 30th, 2008 · No Comments · django, mac

I started working on one of my internationalized applications on the new Mac. I realized I did not install “gettext”, which is required by the make-messages and compile-messages scripts. I want to avoid installing things into OS X if I can. Then I found the easy way out:
1. Install poedit for os x. I need [...]

[Read more →]

Tags:

Django on Leopard

January 20th, 2008 · No Comments · Uncategorized, django, mac

Part of the reason I was waiting to switch from using Windows XP (gasp) as my Django development platform to OS X is that it is actually easier to install the platform on XP. Windows does not come with any of the tools, so it was a matter of installing the version that I need. [...]

[Read more →]

Tags:

Django 0.96 Internationalization

January 6th, 2008 · No Comments · django

I am trying out Django’s i18n support and found a few issues. This only applies if you are using newforms and Django 0.96.
Order of Middleware
First, the order of the middleware is important. It is defined in the documentation, but I missed it the first time around. You have to put the localeMiddleware after SessionMiddleware:
MIDDLEWARE_CLASSES = [...]

[Read more →]

Tags:

Using pytextile in Django - problem with unicode

October 4th, 2007 · No Comments · django, technology

I am coverting a J2EE application over to django. The existing app uses Textile as a simple markup for user text input. After installing pytextile (which is under ownership change at the moment), I found a problem using it:
The “textile” filter works for strings and strings retrieved from my database, but when I try to [...]

[Read more →]

Tags:

The Importance of the initial argument in Django newforms library

September 19th, 2007 · No Comments · django

I like Django a lot. In fact I am in the middle of converting a large J2EE application to Django. Sometimes I run into a problem using it, and knowing Django, I know there is a good solution. To find the solution however, sometimes require very careful reading of the documentation.
Case in point. The solution [...]

[Read more →]

Tags: