Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions hvzsite/hvz/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from django.contrib import admin

# Register your models here.

from .models import *


# Register your models here.

class PersonAdmin(admin.ModelAdmin):
search_fields = ["first_name","last_name","email","player_uuid"]

Expand Down
4 changes: 2 additions & 2 deletions hvzsite/hvz/decorators.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import functools

from django.http import JsonResponse
from django.shortcuts import redirect
from django.contrib import messages
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, HttpResponseForbidden, HttpResponseNotFound


def authentication_required(view_func):
Expand Down
12 changes: 6 additions & 6 deletions hvzsite/hvz/forms.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from captcha.fields import CaptchaField
from django import forms
from django.forms import ValidationError
from django.db.models import Count, Q
from django.contrib.auth import authenticate
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.db.models import Count, Q
from django.forms import ValidationError
from django.utils import timezone
from django_registration.forms import RegistrationForm
from django.utils.translation import gettext_lazy as _
from django_registration import validators
from captcha.fields import CaptchaField

from .models import Announcement, Person, Blaster, BodyArmor, AntiVirus, Rules, About, PlayerStatus, Clan, get_active_game, Tag, Mission, CurrentGame, PostGameSurvey, PostGameSurveyOption, Report, ReportUpdate, Scoreboard
from .models import Announcement, Person, Blaster, BodyArmor, AntiVirus, Rules, About, PlayerStatus, Clan, \
get_active_game, Tag, Mission, PostGameSurvey, PostGameSurveyOption, Report, ReportUpdate, Scoreboard


def validate_no_special_chars_in_name(value):
if not isinstance(value, str):
Expand Down
12 changes: 5 additions & 7 deletions hvzsite/hvz/models.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from importlib.metadata import requires
from django.conf import settings
from django.contrib.auth.models import AbstractUser, UserManager
from django.core.validators import RegexValidator
from django.db import models
from django.contrib.auth.models import AbstractUser, UserManager, BaseUserManager
from django.db.models.functions import Concat
from django.db.models import CharField, Q
from django.conf import settings
from django.db.models.functions import Concat
from django.db.models.functions import Upper
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.templatetags.static import static
from django.core.validators import RegexValidator
from django.db.models.functions import Upper

alphanumeric = RegexValidator(r'^[0-9a-zA-Z ]*$', 'Only alphanumeric characters are allowed.')
hex_rgb = RegexValidator(r'^#[0-9a-fA-F]{6}$', 'Only hex color codes e.g. #52fa3d are allowed.')
Expand All @@ -20,7 +19,6 @@
import random
import string
from django.utils import timezone
from pytz import timezone as pytz_timezone
from tinymce import models as tinymce_models
from PIL import Image
from io import BytesIO
Expand Down
5 changes: 3 additions & 2 deletions hvzsite/hvz/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib.auth.models import User, Group
from .models import Person
from django.contrib.auth.models import Group
from rest_framework import serializers

from .models import Person


class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
Expand Down
2 changes: 1 addition & 1 deletion hvzsite/hvz/templatetags/hvztags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import template
from hvz.models import PostGameSurveyResponse, PostGameSurvey, Person, PlayerStatus
from django.utils import timezone

register = template.Library()

@register.simple_tag
Expand Down
2 changes: 0 additions & 2 deletions hvzsite/hvz/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from django.test import TestCase

# Create your tests here.
6 changes: 3 additions & 3 deletions hvzsite/hvz/urls.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from django.contrib.auth.views import LogoutView
from django.urls import path, re_path, include
from django.views.generic import TemplateView
from django.contrib.auth.views import LogoutView
from rest_framework.schemas import get_schema_view

from . import views
#from rest_framework import routers
# from rest_framework import routers
from .views_api_admin import AdminAPIViews
from .views_api_staff import StaffAPIViews
from .views_api_user import UserAPIViews
from .views_html_active_player import ActivePlayerHTMLViews
from .views_html_admin import AdminHTMLViews
from .views_html_staff import StaffHTMLViews
from .views_html_user import UserHTMLViews
from rest_framework.schemas import get_schema_view

# router = routers.DefaultRouter()
# router.register(r'users', views.UserViewSet)
Expand Down
13 changes: 6 additions & 7 deletions hvzsite/hvz/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import copy
from itertools import chain
from functools import lru_cache
import json
import os
import discord
from functools import lru_cache
from itertools import chain

import discord
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import Group
Expand All @@ -14,19 +14,18 @@
from django.db.utils import IntegrityError
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
from django.shortcuts import render, redirect

from hvzsite.settings import MEDIA_ROOT, STATIC_ROOT
from rest_framework import permissions, viewsets
from rest_framework.decorators import api_view
from rest_framework.views import APIView
from rest_framework_api_key.permissions import HasAPIKey

