Add climbing models
[climbing.kerkeslager.com] / src / climbing / models.py
1 from django.db import models
2
3 class Area(models.Model):
4     name = models.CharField(max_length=64)
5     notes = models.TextField()
6
7 class Crag(models.Model):
8     area = models.ForeignKey(Area, on_delete=models.CASCADE)
9     name = models.CharField(max_length=64)
10     notes = models.TextField()
11
12 class Route(models.Model):
13     area = models.ForeignKey(Crag, on_delete=models.CASCADE)
14     name = models.CharField(max_length=64)
15     notes = models.TextField()
16
17 ROUTE_DIFFICULTY_CHOICES = (
18     ('5.0', '5.0'),
19     ('5.1', '5.1'),
20     ('5.2', '5.2'),
21     ('5.3', '5.3'),
22     ('5.4', '5.4'),
23     ('5.5', '5.5'),
24     ('5.6', '5.6'),
25     ('5.6+', '5.6+'),
26     ('5.7', '5.7'),
27     ('5.7+', '5.7+'),
28     ('5.8', '5.8'),
29     ('5.8+', '5.8+'),
30     ('5.9-', '5.9-'),
31     ('5.9', '5.9'),
32     ('5.9+', '5.9+'),
33     ('5.10a', '5.10a'),
34     ('5.10b', '5.10b'),
35     ('5.10c', '5.10c'),
36     ('5.10d', '5.10d'),
37     ('5.11a', '5.11a'),
38     ('5.11b', '5.11b'),
39     ('5.11c', '5.11c'),
40     ('5.11d', '5.11d'),
41     ('5.12a', '5.12a'),
42     ('5.12b', '5.12b'),
43     ('5.12c', '5.12c'),
44     ('5.12d', '5.12d'),
45     ('5.13a', '5.13a'),
46     ('5.13b', '5.13b'),
47     ('5.13c', '5.13c'),
48     ('5.13d', '5.13d'),
49     ('5.14a', '5.14a'),
50     ('5.14b', '5.14b'),
51     ('5.14c', '5.14c'),
52     ('5.14d', '5.14d'),
53     ('5.15a', '5.15a'),
54     ('5.15b', '5.15b'),
55     ('5.15c', '5.15c'),
56     ('5.15d', '5.15d'),
57 )
58
59 SAFETY_CHOICES = (
60     ('G', 'G'),
61     ('PG', 'PG'),
62     ('PG13', 'PG13'),
63     ('R', 'R'),
64     ('X', 'X'),
65 )
66
67 class Pitch(models.Model):
68     route = models.ForeignKey(Route, on_delete=models.CASCADE)
69     name = models.CharField(max_length=64, null=True)
70     difficulty = models.CharField(max_length=5, choices=ROUTE_DIFFICULTY_CHOICES)
71     safety = models.CharField(max_length=4, choices=SAFETY_CHOICES)
72     notes = models.TextField()
73
74 class Cluster(models.Model):
75     area = models.ForeignKey(Area, on_delete=models.CASCADE)
76     name = models.CharField(max_length=64)
77     notes = models.TextField()
78
79 class Boulder(models.Model):
80     cluster = models.ForeignKey(Cluster, on_delete=models.CASCADE)
81     name = models.CharField(max_length=64)
82     notes = models.TextField()
83
84 BOULDER_DIFFICULTY_CHOICES = (
85     ('V0', 'V0'),
86     ('V1', 'V1'),
87     ('V2', 'V2'),
88     ('V3', 'V3'),
89     ('V4', 'V4'),
90     ('V5', 'V5'),
91     ('V6', 'V6'),
92     ('V7', 'V7'),
93     ('V8', 'V8'),
94     ('V9', 'V9'),
95     ('V10', 'V10'),
96     ('V11', 'V11'),
97     ('V12', 'V12'),
98     ('V13', 'V13'),
99     ('V14', 'V14'),
100     ('V15', 'V15'),
101     ('V16', 'V16'),
102     ('V17', 'V17'),
103 )
104
105 class Problem(models.Model):
106     boulder = models.ForeignKey(Boulder, on_delete=models.CASCADE)
107     name = models.CharField(max_length=64)
108     difficulty = models.CharField(max_length=3, choices=BOULDER_DIFFICULTY_CHOICES)
109     safety = models.CharField(max_length=4, choices=SAFETY_CHOICES)
110     notes = models.TextField()