simonb.com: blog > articles tagged with django

skip to content
You are here: 

Articles in blog tagged with django

Tuesday, 22 December 2009

Debugging utf-8 Email In Django And Python

In case anyone else is wondering why their utf-8 email is not coming out as it should when using Django...

Non-ascii character sets are a major pain when writing code to send email. They're not impossible by a long way but they do take some digging to figure out why your nicely formated utf-8 Chinese is coming out in garbled characters, tracing code, examing email headers... Oh the joy. So it does not help when your framework of choice (Django) decides it knows that you really want a certain type of text encoding, even if you are writing your own…

read more

Tags: 

   

Thursday, 19 November 2009

Creating Users: an illustration of the differences between PostgreSQL and MySQL

Like many starting out in websites and databases my first experience was with MySQL. I had no choice since the hosting service I used only offered MySQL. This is still the case for a lot of hosting - you get the standard LAMP stack and nothing more. I had read on the web that everyone is using MySQL, so how bad could it be? I was forgetting the maxim that quality and popularity are inversely proportional. BTW: it's not really popularity in this case - it's the most users - think Windoze.

Anyhoo, I struggled through the nightmare that is…

read more

Tags: 

     

Wednesday, 8 July 2009

Django Related And Inherited Name Attribute Clash

Bare with me it's a long story...

When deleting an object I was getting this error from Django:

'RelatedManager' object has no attribute '_collect_sub_objects'

The reason was an attribute name clash on a base class. Finding the reason took some time so here's the low down in case any one else runs in to this.

In one app I had a model Company:

class Company(models.Model):
    name = models.CharField(max_length=1024)

and in another app I had a model AdClient:

class AdClient(models.Model):
    company = models.ForeignKey(Company, related_name='client')

Then some time later I wrote a new app inheriting from Company as:

class Client(Company): name =…

read more

Tags: 

 

Wednesday, 24 June 2009

Thursday, 18 June 2009

Moving From ExpressionEngine To yajogo

When I first set up this site back in 2005 I looked around for a blogging platform and chose ExpressionEngine. After years of bad experience with PHP (it's such a mess) I was relucant to use a platform based on PHP but EE is a good and well thought out system. (BTW EE is about to release version 2.) So there we were.

Always in the back of my mind was: "You know how to do this. Why don't you write your own system?" Well life and business got in the way and I never got around to it.…

read more

Tags: 

   

Friday, 4 January 2008

Django AttributeError: ‘module’ object has no attribute

If you get the error “AttributeError: ‘module’ object has no attribute ‘xyz’” in Django. It probably means you’ve added a new app but forgot to put the __init__.py file in the app’s directory.

read more

Tags: 

 

Thursday, 11 May 2006

Django technical_500_response error

I recently switched from the Django magic-removal branch to the trunk post-magic-removal. I was getting this bizarre error:

Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

File "/sw/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
result = object(req)

File "/Users/simonb/src/dj/trunk/django/core/handlers/modpython.py", line 157, in handler
return ModPythonHandler()(req)

File "/Users/simonb/src/dj/trunk/django/core/handlers/modpython.py", line 129, in __call__
response = self.get_response(req.uri, request)

File "/Users/simonb/src/dj/magic-removal/django/core/handlers/base.py", line 100, in get_response

File "/Users/simonb/src/dj/magic-removal/django/core/handlers/base.py", line 133, in get_technical_error_response

File "/Users/simonb/src/dj/trunk/django/views/debug.py", line 115, in technical_500_response
c = Context({
IndexError: list index out of range

Well, it took me a while to figure out. Notice that the directory name used for the Django distribution…

read more

Tags: 

 

Sunday, 7 May 2006

Sunday, 8 January 2006

Django and Rails Creators Talk Video and Audio

Snakes and Rubies Chicago, 3 Dec. 2005: The creators of Django and Rails each gave talks and discussed web frameworks. Download the video and audio here

read more

Tags: