5. Models¶
-
class
huntserver.models.
Hint
(*args, **kwargs)[source]¶ A class to represent a hint to a puzzle
Parameters: - id (AutoField) – Id
- puzzle_id (ForeignKey to
Puzzle
) – The puzzle that this hint is related to - team_id (ForeignKey to
Team
) – The team that requested the hint - request (TextField) – The text of the request for the hint
- request_time (DateTimeField) – Hint request time
- response (TextField) – The text of the response to the hint request
- response_time (DateTimeField) – Hint response time
- last_modified_time (DateTimeField) – Last time of modification
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
HintUnlockPlan
(*args, **kwargs)[source]¶ A class to represent when Teams are given hints
Parameters: - id (AutoField) – Id
- hunt_id (ForeignKey to
Hunt
) – The hunt that this hint unlock plan refers to - unlock_type (CharField) – The type of hint unlock plan
- unlock_parameter (IntegerField) – Parameter (Time / Interval / Solves)
- num_triggered (IntegerField) – Number of times this Unlock Plan has given a hint
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
Hunt
(*args, **kwargs)[source]¶ Base class for a hunt. Contains basic details about a puzzlehunt.
Parameters: - id (AutoField) – Id
- hunt_name (CharField) – The name of the hunt as the public will see it
- hunt_number (IntegerField) – A number used internally for hunt sorting, must be unique
- team_size (IntegerField) – Team size
- start_date (DateTimeField) – The date/time at which a hunt will become visible to registered users
- end_date (DateTimeField) – The date/time at which a hunt will be archived and available to the public
- display_start_date (DateTimeField) – The start date/time displayed to users
- display_end_date (DateTimeField) – The end date/time displayed to users
- location (CharField) – Starting location of the puzzlehunt
- resource_file (FileField) – Hunt resources, MUST BE A ZIP FILE.
- is_current_hunt (BooleanField) – Is current hunt
- extra_data (CharField) – A misc. field for any extra data to be stored with the hunt.
- template (TextField) – The template string to be rendered to HTML on the hunt page
- hint_lockout (IntegerField) – The number of minutes before a hint can be used on a newly unlocked puzzle
- points_per_minute (IntegerField) – The number of points granted per minute during the hunt
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
clean
(*args, **kwargs)[source]¶ Overrides the standard clean method to ensure that only one hunt is the current hunt
-
dummy_team
¶ The dummy team for the hunt
-
in_reg_lockdown
¶ A boolean indicating whether or not registration has locked for this hunt
-
is_day_of_hunt
¶ A boolean indicating whether or not today is the day of the hunt
-
is_locked
¶ A boolean indicating whether or not the hunt is locked
-
is_open
¶ A boolean indicating whether or not the hunt is open to registered participants
-
is_public
¶ A boolean indicating whether or not the hunt is open to the public
-
real_teams
¶ A queryset of all non-dummy teams in the hunt
-
save
(*args, **kwargs)[source]¶ Overrides the standard save method to ensure that only one hunt is the current hunt
-
season
¶ Gets a season string from the hunt dates
-
class
huntserver.models.
HuntAssetFile
(*args, **kwargs)[source]¶ A class to represent an asset file for a puzzlehunt
Parameters: - id (AutoField) – Id
- file (FileField) – File
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
Message
(*args, **kwargs)[source]¶ A class that represents a message sent using the chat functionality
Parameters: - id (AutoField) – Id
- team_id (ForeignKey to
Team
) – The team that this message is being sent to/from - is_response (BooleanField) – A boolean representing whether or not the message is from the staff
- text (CharField) – Message text
- time (DateTimeField) – Message send time
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
OverwriteStorage
(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None)[source]¶ A custom storage class that just overwrites existing files rather than erroring
-
class
huntserver.models.
Person
(*args, **kwargs)[source]¶ A class to associate more personal information with the default django auth user class
Parameters: - id (AutoField) – Id
- user_id (OneToOneField to
User
) – The corresponding user to this person - phone (CharField) – Person’s phone number, no particular formatting
- allergies (CharField) – Allergy information for the person
- comments (CharField) – Comments or other notes about the person
- is_shib_acct (BooleanField) – A boolean to indicate if the person uses shibboleth authentication for login
- teams (ManyToManyField) – Teams that the person is on
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
Prepuzzle
(*args, **kwargs)[source]¶ A class representing a pre-puzzle within a hunt
Parameters: - id (AutoField) – Id
- puzzle_name (CharField) – The name of the puzzle as it will be seen by hunt participants
- released (BooleanField) – Released
- hunt_id (OneToOneField to
Hunt
) – The hunt that this puzzle is a part of, leave blank for no associated hunt. - answer (CharField) – The answer to the puzzle, not case sensitive
- template (TextField) – The template string to be rendered to HTML on the hunt page
- resource_file (FileField) – Prepuzzle resources, MUST BE A ZIP FILE.
- response_string (TextField) – Data returned to the webpage for use upon solving.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
class
huntserver.models.
Puzzle
(*args, **kwargs)[source]¶ A class representing a puzzle within a hunt
Parameters: - id (AutoField) – Id
- hunt_id (ForeignKey to
Hunt
) – The hunt that this puzzle is a part of - puzzle_name (CharField) – The name of the puzzle as it will be seen by hunt participants
- puzzle_number (IntegerField) – The number of the puzzle within the hunt, for sorting purposes
- puzzle_id (CharField) – A 3-5 character hex string that uniquely identifies the puzzle
- answer (CharField) – The answer to the puzzle, not case sensitive
- is_meta (BooleanField) – Is this puzzle a meta-puzzle?
- puzzle_page_type (CharField) – The type of webpage for this puzzle.
- doesnt_count (BooleanField) – Should this puzzle not count towards scoring?
- puzzle_file (FileField) – Puzzle file. MUST BE A PDF
- resource_file (FileField) – Puzzle resources, MUST BE A ZIP FILE.
- solution_is_webpage (BooleanField) – Is this solution an html webpage?
- solution_file (FileField) – Puzzle solution. MUST BE A PDF.
- solution_resource_file (FileField) – Puzzle solution resources, MUST BE A ZIP FILE.
- extra_data (CharField) – A misc. field for any extra data to be stored with the puzzle.
- unlock_type (CharField) – The type of puzzle unlocking scheme
- num_required_to_unlock (IntegerField) – Number of prerequisite puzzles that need to be solved to unlock this puzzle
- points_cost (IntegerField) – The number of points needed to unlock this puzzle.
- points_value (IntegerField) – The number of points this puzzle grants upon solving.
- unlocks (ManyToManyField) – Puzzles that this puzzle is a possible prerequisite for
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
class
huntserver.models.
PuzzleOverwriteStorage
(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None)[source]¶ A custom storage class that just overwrites existing files rather than erroring
-
class
huntserver.models.
Response
(*args, **kwargs)[source]¶ A class to represent an automated response regex
Parameters: - id (AutoField) – Id
- puzzle_id (ForeignKey to
Puzzle
) – The puzzle that this automated response is related to - regex (CharField) – The python-style regex that will be checked against the user’s response
- text (CharField) – The text to use in the submission response if the regex matched
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
Solve
(*args, **kwargs)[source]¶ A class that links a team and a puzzle to indicate that the team has solved the puzzle
Parameters: - id (AutoField) – Id
- puzzle_id (ForeignKey to
Puzzle
) – The puzzle that this is a solve for - team_id (ForeignKey to
Team
) – The team that this solve is from - submission_id (ForeignKey to
Submission
) – The submission object that the team submitted to solve the puzzle
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
class
huntserver.models.
Submission
(*args, **kwargs)[source]¶ A class representing a submission to a given puzzle from a given team
Parameters: - id (AutoField) – Id
- team_id (ForeignKey to
Team
) – The team that made the submission - submission_time (DateTimeField) – Submission time
- submission_text (CharField) – Submission text
- response_text (CharField) – Response to the given answer. Empty string indicates human response needed
- puzzle_id (ForeignKey to
Puzzle
) – The puzzle that this submission is in response to - modified_date (DateTimeField) – Last date/time of response modification
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
convert_markdown_response
¶ The response with all markdown links converted to HTML links
-
is_correct
¶ A boolean indicating if the submission given is exactly correct
-
respond
()[source]¶ Takes the submission’s text and uses various methods to craft and populate a response. If the response is correct a solve is created and the correct puzzles are unlocked
-
save
(*args, **kwargs)[source]¶ Overrides the default save function to update the modified date on save
-
class
huntserver.models.
Team
(*args, **kwargs)[source]¶ A class representing a team within a hunt
Parameters: - id (AutoField) – Id
- team_name (CharField) – The team name as it will be shown to hunt participants
- hunt_id (ForeignKey to
Hunt
) – The hunt that the team is a part of - location (CharField) – The physical location that the team is solving at
- join_code (CharField) – The 5 character random alphanumeric password needed for a user to join a team
- playtester (BooleanField) – A boolean to indicate if the team is a playtest team and will get early access
- playtest_start_date (DateTimeField) – The date/time at which a hunt will become to the playtesters
- playtest_end_date (DateTimeField) – The date/time at which a hunt will no longer be available to playtesters
- num_waiting_messages (IntegerField) – The number of unseen messages a team has waiting
- num_available_hints (IntegerField) – The number of hints the team has available to use
- num_unlock_points (IntegerField) – The number of points the team has earned
- solved (ManyToManyField) – The puzzles the team has solved
- unlocked (ManyToManyField) – The puzzles the team has unlocked
- unlockables (ManyToManyField) – The unlockables the team has earned
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
hints_open_for_puzzle
(puzzle)[source]¶ Takes a puzzle and returns whether or not the team may use hints on the puzzle
-
is_normal_team
¶ A boolean indicating whether or not the team is a normal (non-playtester) team
-
is_playtester_team
¶ A boolean indicating whether or not the team is a playtesting team
-
playtest_happening
¶ A boolean indicating whether or not the team’s playtest slot is currently happening
-
playtest_over
¶ A boolean indicating whether or not the team’s playtest slot has passed
-
playtest_started
¶ A boolean indicating whether or not the team is currently allowed to be playtesting
-
short_name
¶ Team name shortened to 30 characters for more consistent display
-
size
¶ The number of people on the team
-
class
huntserver.models.
Unlock
(*args, **kwargs)[source]¶ A class that links a team and a puzzle to indicate that the team has unlocked the puzzle
Parameters: -
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
exception
-
class
huntserver.models.
Unlockable
(*args, **kwargs)[source]¶ A class that represents an object to be unlocked after solving a puzzle
Parameters: - id (AutoField) – Id
- puzzle_id (ForeignKey to
Puzzle
) – The puzzle that needs to be solved to unlock this object - content_type (CharField) – The type of object that is to be unlocked, can be ‘IMG’, ‘PDF’, ‘TXT’, or ‘WEB’
- content (CharField) – The link to the content, files must be externally hosted.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