Skip to content

Commit

Permalink
optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Dec 5, 2023
1 parent e973ba2 commit 57ef811
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 40 deletions.
4 changes: 2 additions & 2 deletions core/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.contrib import admin, messages
from django.contrib.auth.admin import UserAdmin as UserAdmin_
from django.contrib.auth.models import Group
from django.db.models import QuerySet
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from django.urls import reverse
from django.db.models import QuerySet

from .forms import *

Expand Down
2 changes: 1 addition & 1 deletion core/management/commands/init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core.management import BaseCommand
from django.contrib.auth.models import Group, Permission
from django.core.management import BaseCommand

from core import models

Expand Down
3 changes: 2 additions & 1 deletion core/management/commands/new_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import os
import time

from core.models import Team
from django.core.management import BaseCommand
from django.core.serializers import serialize
from django.core.serializers.json import DjangoJSONEncoder

from core.models import Team


class LazyEncoder(DjangoJSONEncoder):
def default(self, obj):
Expand Down
5 changes: 2 additions & 3 deletions core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Generated by Django 4.1.3 on 2022-12-01 06:08

from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion core/migrations/0003_remove_team_members_user_team.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.1.3 on 2022-12-01 06:27

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
3 changes: 2 additions & 1 deletion core/migrations/0004_qrcode_short_alter_invite_code.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 4.1.3 on 2022-12-01 06:32

import core.models
from django.db import migrations, models

import core.models


class Migration(migrations.Migration):
dependencies = [
Expand Down
3 changes: 2 additions & 1 deletion core/migrations/0007_qrcode_code_alter_invite_code.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 4.1.3 on 2022-12-05 14:41

import core.models
from django.db import migrations, models

import core.models


def gen_hint_keys(apps, schema_editor):
QRCode = apps.get_model("core", "qrcode")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 4.1.3 on 2022-12-05 19:56

import core.models
from django.db import migrations, models

import core.models


class Migration(migrations.Migration):
dependencies = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.1.3 on 2022-12-13 00:16

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion core/migrations/0017_alter_user_team.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.1.4 on 2022-12-19 01:25

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Generated by Django 4.1.13 on 2023-12-02 20:46
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from django.utils import timezone

import core.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


def create_hunt(apps, schema_editor):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.1.13 on 2023-12-05 14:34

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 4.1.13 on 2023-12-05 15:54

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0023_alter_hunt_ending_location_and_more"),
]

operations = [
migrations.RemoveField(
model_name="team",
name="is_active",
),
migrations.RemoveField(
model_name="user",
name="team",
),
migrations.AddField(
model_name="hunt",
name="allow_creation_post_start",
field=models.BooleanField(
default=False,
help_text="Allow users to create teams after the hunt has started",
),
),
migrations.AddField(
model_name="team",
name="members",
field=models.ManyToManyField(
related_name="teams",
related_query_name="teams",
to=settings.AUTH_USER_MODEL,
),
),
]
2 changes: 1 addition & 1 deletion core/static/core/overcast.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
<script type="module">
import newCalculateTime from "{% static 'core/countdown.js' %}"
import newCalculateTime from ""

const calculateTime = newCalculateTime(
{{ START.timestamp }} * 1000,
Expand Down
1 change: 0 additions & 1 deletion core/templatetags/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import template
from ..models import QrCode

register = template.Library()

Expand Down
2 changes: 1 addition & 1 deletion core/templatetags/md.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mistune as mistune_
from django import template
from django.utils.html import mark_safe
import mistune as mistune_

register = template.Library()

Expand Down
1 change: 1 addition & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.urls import path

from .views import auth, index, qr, team, puzzle

urlpatterns = [
Expand Down
20 changes: 9 additions & 11 deletions core/views/auth.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import base64
import hashlib
import secrets
from urllib.parse import urlencode

import requests
from authlib.integrations.django_client import OAuth
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login, logout
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.http import url_has_allowed_host_and_scheme
from django.shortcuts import redirect, render
from django.views.decorators.http import require_http_methods
from authlib.integrations.django_client import OAuth
import requests

import base64
import hashlib
import secrets

from urllib.parse import urlencode

from ..models import User


oauth = OAuth()
oauth.register("metropolis")

Expand Down
2 changes: 1 addition & 1 deletion core/views/index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.shortcuts import render
from django.conf import settings
from django.contrib.auth.models import Group
from django.shortcuts import render
from django.views.decorators.http import require_http_methods

from ..models import User, Hunt
Expand Down
11 changes: 4 additions & 7 deletions core/views/team.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import datetime

from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpRequest
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.decorators.http import require_http_methods
from django.utils.translation import gettext as _
from django.views.decorators.http import require_http_methods

from ..models import Team, Invite, generate_invite_code, Hunt
from ..forms import TeamJoinForm, TeamMakeForm
from .qr import team_required, upcoming_hunt_required
from ..forms import TeamJoinForm, TeamMakeForm
from ..models import Team, Invite, generate_invite_code, Hunt


@login_required
Expand Down

0 comments on commit 57ef811

Please sign in to comment.