django.setup() now required; bringing database up to date

with current gramps (missing db.is_empty())
This commit is contained in:
Doug Blank 2015-05-09 18:07:54 -04:00
parent 0360a5987e
commit 5fde29a34c
3 changed files with 22 additions and 0 deletions

View File

@ -1354,3 +1354,18 @@ class DbDjango(DbWriteBase, DbReadBase):
return self._tables[table_name]["handle_func"](handle)
return None
def is_empty(self):
"""
Is the database empty?
"""
return (self.get_number_of_people() == 0 and
self.get_number_of_events() == 0 and
self.get_number_of_places() == 0 and
self.get_number_of_tags() == 0 and
self.get_number_of_families() == 0 and
self.get_number_of_notes() == 0 and
self.get_number_of_citations() == 0 and
self.get_number_of_sources() == 0 and
self.get_number_of_media_objects() == 0 and
self.get_number_of_repositories() == 0)

View File

@ -167,5 +167,8 @@ LOGIN_URL = "/login/"
LOGOUT_URL = "/logout"
LOGIN_REDIRECT_URL = "/"
## Changes for Django 1.6:
LOGGING = None
## Changes for Django 1.7.1:
ABSOLUTE_URL_OVERRIDES = {}

View File

@ -65,6 +65,10 @@ except RuntimeError:
# already configured; ignore
pass
# For Django 1.6:
import django
django.setup()
from gramps.webapp.grampsdb.models import *
from gramps.webapp.grampsdb.forms import *
from gramps.webapp.dbdjango import DbDjango