actually, just make Character.name completely unique

login, logout, etc. are too annoying otherwise

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
Brian S. Stephan 2024-05-10 16:04:42 -05:00
parent 7d0c8f3431
commit 54e944b74b
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,26 @@
# Generated by Django 5.0.5 on 2024-05-10 21:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('idlerpg', '0003_alter_character_status'),
]
operations = [
migrations.RemoveConstraint(
model_name='character',
name='no_characters_with_same_name_per_game',
),
migrations.RemoveConstraint(
model_name='character',
name='player_must_have_unique_character_names',
),
migrations.AlterField(
model_name='character',
name='name',
field=models.CharField(max_length=16, unique=True),
),
]

View File

@ -93,7 +93,7 @@ class Character(models.Model):
LOGOUT_P = 20
KICKED_P = 250
name = models.CharField(max_length=16)
name = models.CharField(max_length=16, unique=True)
password = models.CharField(max_length=256)
hostmask = models.CharField(max_length=256)
status = models.CharField(max_length=8, choices=CHARACTER_STATUSES, default='OFFLINE')
@ -122,8 +122,6 @@ class Character(models.Model):
constraints = [
models.UniqueConstraint("game", "hostmask", name="one_player_character_per_game"),
models.UniqueConstraint("game", "name", name="no_characters_with_same_name_per_game"),
models.UniqueConstraint("name", "hostmask", name="player_must_have_unique_character_names"),
]
def __str__(self):