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:
parent
7d0c8f3431
commit
54e944b74b
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -93,7 +93,7 @@ class Character(models.Model):
|
||||||
LOGOUT_P = 20
|
LOGOUT_P = 20
|
||||||
KICKED_P = 250
|
KICKED_P = 250
|
||||||
|
|
||||||
name = models.CharField(max_length=16)
|
name = models.CharField(max_length=16, unique=True)
|
||||||
password = models.CharField(max_length=256)
|
password = models.CharField(max_length=256)
|
||||||
hostmask = models.CharField(max_length=256)
|
hostmask = models.CharField(max_length=256)
|
||||||
status = models.CharField(max_length=8, choices=CHARACTER_STATUSES, default='OFFLINE')
|
status = models.CharField(max_length=8, choices=CHARACTER_STATUSES, default='OFFLINE')
|
||||||
|
@ -122,8 +122,6 @@ class Character(models.Model):
|
||||||
|
|
||||||
constraints = [
|
constraints = [
|
||||||
models.UniqueConstraint("game", "hostmask", name="one_player_character_per_game"),
|
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):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in New Issue