Implement CRUD for accounts and trades

This commit is contained in:
2022-10-17 18:56:16 +01:00
parent 7779cb8d0e
commit 2bafdf0910
18 changed files with 802 additions and 12 deletions

View File

@@ -8,11 +8,11 @@ from django.views import View
from core.models import Callback, Hook
def get_callbacks(hook=None, user=None):
if user:
def get_callbacks(user, hook=None):
if hook:
callbacks = Callback.objects.filter(hook=hook, hook__user=user)
else:
callbacks = Callback.objects.filter(hook__user=user)
elif hook:
callbacks = Callback.objects.filter(hook=hook)
return callbacks
@@ -38,9 +38,9 @@ class Callbacks(LoginRequiredMixin, View):
"type": type,
}
return render(request, template_name, context)
callbacks = get_callbacks(hook)
callbacks = get_callbacks(request.user, hook)
else:
callbacks = get_callbacks(user=request.user)
callbacks = get_callbacks(request.user)
if type == "page":
type = "modal"