change 'managed' default setting
This commit is contained in:
parent
32d842b9ba
commit
3e14d17ce5
|
@ -42,7 +42,7 @@ class RattailRouter(object):
|
|||
|
||||
def __init__(self):
|
||||
self.db_alias = getattr(settings, 'RATTAIL_DATABASE_ALIAS', 'rattail')
|
||||
# self.managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', False))
|
||||
self.managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', False))
|
||||
|
||||
def db_for_read(self, model, **hints):
|
||||
if model._meta.app_label == 'rattail':
|
||||
|
@ -52,6 +52,6 @@ class RattailRouter(object):
|
|||
if model._meta.app_label == 'rattail':
|
||||
return self.db_alias
|
||||
|
||||
# def allow_syncdb(self, db, model):
|
||||
# if model._meta.app_label == 'rattail':
|
||||
# return self.managed
|
||||
def allow_syncdb(self, db, model):
|
||||
if model._meta.app_label == 'rattail':
|
||||
return self.managed
|
||||
|
|
|
@ -43,7 +43,7 @@ class Model(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
app_label = 'rattail'
|
||||
managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', False))
|
||||
managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', True))
|
||||
|
||||
@classmethod
|
||||
def prefix(cls, table_name):
|
||||
|
@ -55,9 +55,9 @@ class Model(models.Model):
|
|||
database, or an externally-managed one.
|
||||
"""
|
||||
|
||||
managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', False))
|
||||
managed = bool(getattr(settings, 'RATTAIL_DJANGO_MANAGED', True))
|
||||
if managed:
|
||||
return 'rattail_' + table_name
|
||||
table_name = 'rattail_' + table_name
|
||||
return table_name
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue