def delete(request, slug): coming_url = request.META.get("HTTP_REFERER") try: hlp.delete_object(Other, slug=slug) messages.success(request, custom_messages.DELETE_SUCCESS) except Exception as e: messages.error(request, custom_messages.DELETE_ERROR) return redirect(coming_url)
def delete_employee(request, slug): coming_url = request.META.get("HTTP_REFERER") try: hlp.delete_object(Employee, slug=slug) messages.success(request, custom_messages.DELETE_SUCCESS) except Exception as e: messages.error(request, custom_messages.DELETE_ERROR) return redirect('/office/employee_list')
def partnership_delete(request, id): coming_url = request.META.get("HTTP_REFERER") try: hlp.delete_object(Partnership, id=id) messages.success(request, custom_messages.DELETE_SUCCESS) except Exception as e: messages.error(request, custom_messages.DELETE_ERROR) return redirect(coming_url)
def delete(request, slug): instance = Expense.objects.get(slug=slug) try: hlp.delete_object(Expense, slug=slug) messages.success(request, custom_messages.DELETE_SUCCESS) if instance.office is not None: return redirect('/office/expense_list') elif instance.tax is not None: return redirect('/tax/expense_list') elif instance.other is not None: return redirect('/other/expense_list') except Exception as e: messages.error(request, custom_messages.DELETE_ERROR) return redirect('/case/expense_list')