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
This commit is contained in:
Doug Blank 2015-06-17 11:29:38 -04:00
parent 87983a0aa7
commit 933baf8d2e
2 changed files with 8 additions and 2 deletions

View File

@ -63,7 +63,7 @@
<tr><td id="rowspace"></td></tr> <tr><td id="rowspace"></td></tr>
<tr> <tr>
<td class="ColumnAttribute">{{personform.gender_type.label}}:</td> <td class="ColumnAttribute">{{personform.gender_type.label}}:</td>
<td class="ColumnValue" id="data">{% render personform.gender_type user action None "/person/?search=gender%%3D%s" "personform.model.gender_type" %}</td> <td class="ColumnValue" id="data">{% render personform.gender_type user action None "/person/?search=gender%%3D%s" personform.model.gender_type_id %}</td>
<td class="ColumnAttribute">{{personform.gramps_id.label}}:</td> <td class="ColumnAttribute">{{personform.gramps_id.label}}:</td>
<td class="ColumnValue" id="data">{% render personform.gramps_id user action %}</td> <td class="ColumnValue" id="data">{% render personform.gramps_id user action %}</td>
<td class="ColumnAttribute">{{personform.tags.label}}:</td> <td class="ColumnAttribute">{{personform.tags.label}}:</td>

View File

@ -451,7 +451,10 @@ class Tag(models.Model):
models.Model.save(self) models.Model.save(self)
def save(self, *args, **kwargs): 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() self.cache = self.make_cache()
models.Model.save(self, *args, **kwargs) # save to db models.Model.save(self, *args, **kwargs) # save to db
@ -484,6 +487,7 @@ class PrimaryObject(models.Model):
cache = models.TextField(blank=True, null=True) cache = models.TextField(blank=True, null=True)
tags = models.ManyToManyField('Tag', blank=True, null=True) tags = models.ManyToManyField('Tag', blank=True, null=True)
dji = None dji = None
save_cache_q = False
def __str__(self): def __str__(self):
return "%s: %s" % (self.__class__.__name__, return "%s: %s" % (self.__class__.__name__,
@ -535,6 +539,8 @@ class PrimaryObject(models.Model):
models.Model.save(self) models.Model.save(self)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if "save_cache" in kwargs:
self.save_cache_q = kwargs.pop("save_cache")
if self.save_cache_q: if self.save_cache_q:
self.cache = self.make_cache() self.cache = self.make_cache()
models.Model.save(self, *args, **kwargs) # save to db models.Model.save(self, *args, **kwargs) # save to db