API Reference

This document describes the available API endpoints in PuzzleSpring.

Hunt Views

hunt_info

Description: No description available.

URL Patterns:

  • hunt/<hunt:hunt>/info/

Parameters:

  • hunt: any

hunt_leaderboard

Description: No description available.

URL Patterns:

  • hunt/<hunt:hunt>/leaderboard/

Parameters:

  • hunt: any

hunt_prepuzzle

Description: A simple view that locates the correct prepuzzle for a hunt and redirects there if it exists.

URL Patterns:

  • hunt/<hunt:hunt>/prepuzzle/

Parameters:

  • hunt: any

hunt_updates

Description: No description available.

URL Patterns:

  • hunt/<hunt:hunt>/updates/

Parameters:

  • hunt: any

hunt_view

Description: The main view to render hunt templates. Does various permission checks to determine the set of puzzles to display and then renders the string in the hunt’s “template” field to HTML.

URL Patterns:

  • hunt/<hunt:hunt>/view/

Parameters:

  • hunt: any

prepuzzle_check

Description: No description available.

URL Patterns:

  • prepuzzle/<int:pk>/check/

Parameters:

  • pk: any

prepuzzle_submit

Description: No description available.

URL Patterns:

  • prepuzzle/<int:pk>/submit/

Parameters:

  • pk: any

prepuzzle_view

Description: No description available.

URL Patterns:

  • prepuzzle/<int:pk>/view/

Parameters:

  • pk: any

protected_static

Description: A view to serve protected static content. If the permission check passes, the file is served via X-Sendfile.

URL Patterns:

  • hunt/<str:pk>/view/<path:file_path>
  • protected/<str:base>/<str:pk>/<path:file_path>
  • protected/trusted/<str:base>/<str:pk>/<path:file_path>
  • puzzle/<str:pk>/solution/<path:file_path>
  • puzzle/<str:pk>/view/<path:file_path>

Parameters:

  • pk: any
  • file_path: any
  • base: any
  • add_prefix: any

puzzle_hints_submit

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/hints/submit/

Parameters:

  • pk: any

puzzle_hints_use_canned

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/hints/canned/

Parameters:

  • pk: any

puzzle_hints_view

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/hints/view/

Parameters:

  • pk: any

puzzle_solution

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/solution/

Parameters:

  • pk: any

puzzle_submit

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/submit/

Parameters:

  • pk: any

puzzle_view

Description: No description available.

URL Patterns:

  • puzzle/<str:pk>/view/

Parameters:

  • pk: any

Info Views

archive

Description: A view to render the list of previous hunts, will show any hunt that is ‘public’

URL Patterns:

  • archive/

index

Description: Main landing page view, mostly static except for hunt info

URL Patterns:

  • ``

notification_delete

Description: No description available.

URL Patterns:

  • notifications/<int:pk>/delete/

Parameters:

  • pk: any

notification_toggle

Description: No description available.

URL Patterns:

  • notifications/<int:pk>/toggle/

Parameters:

  • pk: any

notification_view

Description: No description available.

URL Patterns:

  • notifications/

team_create

Description: The view that handles team registration. Mostly deals with creating the team object from the post request.

URL Patterns:

  • team/create/

team_join

Description: No description available.

URL Patterns:

  • team/<str:pk>/join/
  • team/join/

Parameters:

  • pk: any

team_leave

Description: No description available.

URL Patterns:

  • team/<str:pk>/leave/

Parameters:

  • pk: any

team_update

Description: No description available.

URL Patterns:

  • team/<str:pk>/update/

Parameters:

  • pk: any

team_view

Description: No description available.

URL Patterns:

  • team/<str:pk>/view/

Parameters:

  • pk: any

user_detail_view

Description: No description available.

URL Patterns:

  • user/detail

Staff Views

charts

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/charts/

Parameters:

  • hunt: any

export_hunt

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/export/

Parameters:

  • hunt: any

feed

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/feed/

Parameters:

  • hunt: any

file_delete

Description: Delete a file.

This view function deletes a specified file by its primary key (pk).

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the file to be deleted.

URL Patterns:

  • staff/<str:parent_type>/file/<str:pk>/delete/

Parameters:

  • parent_type: any
  • pk: any

file_delete_all

Description: Delete all files of a certain type for a parent object.

This view function deletes all files of a specified parent_type type for a parent object.

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the parent object whose files are to be deleted.

URL Patterns:

  • staff/<str:parent_type>/<str:pk>/files/delete_all/

Parameters:

  • parent_type: any
  • pk: any

file_download

Description: Download a file.

This view function allows a staff member to download a specified file by its primary key (pk).

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the file to be downloaded.

URL Patterns:

  • staff/<str:parent_type>/file/<str:pk>/download/

Parameters:

  • parent_type: any
  • pk: any

file_replace

Description: Replace a file with a new upload.

This view function replaces a specified file with a new uploaded file.

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the file to be replaced.

URL Patterns:

  • staff/<str:parent_type>/file/<str:pk>/replace/

Parameters:

  • parent_type: any
  • pk: any

file_set_main

Description: Set a file as the main file for its parent object.

This view function sets a specified file as the main file for its parent object. The type of main file is determined by the parent_type parameter.

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the file to be set as main.

URL Patterns:

  • staff/<str:parent_type>/file/<str:pk>/set_main/

Parameters:

  • parent_type: any
  • pk: any

file_upload

Description: Upload a new file.

This view function uploads a new file and associates it with a parent object.

Args: parent_type (str): The type of the parent (e.g., ‘solution’, ‘hunt’). pk (int): The primary key of the parent object to which the file will be associated.

URL Patterns:

  • staff/<str:parent_type>/<str:pk>/files/upload/

Parameters:

  • parent_type: any
  • pk: any

get_modal

Description: Get the modal for a hint.

This view function gets the modal a hint by its primary key (pk). For use by htmx requests.

Args: pk (int): The primary key of the hint for the modal.

URL Patterns:

  • staff/hint/<int:pk>/get_modal/

Parameters:

  • pk: any

hints_claim

Description: Claim a hint for the current user.

This view function allows a staff member to claim a hint by its primary key (pk).

Args: pk (int): The primary key of the hint to be claimed.

URL Patterns:

  • staff/hint/<int:pk>/claim/

Parameters:

  • pk: any

hints_refund

Description: Refund a hint.

This view function allows a staff member to refund a hint by its primary key (pk).

Args: pk (int): The primary key of the hint to be refunded.

URL Patterns:

  • staff/hint/<int:pk>/refund/

Parameters:

  • pk: any

hints_release

Description: Release a claimed hint.

This view function allows a staff member to release a previously claimed hint by its primary key (pk).

Args: pk (int): The primary key of the hint to be released.

URL Patterns:

  • staff/hint/<int:pk>/release/

Parameters:

  • pk: any

hints_respond

Description: Respond to a hint request.

This view function allows a staff member to respond to a hint request by its primary key (pk). The response is taken from the POST data. If the ‘response’ key is not present in the POST data, a SuspiciousOperation exception is raised. The responded hint is then rendered in the ‘_hint_row.html’ partial template.

Args: pk (int): The primary key of the hint to be responded to.

URL Patterns:

  • staff/hint/<int:pk>/respond/

Parameters:

  • pk: any

hints_view

Description: View function to display hints for the current hunt.

This view fetches hints based on optional filters provided via GET parameters. The hints are paginated and rendered in the ‘staff_hints.html’ template.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/hints/

Parameters:

  • hunt: any

hunt_config

Description: Render or update the hunt configuration page.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/config/

Parameters:

  • hunt: any

hunt_puzzles

Description: View function to display puzzles for the current hunt.

This view fetches and annotates puzzles for a given hunt. The puzzles are then rendered in the ‘staff_hunt_puzzles.html’ template.

Args: hunt (Hunt): The hunt instance for which to display puzzles

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/puzzles/

Parameters:

  • hunt: any

hunt_reset

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/reset/

Parameters:

  • hunt: any

hunt_set_current

Description: Set a hunt as the current hunt.

This view function sets the specified hunt as the current hunt and saves it. The updated list of hunts is then rendered in the ‘staff_hunts.html’ template.

Args: hunt (Hunt): The hunt to be set as the current hunt.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/set_current/

Parameters:

  • hunt: any

hunt_template

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/template/

Parameters:

  • hunt: any

import_hunt

Description: Import a hunt from a zip file.

This view accepts a zip file upload and queues it for background processing. The zip file should have been created by the export_hunt view.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/import/

Parameters:

  • hunt: any

preview_template

Description: No description available.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/template/preview/

Parameters:

  • hunt: any

progress

Description: View function to display the progress of teams in the current hunt.

Args: request (HttpRequest): The HTTP request object.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/progress/

Parameters:

  • hunt: any

progress_data

Description: API endpoint to return progress data for DataTables consumption.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/progress_data/

Parameters:

  • hunt: any

Description: View function for searching users and teams.

This view allows staff members to search for users and teams by name/email. Results are returned via HTMX for dynamic updates.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/search/

Parameters:

  • hunt: any

staff_base

Description: No description available.

URL Patterns:

  • staff/

view_hunts

Description: View the list of hunts.

This view function retrieves all hunts ordered by start date with the current hunt first. The hunts are then rendered in the ‘staff_hunts.html’ template.

URL Patterns:

  • staff/hunt/<hunt-fallback:hunt>/hunts/

Parameters:

  • hunt: any

Views

events

Description: No description available.

URL Patterns:

  • sse/staff/
  • sse/team/<str:pk>/

flatpage

Description: Public interface to the flat page view.

Models: flatpages.flatpages Templates: Uses the template defined by the template_name field, or :template:flatpages/default.html if template_name is not defined. Context: flatpage flatpages.flatpages object

URL Patterns:

  • info/<path:url>

Parameters:

  • url: any

view

Description: No description available.

URL Patterns:

  • password_reset/
  • password_reset/done/
  • reset/<uidb64>/<token>
  • reset/done/

Parameters:

  • self: any