Пример #1
0
 def delete_model(self, model):
     """Delete the person record and checks IN any items checked out by
     them (inserts assoc. logs)
     """
     item_names = []
     flash('Removed %s' % model.name)
     # check in the inventory they had
     logs = InventoryLog.objects(person=model,
                                 status=InventoryItem.CHECKED_OUT)
     for log in logs:
         item = log.item
         # check in items
         InventoryLog.add_log(person=model,
                              item=item,
                              status=InventoryItem.CHECKED_IN,
                              checkout_meta=None,
                              person_name=model.name + ' - DELETED')
         item.status = InventoryItem.CHECKED_IN
         item.save()
         item_names.append(item.name)
     if item_names:
         flash('> > Checked IN %s' % u', '.join(item_names),
               category='misc')
     return super(PersonAdmin, self).delete_model(model)
Пример #2
0
 def delete_model(self, model):
     """Delete the person record and checks IN any items checked out by
     them (inserts assoc. logs)
     """
     item_names = []
     flash('Removed %s' % model.name)
     # check in the inventory they had
     logs = InventoryLog.objects(person=model, status=InventoryItem.CHECKED_OUT)
     for log in logs:
         item = log.item
         # check in items
         InventoryLog.add_log(
             person=model,
             item=item,
             status=InventoryItem.CHECKED_IN,
             checkout_meta=None,
             person_name=model.name + ' - DELETED'
         )
         item.status = InventoryItem.CHECKED_IN
         item.save()
         item_names.append(item.name)
     if item_names:
         flash('> > Checked IN %s' % u', '.join(item_names), category='misc')
     return super(PersonAdmin, self).delete_model(model)