Removed server from stash
authorMikko Värri <vmj@linuxbox.fi>
Mon, 20 Sep 2010 23:46:22 +0000 (02:46 +0300)
committerMikko Värri <vmj@linuxbox.fi>
Mon, 20 Sep 2010 23:46:22 +0000 (02:46 +0300)
recycloid_api/templates/recycloid_api/response.json
recycloid_api/templates/recycloid_api/response.xml
recycloid_api/views.py

index 000ef25..883b6c2 100644 (file)
@@ -70,7 +70,6 @@
                         "self": { "@href": "{% url recycloid-api-stash stash.uuid %}" },
                         "items": { "@href": "{% url recycloid-api-stash stash.uuid %}items/" },
                         "owner": { "@href": "{% url recycloid-api-owner stash.owner.uuid %}" },
-                        "server": { "@href": "{% url recycloid-api-server stash.server.uuid %}" }
                     }
                 },
 {% endfor %}
index 177269f..4c30a91 100644 (file)
@@ -53,7 +53,6 @@
                 <self href="{% url recycloid-api-stash stash.uuid %}" />
                 <items href="{% url recycloid-api-stash stash.uuid %}items/" />
                 <owner href="{% url recycloid-api-owner stash.owner.uuid %}" />
-                <server href="{% url recycloid-api-server stash.server.uuid %}" />
             </links>
         </stash>
     {% endfor %}
index 6e7a422..caff247 100644 (file)
@@ -166,7 +166,7 @@ def __add_owner_related(owner, reg, context):
 def __add_stash_related(stash, reg, context):
     """
     Adds stash related objects to the context.  I.e. the stash owner
-    (and those related to that owner) and the stash server.
+    (and those related to that owner).
 
     :param stash: recycloid_models.models.Stash instance
     :param reg: dict where to register which objects have been added to context
@@ -174,7 +174,6 @@ def __add_stash_related(stash, reg, context):
     :return: None
     """
     __add_owner_related(stash.owner, reg, context)
-    __add(stash.server, 'servers', reg, context)
     __add(stash.owner, 'owners', reg, context)
     return
 
@@ -310,7 +309,7 @@ def stashes(request, server=None, owner=None, stash=None):
         stashes = stashes.filter(owner__uuid__exact=owner)
 
     if server:
-        stashes = stashes.filter(server__uuid__exact=server)
+        stashes = stashes.filter(owner__server__uuid__exact=server)
 
     return __object_list_response(request, stashes, 'stashes', __add_stash_related)
 
@@ -338,7 +337,7 @@ def items(request, server=None, owner=None, stash=None, item=None):
         items = items.filter(stash__owner__uuid=owner)
 
     if server:
-        items = items.filter(stash__server__uuid=server)
+        items = items.filter(stash__owner__server__uuid=server)
 
     return __object_list_response(request, items, 'items', __add_item_related)