Skip to content

Commit

Permalink
Added Hunt model to have continuity throughout hunts.
Browse files Browse the repository at this point in the history
Style: Format
  • Loading branch information
JasonLovesDoggo committed Dec 2, 2023
1 parent 9b82f76 commit b4d0765
Show file tree
Hide file tree
Showing 17 changed files with 365 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 39 additions & 19 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from .forms import *


@admin.action(
permissions=["change"],
description=_("Set selected users as a Location Setter"),
Expand Down Expand Up @@ -77,12 +78,22 @@ class TeamAdmin(admin.ModelAdmin):
@admin.display(description="Path")
def path(self, team):
return "\n".join(
map(lambda pk: str(QrCode.objects.get(id=pk)), QrCode.code_pks(team))
map(
lambda pk: str(QrCode.objects.get(id=pk)),
QrCode.code_pks(team),
)
)


class QrCodeAdmin(admin.ModelAdmin):
fields = ["short", "location", "notes", "key", "image_tag", "image_url"]
fields = [
"short",
"location",
"notes",
"key",
"image_tag",
"image_url",
]
readonly_fields = ["url", "key", "image_tag"]
list_display = ["location", "url"]
inlines = [HintsInLine]
Expand Down Expand Up @@ -115,7 +126,10 @@ class UserAdmin(UserAdmin_):
fieldsets = tuple(
admin_field
+ [
("Metropolis Integration (OAuth)", dict(fields=["metropolis_id"])),
(
"Metropolis Integration (OAuth)",
dict(fields=["metropolis_id"]),
),
("Game", dict(fields=["team"])),
]
)
Expand All @@ -125,3 +139,5 @@ class UserAdmin(UserAdmin_):
admin.site.register(Team, TeamAdmin)
admin.site.register(QrCode, QrCodeAdmin)
admin.site.register(LogicPuzzleHint, LogicPuzzleAdmin)
admin.site.register(Hunt)

49 changes: 37 additions & 12 deletions core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("password", models.CharField(max_length=128, verbose_name="password")),
(
"password",
models.CharField(max_length=128, verbose_name="password"),
),
(
"last_login",
models.DateTimeField(
blank=True, null=True, verbose_name="last login"
blank=True,
null=True,
verbose_name="last login",
),
),
(
Expand Down Expand Up @@ -61,19 +66,25 @@ class Migration(migrations.Migration):
(
"first_name",
models.CharField(
blank=True, max_length=150, verbose_name="first name"
blank=True,
max_length=150,
verbose_name="first name",
),
),
(
"last_name",
models.CharField(
blank=True, max_length=150, verbose_name="last name"
blank=True,
max_length=150,
verbose_name="last name",
),
),
(
"email",
models.EmailField(
blank=True, max_length=254, verbose_name="email address"
blank=True,
max_length=254,
verbose_name="email address",
),
),
(
Expand All @@ -95,7 +106,8 @@ class Migration(migrations.Migration):
(
"date_joined",
models.DateTimeField(
default=django.utils.timezone.now, verbose_name="date joined"
default=django.utils.timezone.now,
verbose_name="date joined",
),
),
("metropolis_id", models.IntegerField()),
Expand Down Expand Up @@ -135,7 +147,10 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="QrCode",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
(
"id",
models.AutoField(primary_key=True, serialize=False),
),
(
"location",
models.CharField(
Expand All @@ -152,21 +167,30 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Team",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
(
"id",
models.AutoField(primary_key=True, serialize=False),
),
("name", models.CharField(max_length=64, unique=True)),
("is_active", models.BooleanField(default=True)),
("is_open", models.BooleanField(default=False)),
("current_qr_code", models.IntegerField(blank=True, null=True)),
(
"current_qr_code",
models.IntegerField(blank=True, null=True),
),
(
"completed_qr_codes",
models.ManyToManyField(
blank=True, related_name="completed_qr_codes", to="core.qrcode"
blank=True,
related_name="completed_qr_codes",
to="core.qrcode",
),
),
(
"members",
models.ManyToManyField(
related_name="team", to=settings.AUTH_USER_MODEL
related_name="team",
to=settings.AUTH_USER_MODEL,
),
),
],
Expand All @@ -188,7 +212,8 @@ class Migration(migrations.Migration):
(
"team",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.team"
on_delete=django.db.models.deletion.CASCADE,
to="core.team",
),
),
],
Expand Down
4 changes: 3 additions & 1 deletion core/migrations/0004_qrcode_short_alter_invite_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class Migration(migrations.Migration):
model_name="invite",
name="code",
field=models.CharField(
default=core.models.generate_invite_code, max_length=32, unique=True
default=core.models.generate_invite_code,
max_length=32,
unique=True,
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class Migration(migrations.Migration):
model_name="qrcode",
name="key",
field=models.CharField(
default=core.models.generate_hint_key, max_length=64, unique=True
default=core.models.generate_hint_key,
max_length=64,
unique=True,
),
),
migrations.AlterField(
Expand Down
5 changes: 4 additions & 1 deletion core/migrations/0009_team_solo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

class Migration(migrations.Migration):
dependencies = [
("core", "0008_alter_invite_code_alter_qrcode_key_alter_team_name"),
(
"core",
"0008_alter_invite_code_alter_qrcode_key_alter_team_name",
),
]

operations = [
Expand Down
13 changes: 10 additions & 3 deletions core/migrations/0013_logicpuzzlehint_alter_qrcode_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="LogicPuzzleHint",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
(
"id",
models.AutoField(primary_key=True, serialize=False),
),
(
"hint",
models.TextField(
help_text="Hint for the logic puzzle", max_length=1024
help_text="Hint for the logic puzzle",
max_length=1024,
),
),
("notes", models.TextField(blank=True, help_text="Internal notes")),
(
"notes",
models.TextField(blank=True, help_text="Internal notes"),
),
(
"qr_index",
models.IntegerField(
Expand Down
Loading

0 comments on commit b4d0765

Please sign in to comment.