Add all model fields to callbacks
This commit is contained in:
@@ -29,14 +29,14 @@ class HookAPI(APIView):
|
||||
log.debug(f"HookAPI POST: {request.data}")
|
||||
|
||||
# Try loading the JSON
|
||||
try:
|
||||
loaded_json = orjson.loads(request.data)
|
||||
except orjson.JSONDecodeError:
|
||||
return HttpResponseBadRequest("Invalid JSON")
|
||||
# try:
|
||||
# loaded_json = orjson.loads(request.data)
|
||||
# except orjson.JSONDecodeError:
|
||||
# return HttpResponseBadRequest("Invalid JSON")
|
||||
|
||||
# Try validating the JSON
|
||||
try:
|
||||
hook_resp = drakdoo.BaseDrakdoo.from_dict(loaded_json)
|
||||
hook_resp = drakdoo.BaseDrakdoo.from_dict(request.data)
|
||||
except ValidationError as e:
|
||||
log.error(f"HookAPI POST: {e}")
|
||||
return HttpResponseBadRequest(e)
|
||||
@@ -45,7 +45,6 @@ class HookAPI(APIView):
|
||||
"title": hook_resp.title,
|
||||
"message": hook_resp.message,
|
||||
"period": hook_resp.period,
|
||||
"market": hook_resp.market,
|
||||
"timestamp_sent": hook_resp.timestamp.sent,
|
||||
"timestamp_trade": hook_resp.timestamp.trade,
|
||||
"market_exchange": hook_resp.market.exchange,
|
||||
@@ -87,6 +86,8 @@ class Hooks(LoginRequiredMixin, View):
|
||||
template_name = f"wm/{type}.html"
|
||||
unique = str(uuid.uuid4())[:8]
|
||||
hooks = get_hooks(request.user)
|
||||
if type == "page":
|
||||
type = "modal"
|
||||
context = {
|
||||
"title": f"Hooks ({type})",
|
||||
"unique": unique,
|
||||
|
||||
Reference in New Issue
Block a user