Allow discord_uuid field to be blank on Player model

doc_update
Joey Hines 2019-12-23 10:15:09 -06:00
parent 48615762f7
commit 76714a7736
3 changed files with 21 additions and 3 deletions

View File

@ -138,7 +138,7 @@ def add_location(x_pos, z_pos, name=None, discord_uuid=None, mc_uuid=None, loc_t
@command(RequestTypes.POST)
def register(player_name, discord_uuid):
def register(player_name, discord_uuid=None):
"""
:request: POST
:param player_name: Minecraft in-game name
@ -153,7 +153,7 @@ def register(player_name, discord_uuid):
try:
player = get_player(mc_uuid=mc_uuid)
if len(discord_uuid) != 0 and len(player.discord_uuid) == 0:
if discord_uuid is not None and player.discord_uuid == "":
player.discord_uuid = discord_uuid
player.save()
return player.json

View File

@ -0,0 +1,18 @@
# Generated by Django 2.1.2 on 2019-12-23 16:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('GeoffreyApp', '0003_apitoken_model_api_perm'),
]
operations = [
migrations.AlterField(
model_name='player',
name='discord_uuid',
field=models.CharField(blank=True, max_length=50, unique=True),
),
]

View File

@ -78,7 +78,7 @@ class Player(models.Model):
Minecraft UUID
"""
discord_uuid = models.CharField(max_length=50, unique=True)
discord_uuid = models.CharField(max_length=50, unique=True, blank=True)
"""
Discord UUID
"""