Permalink
Browse files

Set default value for description fields.

With field.null set, non-existing descriptions (all of them
after the upgrade) render as 'None' in the HTML. On SQLite,
South is anable to add the new column correctly with
field.empty, but setting the default like this works.
  • Loading branch information...
1 parent 0336702 commit 4fa2dc39c0c9ac19eee493a33e2de62aaf5eb183 @friedelwolff friedelwolff committed May 22, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 local_apps/pootle_misc/dbupdate.py
@@ -210,16 +210,18 @@ def update_tables_22000():
logging.info("Updating existing database tables")
from south.db import db
+ # For the sake of South bug 313, we set the default for these fields here:
+ # See http://south.aeracode.org/ticket/313
from pootle_store.models import Suggestion
table_name = Suggestion._meta.db_table
field = Suggestion._meta.get_field('translator_comment_f')
- field.null = True
+ field.default = u''
db.add_column(table_name, field.name, field)
from pootle_language.models import Language
table_name = Language._meta.db_table
field = Language._meta.get_field('description')
- field.null = True
+ field.default = u''
db.add_column(table_name, field.name, field)
save_pootle_version(22000)

0 comments on commit 4fa2dc3

Please sign in to comment.