Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 4fa2dc39c0c9ac19eee493a33e2de62aaf5eb183 1 parent 0336702
friedelwolff authored May 22, 2012

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  local_apps/pootle_misc/dbupdate.py
6  local_apps/pootle_misc/dbupdate.py
@@ -210,16 +210,18 @@ def update_tables_22000():
210 210
     logging.info("Updating existing database tables")
211 211
     from south.db import db
212 212
 
  213
+    # For the sake of South bug 313, we set the default for these fields here:
  214
+    # See http://south.aeracode.org/ticket/313
213 215
     from pootle_store.models import Suggestion
214 216
     table_name = Suggestion._meta.db_table
215 217
     field = Suggestion._meta.get_field('translator_comment_f')
216  
-    field.null = True
  218
+    field.default = u''
217 219
     db.add_column(table_name, field.name, field)
218 220
 
219 221
     from pootle_language.models import Language
220 222
     table_name = Language._meta.db_table
221 223
     field = Language._meta.get_field('description')
222  
-    field.null = True
  224
+    field.default = u''
223 225
     db.add_column(table_name, field.name, field)
224 226
 
225 227
     save_pootle_version(22000)

0 notes on commit 4fa2dc3

Please sign in to comment.
Something went wrong with that request. Please try again.