def template_assign_remove_suppliers(request, object_id): obj = get_object_or_404(ItemTemplate, pk=object_id) return generic_assign_remove( request, title=_(u'Assign suppliers to the template: <a href="%(url)s">%(obj)s</a>' % {'url': obj.get_absolute_url(), 'obj': obj}), obj=obj, left_list_qryset=Supplier.objects.exclude(itemtemplate=obj), right_list_qryset=obj.suppliers.all(), add_method=obj.suppliers.add, remove_method=obj.suppliers.remove, left_list_title=_(u'Unassigned suppliers'), right_list_title=_(u'Assigned suppliers'), item_name=_(u"suppliers"))
def template_assign_remove_suppliers(request, object_id): obj = get_object_or_404(ItemTemplate, pk=object_id) return generic_assign_remove( request, title=_(u'Assign suppliers to the template: <a href="%(url)s">%(obj)s</a>' % {'url':obj.get_absolute_url(), 'obj':obj}), obj=obj, left_list_qryset=Supplier.objects.exclude(itemtemplate=obj), right_list_qryset=obj.suppliers.all(), add_method=obj.suppliers.add, remove_method=obj.suppliers.remove, left_list_title=_(u'Unassigned suppliers'), right_list_title=_(u'Assigned suppliers'), item_name=_(u"suppliers"))
def supplier_assign_remove_itemtemplates(request, object_id): obj = get_object_or_404(Supplier, pk=object_id) return generic_assign_remove( request, title=_(u'Assign templates to the supplier: <a href="%(url)s">%(obj)s</a>' % {'url': obj.get_absolute_url(), 'obj': obj}), obj=obj, left_list_qryset=ItemTemplate.objects.exclude(suppliers=obj), right_list_qryset=obj.itemtemplate_set.all(), add_method=obj.itemtemplate_set.add, remove_method=obj.itemtemplate_set.remove, left_list_title=_(u'Unassigned templates'), right_list_title=_(u'Assigned templates'), item_name=_(u"templates"), )
def supplier_assign_remove_itemtemplates(request, object_id): obj = get_object_or_404(Supplier, pk=object_id) return generic_assign_remove( request, title=_(u'Assign templates to the supplier: <a href="%(url)s">%(obj)s</a>' % {'url':obj.get_absolute_url(), 'obj':obj}), obj=obj, left_list_qryset=ItemTemplate.objects.exclude(suppliers=obj), right_list_qryset=obj.itemtemplate_set.all(), add_method=obj.itemtemplate_set.add, remove_method=obj.itemtemplate_set.remove, left_list_title=_(u'Unassigned templates'), right_list_title=_(u'Assigned templates'), item_name=_(u"templates"), )
def group_assign_remove_item(request, object_id): obj = get_object_or_404(ItemGroup, pk=object_id) return generic_assign_remove( request, title=_(u'Assign assets to the group: <a href="%(url)s">%(obj)s</a>' % {'url': obj.get_absolute_url(), 'obj': obj}), obj=obj, left_list_qryset=Item.objects.exclude(itemgroup=obj), right_list_qryset=obj.items.all(), add_method=obj.items.add, remove_method=obj.items.remove, left_list_title=_(u'Unassigned assets'), right_list_title=_(u'Assigned assets'), item_name=_(u'Assets'), list_filter=[location_filter])
def item_assign_remove_person(request, object_id): obj = get_object_or_404(Item, pk=object_id) return generic_assign_remove( request, title=_(u'Assign people to the asset: <a href="%(url)s">%(obj)s</a>' % {'url': obj.get_absolute_url(), 'obj': obj}), obj=obj, left_list_qryset=obj.get_nonowners(), right_list_qryset=obj.get_owners(), add_method=obj.add_owner, remove_method=obj.remove_owner, left_list_title=_(u'People that don\'t have this asset'), right_list_title=_(u'People that have this asset'), item_name=_(u'people'), list_filter=[location_filter])
def person_assign_remove_item(request, object_id): person = get_object_or_404(Person, pk=object_id) return generic_assign_remove( request, title=_(u'Assign assets to the person: <a href="%(url)s">%(obj)s</a>' % {'url': person.get_absolute_url(), 'obj': person}), obj=person, left_list_qryset=Item.objects.exclude(person=object_id), right_list_qryset=person.inventory.all(), add_method=person.inventory.add, remove_method=person.inventory.remove, left_list_title=_(u'Unassigned assets'), right_list_title=_(u'Assigned assets'), item_name=_(u'assets'), list_filter=[location_filter] )
def group_assign_remove_item(request, object_id): obj = get_object_or_404(ItemGroup, pk=object_id) return generic_assign_remove( request, title=_(u'Assign assets to the group: <a href="%(url)s">%(obj)s</a>' % { 'url': obj.get_absolute_url(), 'obj': obj }), obj=obj, left_list_qryset=Item.objects.exclude(itemgroup=obj), right_list_qryset=obj.items.all(), add_method=obj.items.add, remove_method=obj.items.remove, left_list_title=_(u'Unassigned assets'), right_list_title=_(u'Assigned assets'), item_name=_(u'Assets'), list_filter=[location_filter])
def item_assign_remove_person(request, object_id): obj = get_object_or_404(Item, pk=object_id) return generic_assign_remove( request, title=_(u'Assign people to the asset: <a href="%(url)s">%(obj)s</a>' % { 'url': obj.get_absolute_url(), 'obj': obj }), obj=obj, left_list_qryset=obj.get_nonowners(), right_list_qryset=obj.get_owners(), add_method=obj.add_owner, remove_method=obj.remove_owner, left_list_title=_(u'People that don\'t have this asset'), right_list_title=_(u'People that have this asset'), item_name=_(u'people'), list_filter=[location_filter])
def person_assign_remove_item(request, object_id): person = get_object_or_404(Person, pk=object_id) return generic_assign_remove( request, title=_(u'Assign assets to the person: <a href="%(url)s">%(obj)s</a>' % { 'url': person.get_absolute_url(), 'obj': person }), obj=person, left_list_qryset=Item.objects.exclude(person=object_id), right_list_qryset=person.inventory.all(), add_method=person.inventory.add, remove_method=person.inventory.remove, left_list_title=_(u'Unassigned assets'), right_list_title=_(u'Assigned assets'), item_name=_(u'assets'), list_filter=[location_filter])