def get_employees(request): if request.method == 'GET': with connect() as conn: dbemployees = Employees(conn) employees = dbemployees.readall() return JsonResponse(employees, safe=False, encoder=ModelsJSONEncoder, json_dumps_params={'indent': 2}) return HttpResponse(status=400)
def export_employees(request): with connect() as conn: dbemployees = Employees(conn) employees = dbemployees.readall() return export(request, employees, 'employees')