'Delete function logic, override to implement different logic
deletes the record with primary_key = pk
:param pk:
record primary key to delete'

def _delete(self, pk):

    item = self.datamodel.get(pk, self._base_filters)
    if (not item):
        abort(404)
    try:
        self.pre_delete(item)
    except Exception as e:
        flash(str(e), 'danger')
    else:
        if self.datamodel.delete(item):
            self.post_delete(item)
        flash(*self.datamodel.message)
        self.update_redirect()
