diff --git a/src/webapp/grampsdb/view/citation.py b/src/webapp/grampsdb/view/citation.py index 579b61d6d..182df3757 100644 --- a/src/webapp/grampsdb/view/citation.py +++ b/src/webapp/grampsdb/view/citation.py @@ -94,6 +94,7 @@ def process_citation(request, context, handle, action, add_to=None): # view, edi model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_citation_ref(obj, citation.handle) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-citations" % (item, handle)) action = "view" else: diff --git a/src/webapp/grampsdb/view/event.py b/src/webapp/grampsdb/view/event.py index 68ce0ee9e..65d9a88f7 100644 --- a/src/webapp/grampsdb/view/event.py +++ b/src/webapp/grampsdb/view/event.py @@ -90,6 +90,7 @@ def process_event(request, context, handle, action, add_to=None): # view, edit, model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_event_ref_default(obj, event) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-events" % (item, handle)) action = "view" else: diff --git a/src/webapp/grampsdb/view/family.py b/src/webapp/grampsdb/view/family.py index d67a5f8dc..414336ac2 100644 --- a/src/webapp/grampsdb/view/family.py +++ b/src/webapp/grampsdb/view/family.py @@ -101,7 +101,7 @@ def process_family(request, context, handle, action, add_to=None): # view, edit, model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_family_ref(obj, family.handle) - # FIXME: cache; move to save methods? what about forms? + dji.rebuild_cache(obj) return redirect("/%s/%s" % (item, handle)) action = "view" else: diff --git a/src/webapp/grampsdb/view/media.py b/src/webapp/grampsdb/view/media.py index dcc852a19..9f6098a8a 100644 --- a/src/webapp/grampsdb/view/media.py +++ b/src/webapp/grampsdb/view/media.py @@ -145,13 +145,15 @@ def process_media(request, context, handle, action, add_to=None): # view, edit, if mediaform.is_valid(): update_last_changed(media, request.user.username) media = mediaform.save() - dji.rebuild_cache(media) if add_to: item, handle = add_to model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_media_ref_default(obj, media) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-gallery" % (item, handle)) + else: + dji.rebuild_cache(media) action = "view" else: action = "add" diff --git a/src/webapp/grampsdb/view/note.py b/src/webapp/grampsdb/view/note.py index 8b0295c94..9633ca9b5 100644 --- a/src/webapp/grampsdb/view/note.py +++ b/src/webapp/grampsdb/view/note.py @@ -97,6 +97,7 @@ def process_note(request, context, handle, action, add_to=None): # view, edit, s model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_note_ref(obj, note) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-notes" % (item, handle)) notetext = noteform.data["notetext"] action = "view" diff --git a/src/webapp/grampsdb/view/person.py b/src/webapp/grampsdb/view/person.py index 66e2b810e..278baaf97 100644 --- a/src/webapp/grampsdb/view/person.py +++ b/src/webapp/grampsdb/view/person.py @@ -167,6 +167,7 @@ def process_surname(request, handle, order, sorder, action="view"): surname = sf.save(commit=False) check_primary(surname, surnames) surname.save() + dji.rebuild_cache(person) return redirect("/person/%s/name/%s/surname/%s%s#tab-surnames" % (person.handle, name.order, sorder, build_search(request))) @@ -181,6 +182,7 @@ def process_surname(request, handle, order, sorder, action="view"): surname = sf.save(commit=False) check_primary(surname, name.surname_set.all().exclude(order=surname.order)) surname.save() + dji.rebuild_cache(person) return redirect("/person/%s/name/%s/surname/%s%s#tab-surnames" % (person.handle, name.order, sorder, build_search(request))) diff --git a/src/webapp/grampsdb/view/place.py b/src/webapp/grampsdb/view/place.py index 920f5c90e..611876c3b 100644 --- a/src/webapp/grampsdb/view/place.py +++ b/src/webapp/grampsdb/view/place.py @@ -81,6 +81,7 @@ def process_place(request, context, handle, action, add_to=None): # view, edit, model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_place_ref(obj, place.handle) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-places" % (item, handle)) action = "view" else: diff --git a/src/webapp/grampsdb/view/repository.py b/src/webapp/grampsdb/view/repository.py index 1b1d36d98..dcab59954 100644 --- a/src/webapp/grampsdb/view/repository.py +++ b/src/webapp/grampsdb/view/repository.py @@ -81,6 +81,7 @@ def process_repository(request, context, handle, action, add_to=None): # view, e model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_repository_ref(obj, repository) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-repositories" % (item, handle)) action = "view" else: diff --git a/src/webapp/grampsdb/view/tag.py b/src/webapp/grampsdb/view/tag.py index 87565413c..9d7db1c23 100644 --- a/src/webapp/grampsdb/view/tag.py +++ b/src/webapp/grampsdb/view/tag.py @@ -64,6 +64,7 @@ def process_tag(request, context, handle, action, add_to=None): # view, edit, sa if tagform.is_valid(): update_last_changed(tag, request.user.username) tag = tagform.save() + dji.rebuild_cache(tag) action = "view" else: action = "edit" @@ -74,11 +75,13 @@ def process_tag(request, context, handle, action, add_to=None): # view, edit, sa if tagform.is_valid(): update_last_changed(tag, request.user.username) tag = tagform.save() + dji.rebuild_cache(tag) if add_to: item, handle = add_to model = dji.get_model(item) obj = model.objects.get(handle=handle) dji.add_tag_ref_default(obj, tag) + dji.rebuild_cache(obj) return redirect("/%s/%s#tab-tags" % (item, handle)) action = "view" else: