def delete(id): transaction = Transaction.get(id) amount = '%.2f' % transaction.amount amount = transaction.amount > 0 and '$'+str(amount) or '-$'+str(amount) recycleId = Recycle.create("Transaction with {0} for {1} deleted".format(transaction.name, amount)) meta.Session.delete(transaction) meta.Session.commit() session.save()
def delete(leaseid): lease = Lease.get(leaseid) #pulse unit = Unit.get_unit(lease.unitid) property_name = Property.get_name_by_id(unit.propertyid) lease_start = lease.startdate.strftime("%B %d, %Y") unit_label = unit.label Pulse.create( unitid = unit.id, propertyid = unit.propertyid, type = 'warning', html = '<div class="unit">Lease starting from {0} for <a href="/unit/view/{1}">{3} #{2}</a>\'s has been deleted.</div>'.format( lease_start, unit.id, unit_label, property_name ) ) recycleId = Recycle.create("Lease starting from {0} deleted from {1} #{2}".format(lease_start, property_name, unit_label)) lease.deleted = recycleId meta.Session.commit() session.save()