Skip to content

Commit

Permalink
create Bugzilla prodcut and component models
Browse files Browse the repository at this point in the history
  • Loading branch information
osoukup committed Jan 23, 2023
1 parent 4503154 commit c7e5c7a
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
50 changes: 50 additions & 0 deletions apps/bbsync/migrations/0001_initial.py
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.
41 changes: 41 additions & 0 deletions apps/bbsync/models.py
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})"

0 comments on commit c7e5c7a

Please sign in to comment.