From 933baf8d2e550edff5a53af02fb7307f04e8089d Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Wed, 17 Jun 2015 11:29:38 -0400 Subject: [PATCH] WIP webapp: largley working again 1. Changed personform.model.gender_type to personform.model.gender_type_id (no idea why this was needed) 2. Take care of cache default, and Tag save --- data/templates/view_person_detail.html | 2 +- gramps/webapp/grampsdb/models.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/templates/view_person_detail.html b/data/templates/view_person_detail.html index 6c28f5227..48ccb7df5 100644 --- a/data/templates/view_person_detail.html +++ b/data/templates/view_person_detail.html @@ -63,7 +63,7 @@ {{personform.gender_type.label}}: - {% render personform.gender_type user action None "/person/?search=gender%%3D%s" "personform.model.gender_type" %} + {% render personform.gender_type user action None "/person/?search=gender%%3D%s" personform.model.gender_type_id %} {{personform.gramps_id.label}}: {% render personform.gramps_id user action %} {{personform.tags.label}}: diff --git a/gramps/webapp/grampsdb/models.py b/gramps/webapp/grampsdb/models.py index d870ca5bd..3d45b84fd 100644 --- a/gramps/webapp/grampsdb/models.py +++ b/gramps/webapp/grampsdb/models.py @@ -451,7 +451,10 @@ class Tag(models.Model): models.Model.save(self) def save(self, *args, **kwargs): - if self.save_cache_q: + if "save_cache" in kwargs: + self.save_cache_q = kwargs.pop("save_cache") + if hasattr(self, "save_cache_q") and self.save_cache_q: + # Tag doesn't have a cache self.cache = self.make_cache() models.Model.save(self, *args, **kwargs) # save to db @@ -484,6 +487,7 @@ class PrimaryObject(models.Model): cache = models.TextField(blank=True, null=True) tags = models.ManyToManyField('Tag', blank=True, null=True) dji = None + save_cache_q = False def __str__(self): return "%s: %s" % (self.__class__.__name__, @@ -535,6 +539,8 @@ class PrimaryObject(models.Model): models.Model.save(self) def save(self, *args, **kwargs): + if "save_cache" in kwargs: + self.save_cache_q = kwargs.pop("save_cache") if self.save_cache_q: self.cache = self.make_cache() models.Model.save(self, *args, **kwargs) # save to db