YDS_5_15c = 37, '5.15c'
YDS_5_15d = 38, '5.15d'
-SAFETY_CHOICES = (
- ('G', 'G'),
- ('PG', 'PG'),
- ('PG13', 'PG13'),
- ('R', 'R'),
- ('X', 'X'),
-)
+class Safety(models.IntegerChoices):
+ G = 0, 'G'
+ PG = 1, 'PG'
+ PG13 = 2, 'PG13'
+ R = 3, 'R'
+ X = 4, 'X'
class Pitch(models.Model):
route = models.ForeignKey(
)
name = models.CharField(max_length=64, blank=True, null=True)
difficulty = models.PositiveIntegerField(choices=RouteDifficulty.choices)
- safety = models.CharField(max_length=4, choices=SAFETY_CHOICES)
+ safety = models.IntegerField(choices=Safety.choices)
notes = models.TextField(blank=True, null=True)
class Meta:
def __str__(self):
return self.name
-BOULDER_DIFFICULTY_CHOICES = (
- ('V0', 'V0'),
- ('V1', 'V1'),
- ('V2', 'V2'),
- ('V3', 'V3'),
- ('V4', 'V4'),
- ('V5', 'V5'),
- ('V6', 'V6'),
- ('V7', 'V7'),
- ('V8', 'V8'),
- ('V9', 'V9'),
- ('V10', 'V10'),
- ('V11', 'V11'),
- ('V12', 'V12'),
- ('V13', 'V13'),
- ('V14', 'V14'),
- ('V15', 'V15'),
- ('V16', 'V16'),
- ('V17', 'V17'),
-)
+class BoulderDifficylty(models.IntegerChoices):
+ V0 = 0, 'V0'
+ V1 = 1, 'V1'
+ V2 = 2, 'V2'
+ V3 = 3, 'V3'
+ V4 = 4, 'V4'
+ V5 = 5, 'V5'
+ V6 = 6, 'V6'
+ V7 = 7, 'V7'
+ V8 = 8, 'V8'
+ V9 = 9, 'V9'
+ V10 = 10, 'V10'
+ V11 = 11, 'V11'
+ V12 = 12, 'V12'
+ V13 = 13, 'V13'
+ V14 = 14, 'V14'
+ V15 = 15, 'V15'
+ V16 = 16, 'V16'
+ V17 = 17, 'V17'
+
class Problem(models.Model):
boulder = models.ForeignKey(
related_name='problems',
)
name = models.CharField(max_length=64)
- difficulty = models.CharField(max_length=3, choices=BOULDER_DIFFICULTY_CHOICES)
- safety = models.CharField(max_length=4, choices=SAFETY_CHOICES)
+ difficulty = models.IntegerField(choices=BoulderDifficylty.choices)
+ safety = models.IntegerField(choices=Safety.choices)
mountain_project = models.URLField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)