Add in_game_name field to FriendCode model

This commit is contained in:
badblocks 2025-03-14 09:50:49 -07:00
parent 4792906907
commit bc181b12d9
19 changed files with 113 additions and 56 deletions

View file

@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% load crispy_forms_tags i18n %}
{% block title %}Add Friend Code{% endblock %}
@ -8,8 +8,18 @@
<h1 class="text-3xl font-bold mb-4">Add Friend Code</h1>
<form method="post" class="space-y-4">
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-primary w-full">Add Friend Code</button>
{{ form.non_field_errors }}
<div>
<label for="{{ form.friend_code.id_for_label }}" class="block font-medium">{{ form.friend_code.label }}</label>
{{ form.friend_code }}
{{ form.friend_code.errors }}
</div>
<div>
<label for="{{ form.in_game_name.id_for_label }}" class="block font-medium">{{ form.in_game_name.label }}</label>
{{ form.in_game_name }}
{{ form.in_game_name.errors }}
</div>
<button type="submit" class="btn btn-primary w-full">{% trans "Add Friend Code" %}</button>
</form>
<div class="mt-4">
@ -19,11 +29,11 @@
<!-- Include Cleave Zen from a CDN -->
<script src="https://unpkg.com/cleave-zen@0.0.17/dist/cleave-zen.umd.js"></script>
<script>
<script defer>
document.addEventListener('DOMContentLoaded', function(){
// Initialize Cleave Zen on the friend code input field.
// Make sure that the input ID is correct (e.g., provided by Django's widget rendering).
new CleaveZen('#id_friend_code', {
cleaveZen('#id_friend_code', {
delimiters: ['-', '-', '-'], // Inserts dashes between the blocks.
blocks: [4, 4, 4, 4],
numericOnly: true