Make callbacks go on a new page

This commit is contained in:
Mark Veidemanis 2022-10-15 22:08:13 +01:00
parent 361b7b96f0
commit 541894d927
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 7 additions and 9 deletions

View File

@ -42,11 +42,7 @@
</span>
</span>
</button>
<button
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'callbacks' type='modal' hook_id=item.id %}"
hx-trigger="click"
hx-target="#hooks-table"
<a href="{% url 'callbacks' type='page' hook_id=item.id %}"><button
class="button is-success">
<span class="icon-text">
<span class="icon">
@ -54,6 +50,7 @@
</span>
</span>
</button>
</a>
</div>
</td>
</tr>

View File

@ -13,7 +13,6 @@ def get_callbacks(hook=None, user=None):
callbacks = Callback.objects.filter(hook__user=user)
elif hook:
callbacks = Callback.objects.filter(hook=hook)
print("CALLBACKS", callbacks)
return callbacks

View File

@ -21,8 +21,10 @@ class HookAPI(APIView):
parser_classes = [JSONParser]
def post(self, request, hook_name):
hook = Hook.objects.get(name=hook_name)
print("DATA FREOM POST", request.data)
try:
hook = Hook.objects.get(name=hook_name)
except Hook.DoesNotExist:
return HttpResponseBadRequest("Hook does not exist.")
callback = Callback.objects.create(
hook=hook,
data=request.data,

View File

@ -7,7 +7,7 @@ services:
volumes:
- ${PORTAINER_GIT_DIR}:/code
# - ${PORTAINER_GIT_DIR}/docker/prod/uwsgi.ini:/conf/uwsgi.ini
- ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
# - ${APP_LOCAL_SETTINGS}:/code/app/local_settings.py
- ${APP_DATABASE_FILE}:/code/db.sqlite3
#ports:
# - "8000:8000" # uwsgi socket