Fix semantic error in new Django 3 Choices.

This commit is contained in:
Casper V. Kristensen 2020-09-17 18:16:17 +02:00
parent fb6fcc3307
commit 1c72c58781
Signed by: caspervk
GPG key ID: 289CA03790535054
2 changed files with 10 additions and 10 deletions

View file

@ -57,7 +57,7 @@ class RaidResponse(models.Model):
)
role = models.PositiveSmallIntegerField(
choices=Character.Roles.choices,
choices=Character.Role.choices,
blank=True,
null=True
)
@ -83,15 +83,15 @@ class RaidResponse(models.Model):
choices=Status.choices
)
class Groups(models.IntegerChoices):
class Group(models.IntegerChoices):
GROUP_1 = 1
GROUP_2 = 2
GROUP_3 = 3
GROUP_4 = 4
group = models.PositiveSmallIntegerField(
choices=Groups.choices,
default=Groups.GROUP_1
choices=Group.choices,
default=Group.GROUP_1
)
attendance = models.DecimalField(

View file

@ -68,8 +68,8 @@ class User(AbstractUser):
self.main = Character.objects.create(
user=None,
name=self.username,
klass=Character.WARRIOR,
role=Character.DAMAGE
klass=Character.Klass.WARRIOR,
role=Character.Role.DAMAGE
)
self.main.save()
user = super().save(*args, **kwargs)
@ -93,7 +93,7 @@ class Character(models.Model):
unique=True
)
class Klasses(models.IntegerChoices):
class Klass(models.IntegerChoices):
DRUID = 1
HUNTER = 2
MAGE = 3
@ -106,16 +106,16 @@ class Character(models.Model):
klass = models.PositiveSmallIntegerField(
"class",
choices=Klasses.choices
choices=Klass.choices
)
class Roles(models.IntegerChoices):
class Role(models.IntegerChoices):
TANK = 1
HEALER = 2
DAMAGE = 3
role = models.PositiveSmallIntegerField(
choices=Roles.choices
choices=Role.choices
)
class Meta: