From 57772e71e668213d7edf4aff99755264efb27bb4 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Mon, 10 Oct 2011 16:34:39 +0000 Subject: [PATCH] Changes to allow all reports to run from Django-based backend svn: r18281 --- src/web/dbdjango.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/web/dbdjango.py b/src/web/dbdjango.py index 87b065427..f94ff4685 100644 --- a/src/web/dbdjango.py +++ b/src/web/dbdjango.py @@ -166,6 +166,15 @@ class DbDjango(DbWriteBase, DbReadBase): obj.unserialize(self.dji.get_family(self.dji.Family.get(handle=handle))) return obj + def get_family_from_gramps_id(self, gramps_id): + obj = gen.lib.Family() + try: + family = self.dji.Family.get(gramps_id=gramps_id) + except: + return None + obj.unserialize(self.dji.get_family(family)) + return obj + def get_person_from_handle(self, handle): try: person = self.dji.Person.select_related().get(handle=handle) @@ -203,19 +212,32 @@ class DbDjango(DbWriteBase, DbReadBase): obj.unserialize(self.dji.get_media(self.dji.Media.get(handle=handle))) return obj + def get_media_object_handles(self): + return [media.handle for media in self.dji.Media.all()] + def get_person_handles(self, sort_handles=False): return [person.handle for person in self.dji.Person.all()] def get_default_person(self): return None + def iter_people(self): + return (self.get_person_from_handle(person.handle) + for person in self.dji.Person.all()) + def iter_person_handles(self): return (person.handle for person in self.dji.Person.all()) + def get_tag_handles(self, sort_handles=False): + return [] + def iter_families(self): return (self.get_family_from_handle(family.handle) for family in self.dji.Family.all()) + def iter_family_handles(self): + return (family.handle for family in self.dji.Family.all()) + def get_person_from_gramps_id(self, gramps_id): obj = gen.lib.Person() match_list = self.dji.Person.filter(gramps_id=gramps_id)