Posts Tagged ‘django’

MySQL’s “Warning: Field ‘id’ doesn’t have a default value”

Tuesday, January 31st, 2012

The following error came up on a project built on Django and MySQL:
“Warning: Field ‘id’ doesn’t have a default value”

At first, it seemed as though Django was responsible. However, a quick Google search proved this was an issue with MySQL.

Some solutions returned by the search required the programmer/administrator to export and recreate the database, but the solution proved a lot more simple. For a table named auth_user, the following MySQL command fixes the above error message:

ALTER TABLE auth_user MODIFY `id` INT(11) NOT NULL AUTO_INCREMENT;

The above command resets the ID field of the auth_user table to an auto-incremented integer of length 11, fixing the error message for good.

Extending the Django User model

Wednesday, May 5th, 2010

There appears to be 3 ways to extend the functionality of the Django User model:

  • Through sub-classing
  • With a profile class
  • By monkey-patching

(more…)

A case for Test Driven Development

Thursday, March 25th, 2010

I will be honest: TDD is hard. It’s hard to get into, it’s hard to keep up. It’s all too easy to revert to a time when programming was about creativity, experimentation and the gratifying feeling of printing ‘Hello, world!’.

(more…)