Allow discord_uuid field to be blank on Player model
parent
48615762f7
commit
76714a7736
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
]
|
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue