Testing backreference links on Ref items

svn: r19729
This commit is contained in:
Doug Blank 2012-05-31 17:13:35 +00:00
parent 982fa97fb3
commit fab55acff2
2 changed files with 4 additions and 1 deletions

View File

@ -30,6 +30,7 @@
</form> </form>
{% if user.is_superuser %} {% if user.is_superuser %}
{% make_button "Go to reference" url %} {% make_button "Go to reference" url %}
{% make_button "Go back" referenced_by %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -716,7 +716,7 @@ def process_reference(request, ref_by, handle, ref_to, order):
referenced_by = ref_by_class.objects.get(handle=handle) referenced_by = ref_by_class.objects.get(handle=handle)
object_type = ContentType.objects.get_for_model(referenced_by) object_type = ContentType.objects.get_for_model(referenced_by)
ref_to_class = dji.get_model("%sRef" % ref_to.title()) ref_to_class = dji.get_model("%sRef" % ref_to.title())
exclude = ["last_changed_by", "last_changed", "object_type", "object_id", "order", "ref_object"] exclude = ["last_changed_by", "last_changed", "object_type", "object_id", "ref_object"]
if order == "new": if order == "new":
referenced_to = ref_to_class.objects.filter(object_id=referenced_by.id, referenced_to = ref_to_class.objects.filter(object_id=referenced_by.id,
object_type=object_type, object_type=object_type,
@ -736,5 +736,7 @@ def process_reference(request, ref_by, handle, ref_to, order):
context["handle"] = referenced_by.handle context["handle"] = referenced_by.handle
context["url"] = "/%s/%s" % (referenced_to[0].ref_object.__class__.__name__.lower(), context["url"] = "/%s/%s" % (referenced_to[0].ref_object.__class__.__name__.lower(),
referenced_to[0].ref_object.handle) referenced_to[0].ref_object.handle)
context["referenced_by"] = "/%s/%s" % (referenced_by.__class__.__name__.lower(),
referenced_by.handle)
context["action"] = "view" context["action"] = "view"
return render_to_response("reference.html", context) return render_to_response("reference.html", context)