From: Diane Trout Date: Thu, 13 Dec 2012 22:21:52 +0000 (-0800) Subject: Make the inventory pages work with the new HTSChangeList. X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=bb9047d238ba34ed163c96cd8c857c34e85420a7 Make the inventory pages work with the new HTSChangeList. There were a few problems, I was calling get_result_set in the template, which requires the HTTP request which isn't available. I needed to be using result_list instead. I also changed the name in the context and failed to use the right model for one of the indexes. --- diff --git a/htsworkflow/frontend/inventory/views.py b/htsworkflow/frontend/inventory/views.py index 78b73fd..265e1bc 100644 --- a/htsworkflow/frontend/inventory/views.py +++ b/htsworkflow/frontend/inventory/views.py @@ -1,6 +1,6 @@ from htsworkflow.frontend.samples.changelist import HTSChangeList from htsworkflow.frontend.inventory.models import Item, LongTermStorage, ItemType -from htsworkflow.frontend.inventory.admin import ItemAdmin +from htsworkflow.frontend.inventory.admin import ItemAdmin, ItemTypeAdmin from htsworkflow.frontend.inventory.bcmagic import item_search from htsworkflow.frontend.bcmagic.plugin import register_search_plugin from htsworkflow.frontend.experiments.models import FlowCell @@ -162,11 +162,11 @@ def index(request): Inventory Index View """ # build changelist - item_changelist = HTSChangeList(request, Item, - list_filter=['barcode_id', ], - search_fields=[], + item_changelist = HTSChangeList(request, ItemType, + list_filter=[], + search_fields=['name', 'description'], list_per_page=50, - model_admin=ItemAdmin(Item, None) + model_admin=ItemTypeAdmin(ItemType, None) ) context_dict = { @@ -174,7 +174,6 @@ def index(request): 'page_name': 'Inventory Index' } context_dict.update(INVENTORY_CONTEXT_DEFAULTS) - return render_to_response('inventory/inventory_index.html', context_dict, context_instance=RequestContext(request)) diff --git a/htsworkflow/frontend/samples/changelist.py b/htsworkflow/frontend/samples/changelist.py index 9ae8adf..4716305 100644 --- a/htsworkflow/frontend/samples/changelist.py +++ b/htsworkflow/frontend/samples/changelist.py @@ -33,7 +33,6 @@ class HTSChangeList(ChangeList): def get_query_set(self, request): qs = super(HTSChangeList, self).get_query_set(request) - print qs if self.extra_filters: new_qs = qs.filter(**self.extra_filters) if new_qs is not None: diff --git a/htsworkflow/frontend/templates/inventory/inventory_index.html b/htsworkflow/frontend/templates/inventory/inventory_index.html index 2eb84ab..51c6a59 100644 --- a/htsworkflow/frontend/templates/inventory/inventory_index.html +++ b/htsworkflow/frontend/templates/inventory/inventory_index.html @@ -18,7 +18,7 @@ {% block coltype %}flex{% endblock %} {% block content %}
-
+
{% block search %}{% search_form item_changelist %}{% endblock %} {% block pagination %}{% pagination item_changelist %}{% endblock %} @@ -28,13 +28,13 @@

{% trans 'Filter' %}

{% for spec in item_changelist.filter_specs %} - {% admin_list_filter cl spec %} + {% admin_list_filter item_changelist spec %} {% endfor %}
{% endif %} {% endblock %} {% block summary_stats %} - +
@@ -42,7 +42,7 @@ - {% for itemtype in item_changelist.get_query_set %} + {% for itemtype in item_changelist.result_list %} diff --git a/htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html b/htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html index 62ebdce..32975d6 100644 --- a/htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html +++ b/htsworkflow/frontend/templates/inventory/inventory_itemtype_index.html @@ -18,7 +18,7 @@ {% block coltype %}flex{% endblock %} {% block content %}
-
+
{% block search %}{% search_form item_changelist %}{% endblock %} {% block pagination %}{% pagination item_changelist %}{% endblock %} @@ -28,13 +28,13 @@

{% trans 'Filter' %}

{% for spec in item_changelist.filter_specs %} - {% admin_list_filter cl spec %} + {% admin_list_filter item_changelist spec %} {% endfor %}
{% endif %} {% endblock %} {% block summary_stats %} -
Name
{{ itemtype.name }} {{ itemtype.description }}
+
@@ -47,7 +47,7 @@ - {% for item in item_changelist.get_query_set %} + {% for item in item_changelist.result_list %}
UUID
{{ item.uuid }} {{ item.barcode_id }}