Skip to content

Commit 9a7cc83

Browse files
committed
add AuthorityData table
1 parent 2f60c0b commit 9a7cc83

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Generated by Django 4.2.11 on 2024-06-17 14:00
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("crowdsourcer", "0050_add_previous_q_link"),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name="AuthorityData",
16+
fields=[
17+
(
18+
"id",
19+
models.BigAutoField(
20+
auto_created=True,
21+
primary_key=True,
22+
serialize=False,
23+
verbose_name="ID",
24+
),
25+
),
26+
("data_name", models.CharField(max_length=200)),
27+
("data_value", models.TextField()),
28+
(
29+
"authority",
30+
models.ForeignKey(
31+
on_delete=django.db.models.deletion.CASCADE,
32+
to="crowdsourcer.publicauthority",
33+
),
34+
),
35+
],
36+
options={
37+
"indexes": [
38+
models.Index(
39+
fields=["authority", "data_name"],
40+
name="crowdsource_authori_49003f_idx",
41+
)
42+
],
43+
},
44+
),
45+
]

crowdsourcer/models.py

+11
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ def options(self):
104104
return Option.objects.filter(question=self).order_by("ordering", "score")
105105

106106

107+
class AuthorityData(models.Model):
108+
authority = models.ForeignKey("PublicAuthority", on_delete=models.CASCADE)
109+
data_name = models.CharField(max_length=200)
110+
data_value = models.TextField()
111+
112+
class Meta:
113+
indexes = [
114+
models.Index(fields=["authority", "data_name"]),
115+
]
116+
117+
107118
class PublicAuthority(models.Model):
108119
COUNTRIES = [
109120
("england", "England"),

0 commit comments

Comments
 (0)