forked from RedHatProductSecurity/osidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create Bugzilla prodcut and component models
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by Django 3.2.15 on 2023-01-23 08:46 | ||
|
||
import django.contrib.postgres.fields | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="BugzillaProduct", | ||
fields=[ | ||
( | ||
"name", | ||
models.CharField(max_length=100, primary_key=True, serialize=False), | ||
), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="BugzillaComponent", | ||
fields=[ | ||
( | ||
"name", | ||
models.CharField(max_length=100, primary_key=True, serialize=False), | ||
), | ||
("default_owner", models.CharField(max_length=100)), | ||
( | ||
"default_cc", | ||
django.contrib.postgres.fields.ArrayField( | ||
base_field=models.CharField(max_length=100), | ||
default=list, | ||
size=None, | ||
), | ||
), | ||
( | ||
"product", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="components", | ||
to="bbsync.bugzillaproduct", | ||
), | ||
), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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})" |