-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
102 lines (78 loc) · 3.01 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from tortoise import fields
from tortoise.models import Model
class RealWordEN(Model):
id = fields.IntField(pk=True)
string = fields.CharField(max_length=50, unique=True)
type = fields.CharField(max_length=16, null=True)
number = fields.CharField(max_length=1, null=True)
tense = fields.CharField(max_length=16, null=True)
class Meta:
table = "real_words_EN"
def __str__(self):
return f"{self.string} ({self.id})"
class RealWordFR(Model):
id = fields.IntField(pk=True)
string = fields.CharField(max_length=100)
type = fields.CharField(max_length=16, null=True)
gender = fields.CharField(max_length=1, null=True)
number = fields.CharField(max_length=1, null=True)
tense = fields.CharField(max_length=16, null=True)
proper = fields.BooleanField()
complex = fields.BooleanField(null=True)
class Meta:
table = "real_words_FR"
unique_together = ("string", "type")
def __str__(self):
return f"{self.string} ({self.id})"
class GeneratedWordEN(Model):
id = fields.IntField(pk=True)
string = fields.CharField(max_length=100, unique=True)
type = fields.CharField(max_length=16, null=True)
number = fields.CharField(max_length=1, null=True)
tense = fields.CharField(max_length=16, null=True)
date = fields.DatetimeField()
ip = fields.CharField(max_length=16)
class Meta:
table = "generated_words_EN"
def __str__(self):
return f"{self.string} ({self.id})"
class GeneratedWordFR(Model):
id = fields.IntField(pk=True)
string = fields.CharField(max_length=100, unique=True)
type = fields.CharField(max_length=16, null=True)
gender = fields.CharField(max_length=1, null=True)
number = fields.CharField(max_length=1, null=True)
tense = fields.CharField(max_length=16, null=True)
conjug = fields.CharField(max_length=16, null=True)
date = fields.DatetimeField()
ip = fields.CharField(max_length=16)
class Meta:
table = "generated_words_FR"
def __str__(self):
return f"{self.string} ({self.id})"
class GeneratedDefinitionEN(Model):
id = fields.IntField(pk=True)
generated_word = fields.ForeignKeyField(
"models.GeneratedWordEN", related_name="generated_definitions_en"
)
text = fields.TextField()
date = fields.DatetimeField()
ip = fields.CharField(max_length=16)
class Meta:
table = "generated_definitions_EN"
unique_together = ("generated_word_id", "text")
def __str__(self):
return f"{self.text} ({self.id})"
class GeneratedDefinitionFR(Model):
id = fields.IntField(pk=True)
generated_word = fields.ForeignKeyField(
"models.GeneratedWordFR", related_name="generated_definitions_fr"
)
text = fields.TextField()
date = fields.DatetimeField()
ip = fields.CharField(max_length=16)
class Meta:
table = "generated_definitions_FR"
unique_together = ("generated_word_id", "text")
def __str__(self):
return f"{self.text} ({self.id})"