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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ services:
volumes: volumes:
- ${PORTAINER_GIT_DIR}:/code - ${PORTAINER_GIT_DIR}:/code
# - ${PORTAINER_GIT_DIR}/docker/prod/uwsgi.ini:/conf/uwsgi.ini # - ${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 - ${APP_DATABASE_FILE}:/code/db.sqlite3
#ports: #ports:
# - "8000:8000" # uwsgi socket # - "8000:8000" # uwsgi socket