Beispiel #1
0
    def post(self):
        args = item_parser().parse_args()

        item = Item(name=args.name, tracking_number=args.tracking_number, description=args.description, owner_id=owner_id)

        # Put in a last action that the item is checked in at the closest occuring event
        closest_event = closest_event_query().first_or_404()
        item.last_action = Action(item=item, status=STATUS_CHECK_IN, person=current_user.person, event=closest_event)

        db.session.add(item)
        db.session.commit()

        return item