from .forms import ReportForm
from .models import About, Announcement, AntiVirus, BadgeInstance, Blaster, BodyArmor, Clan, ClanHistoryItem, CustomRedirect, DiscordLinkCode, FailedAVAttempt, Mission, PlayerStatus, Person, Report, Rules, Scoreboard, Tag
from .models import About, Announcement, AntiVirus, BadgeInstance, Blaster, BodyArmor, Clan, ClanHistoryItem, \
CustomRedirect, DiscordLinkCode, FailedAVAttempt, Mission, PlayerStatus, Person, Report, Rules, Scoreboard, Tag
from .models import get_active_game
from .serializers import GroupSerializer, UserSerializer

from hvzsite.settings import MEDIA_ROOT, STATIC_ROOT

if settings.DISCORD_REPORT_WEBHOOK_URL:
report_webhook = discord.SyncWebhook.from_url(settings.DISCORD_REPORT_WEBHOOK_URL)

Expand Down
10 changes: 6 additions & 4 deletions hvzsite/hvz/views_api_admin.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import base64, html, random, sys
import base64
import html
import random
import sys
from io import BytesIO

from PIL import Image
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.db.models import Q
from django.http import JsonResponse
from django.utils import timezone
from io import BytesIO
from PIL import Image
from rest_framework.decorators import api_view

from .decorators import admin_required_api
from .models import BodyArmor, Clan, ClanHistoryItem, NameChangeRequest, OZEntry, Person, PlayerStatus, Tag
from .models import get_active_game, generate_tag_id

from .views import for_all_methods
from .views_html_admin import AdminHTMLViews

Expand Down
1 change: 0 additions & 1 deletion hvzsite/hvz/views_api_user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

from django.http import JsonResponse
from django.utils import timezone

from rest_framework.decorators import api_view

from .decorators import authentication_required_api
Expand Down
1 change: 0 additions & 1 deletion hvzsite/hvz/views_html_active_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.shortcuts import render
from django.utils import timezone


from .decorators import active_player_required
from .forms import AVForm, ClanCreateForm, Mission, TagForm
from .models import ClanHistoryItem, FailedAVAttempt, PlayerStatus, PostGameSurveyOption, PostGameSurveyResponse, Tag
Expand Down
6 changes: 4 additions & 2 deletions hvzsite/hvz/views_html_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
from django.utils.dateparse import parse_datetime

from .decorators import admin_required
from .forms import AboutUpdateForm, AnnouncementForm, AVCreateForm, BlasterApprovalForm, BodyArmorCreateForm, MissionForm, PostGameSurveyForm, ReportUpdateForm, RulesUpdateForm, ScoreboardForm
from .forms import AboutUpdateForm, AnnouncementForm, AVCreateForm, BlasterApprovalForm, BodyArmorCreateForm, \
MissionForm, PostGameSurveyForm, ReportUpdateForm, RulesUpdateForm, ScoreboardForm
from .models import About, Announcement, AntiVirus, Blaster, BodyArmor, Clan, Mission, NameChangeRequest, Person, \
PlayerStatus, PostGameSurvey, Report, ReportUpdate, Rules, Scoreboard, Tag
from .models import get_active_game, reset_active_game
from .models import About, Announcement, AntiVirus, Blaster, BodyArmor, Clan, Mission, NameChangeRequest, Person, PlayerStatus, PostGameSurvey, Report, ReportUpdate, Rules, Scoreboard, Tag
from .views import for_all_methods


Expand Down
2 changes: 1 addition & 1 deletion hvzsite/hvz/views_html_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from .decorators import authentication_required
from .forms import ClanCreateForm, NameChangeForm
from .models import Clan, ClanHistoryItem, DiscordLinkCode, NameChangeRequest
from .models import get_active_game
from .views import for_all_methods, player_view


@for_all_methods(authentication_required)
class UserHTMLViews(object):
def me(request):
Expand Down
8 changes: 4 additions & 4 deletions hvzsite/hvzsite/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import re_path,include
from hvz.forms import HVZRegistrationForm
from django.urls import re_path, include
from django_registration.backends.activation.views import RegistrationView
from filebrowser.sites import site
from django.conf.urls.static import static
from django.conf import settings
from hvz.forms import HVZRegistrationForm

urlpatterns = [
re_path(r"", include('hvz.urls')),
Expand Down
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[project]
name = "rithvz-website"
version = "0.1.0"
description = "Add your description here"
requires-python = ">=3.12"
dependencies = [
"crispy-bootstrap5>=2025.6",
"discord-py>=2.6.3",
"django>=5.2.6",
"django-crispy-forms>=2.4",
"django-extensions>=4.1",
"django-filebrowser-no-grappelli>=4.0.2",
"django-grappelli>=4.0.2",
"django-registration>=5.2.1",
"django-rest-framework>=0.1.0",
"django-simple-captcha>=0.6.2",
"django-tinymce>=4.1.0",
"django-verify-email>=3.0.3",
"djangorestframework>=3.16.1",
"djangorestframework-api-key>=3.1.0",
"pillow>=11.3.0",
"psycopg2-binary>=2.9.10",
"pytz>=2025.2",
]
53 changes: 0 additions & 53 deletions requirements.txt

This file was deleted.

Loading