-
Notifications
You must be signed in to change notification settings - Fork 9
/
models.py
41 lines (32 loc) · 1.02 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
"""
Bugzilla metadata models
"""
from django.contrib.postgres import fields
from django.db import models
class BugzillaProduct(models.Model):
"""
Bugzilla product model
"""
# the maximum length in the real data is currently 50
name = models.CharField(max_length=100, primary_key=True)
def __str__(self):
"""
string representaion of the object
"""
return f"BugzillaProduct({self.name})"
class BugzillaComponent(models.Model):
"""
Bugzilla component model
"""
# the maximum length in the real data is currently 64
name = models.CharField(max_length=100, primary_key=True)
default_owner = models.CharField(max_length=100)
default_cc = fields.ArrayField(models.CharField(max_length=100), default=list)
product = models.ForeignKey(
BugzillaProduct, on_delete=models.CASCADE, related_name="components"
)
def __str__(self):
"""
string representaion of the object
"""
return f"BugzillaComponent({self.name})"