Was not rebuilding cache when adding a references to an object

svn: r20019
This commit is contained in:
Doug Blank 2012-07-17 13:39:10 +00:00
parent 6d39969056
commit e98c78e136
9 changed files with 14 additions and 2 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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)))

View File

@ -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:

View File

@ -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:

View File

@ -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: