Skip to content

Commit 9d920b0

Browse files
committed
feat(clearinghouse): initial models and migrations
1 parent 09bf6b4 commit 9d920b0

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Generated by Django 5.2.3 on 2025-07-17 04:55
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = []
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name="DataCatalog",
15+
fields=[
16+
("id", models.AutoField(primary_key=True, serialize=False)),
17+
("name", models.TextField(help_text="The name of this data catalog.")),
18+
("slug", models.SlugField(help_text="The unique slug for this data catalog.", unique=True)),
19+
],
20+
options={
21+
"verbose_name": "Data Catalog",
22+
"verbose_name_plural": "Data Catalogs",
23+
},
24+
),
25+
migrations.CreateModel(
26+
name="CatalogEntry",
27+
fields=[
28+
("id", models.AutoField(primary_key=True, serialize=False)),
29+
("name", models.TextField(help_text="The name of this catalog entry.")),
30+
("slug", models.SlugField(help_text="The unique slug for this catalog entry.", unique=True)),
31+
("catalog", models.ManyToManyField(to="clearinghouse.datacatalog")),
32+
],
33+
options={
34+
"verbose_name": "Catalog Entry",
35+
"verbose_name_plural": "Catalog Entries",
36+
},
37+
),
38+
]

pems/clearinghouse/migrations/__init__.py

Whitespace-only changes.

pems/clearinghouse/models.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from django.db import models
2+
3+
4+
class DataCatalog(models.Model):
5+
"""Defines a data catalog in the Clearinghouse."""
6+
7+
class Meta:
8+
verbose_name = "Data Catalog"
9+
verbose_name_plural = "Data Catalogs"
10+
11+
id = models.AutoField(primary_key=True)
12+
name = models.TextField(help_text="The name of this data catalog.")
13+
slug = models.SlugField(help_text="The unique slug for this data catalog.", unique=True)
14+
15+
def __str__(self):
16+
return self.name
17+
18+
19+
class CatalogEntry(models.Model):
20+
"""Defines an entry in a data catalog."""
21+
22+
class Meta:
23+
verbose_name = "Catalog Entry"
24+
verbose_name_plural = "Catalog Entries"
25+
26+
id = models.AutoField(primary_key=True)
27+
catalog = models.ManyToManyField(DataCatalog)
28+
name = models.TextField(help_text="The name of this catalog entry.")
29+
slug = models.SlugField(help_text="The unique slug for this catalog entry.", unique=True)
30+
31+
def __str__(self):
32+
return self.name

0 commit comments

Comments
 (0)