def post(self):
        args = assistance_parser.parse_args()
        event = Event.query.get_by_tag(args.event)
        if not event.hasAvailability():
            api.abort(400, "The event haven't availability")

        newAssistance = Assistance(
            eventTag = args.event,
            event = event.getAppearanceAssistance(),
            user = currentUser().username,
            requirements = map(lambda req: Requirement(name=req["name"],quantity=req["quantity"]), args.requirements)
        )
        newAssistance.save()
        mailService.assistance(newAssistance, currentUser())
        log.info("Crea una Asistencia con: {'evento':'%s'}" % newAssistance.event)
        return newAssistance, 201    
    def post(self):
        args = assistance_parser.parse_args()
        event = Event.query.get_by_tag(args.event)
        if not event.hasAvailability():
            api.abort(400, "The event haven't availability")

        newAssistance = Assistance(
            eventTag=args.event,
            event=event.getAppearanceAssistance(),
            user=currentUser().username,
            requirements=map(
                lambda req: Requirement(name=req["name"],
                                        quantity=req["quantity"]),
                args.requirements))
        newAssistance.save()
        mailService.assistance(newAssistance, currentUser())
        log.info("Crea una Asistencia con: {'evento':'%s'}" %
                 newAssistance.event)
        return newAssistance, 201
 def delete(self):
     args = assistance_parser.parse_args()
     assistance = Assistance.query.get_by_eventTag_and_user(
         args.event, currentUser())
     assistance.remove()
     return '', 204
 def delete(self):
     args = assistance_parser.parse_args()
     assistance = Assistance.query.get_by_eventTag_and_user(args.event, currentUser())
     assistance.remove()
     return '', 204