Move away from fixtures in favor of src/initial_setup.py, which makes it a little easier to change stuff like this. It also avoids over-writing stuff when syncdb is ran. This commit features database layout changes to ConnectScreen and CommChannel. It is recommended that you drop your database and re-sync. If this is not acceptable, talk to me about a migration plan. We will be investigating schema evolution down the road.

This commit is contained in:
Greg Taylor 2009-01-18 04:22:58 +00:00
parent c0ebbc3967
commit f6ee697e04
8 changed files with 119 additions and 38 deletions

View file

@ -1,7 +1,6 @@
"""
Custom manager for ConfigValue objects.
"""
from traceback import format_exc
from django.db import models
from src import logger
@ -13,8 +12,9 @@ class ConfigValueManager(models.Manager):
try:
return self.get(conf_key__iexact=configname).conf_value
except self.model.DoesNotExist:
logger.log_errmsg("Unable to get config value for %s (does not exist):\n%s" % (
configname, (format_exc())))
logger.log_errmsg("Unable to get config value for %s (does not exist).\n" % (
configname))
raise
def set_configvalue(self, configname, newvalue):
"""
@ -29,4 +29,5 @@ class ConfigValueManager(models.Manager):
return newvalue
except self.model.DoesNotExist:
logger.log_errmsg("Unable to set config value for %s (does not exist):\n%s" % (
configname, (format_exc())))
configname))
raise

View file

@ -12,6 +12,7 @@ class ConnectScreenManager(models.Manager):
return self.filter(is_active=True).order_by('?')[0]
except IndexError:
new_screen = ConnectScreen(name='Default',
connect_screen_text='This is a placeholder connect screen. Remind your admin to edit it through the Admin interface.')
text='This is a placeholder connect screen. Remind your admin to edit it through the Admin interface.',
is_active=True)
new_screen.save()
return new_screen