From 451bd333aad87457bd73ae65d3b1384aa13abef2 Mon Sep 17 00:00:00 2001 From: Niko Abeler Date: Mon, 19 Jun 2023 20:23:15 +0200 Subject: [PATCH] address --- ...lter_playsession_options_player_address.py | 25 +++++++++++++++++++ guild/models.py | 2 ++ guild/templates/guild/player_detail.html | 4 +++ guild/views/player.py | 4 +-- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 guild/migrations/0004_alter_playsession_options_player_address.py diff --git a/guild/migrations/0004_alter_playsession_options_player_address.py b/guild/migrations/0004_alter_playsession_options_player_address.py new file mode 100644 index 0000000..81c2c68 --- /dev/null +++ b/guild/migrations/0004_alter_playsession_options_player_address.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.1 on 2023-06-19 18:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("guild", "0003_character_status"), + ] + + operations = [ + migrations.AlterModelOptions( + name="playsession", + options={ + "ordering": ["-date"], + "verbose_name": "playsession", + "verbose_name_plural": "playsessions", + }, + ), + migrations.AddField( + model_name="player", + name="address", + field=models.TextField(blank=True, verbose_name="address"), + ), + ] diff --git a/guild/models.py b/guild/models.py index c1fc8c4..411a201 100644 --- a/guild/models.py +++ b/guild/models.py @@ -6,6 +6,8 @@ from django.utils.translation import gettext as _ class Player(models.Model): name = models.CharField(max_length=255, unique=True) + address = models.TextField(_("address"), blank=True) + class Meta: verbose_name = _("player") verbose_name_plural = _("players") diff --git a/guild/templates/guild/player_detail.html b/guild/templates/guild/player_detail.html index b940856..9a77efd 100644 --- a/guild/templates/guild/player_detail.html +++ b/guild/templates/guild/player_detail.html @@ -13,6 +13,10 @@ + +

Address

+

{{ player.address|linebreaks }}

+

Characters

{% if not player.character_set.count %} diff --git a/guild/views/player.py b/guild/views/player.py index 828bbbb..22e5314 100644 --- a/guild/views/player.py +++ b/guild/views/player.py @@ -7,7 +7,7 @@ from guild.models import Player class CreatePlayerView(LoginRequiredMixin, CreateView): model = Player - fields = ["name"] + fields = ["name", "address"] class PlayerDetailView(LoginRequiredMixin, DetailView): @@ -16,7 +16,7 @@ class PlayerDetailView(LoginRequiredMixin, DetailView): class PlayerUpdateView(LoginRequiredMixin, UpdateView): model = Player - fields = ["name"] + fields = ["name", "address"] class PlayerDeleteView(LoginRequiredMixin, DeleteView):