-
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.
Merge pull request #1613 from laws-africa/overturned
Add overturned and upheld predicates
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
peachjam/migrations/0109_add_overturned_and_upheld_predicates.py
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,40 @@ | ||
# Generated by Django 3.2.19 on 2023-11-14 09:13 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def add_overturned_and_upheld_predicates(apps, schema_editor): | ||
"""Add the predicates for overturned and upheld.""" | ||
Predicate = apps.get_model("peachjam", "Predicate") | ||
|
||
overturned_predicate = { | ||
"name": "overturns", | ||
"slug": "overturns", | ||
"verb": "overturns", | ||
"reverse_verb": "is overturned by", | ||
} | ||
Predicate.objects.update_or_create( | ||
name=overturned_predicate["name"], defaults=overturned_predicate | ||
) | ||
|
||
upheld_predicate = { | ||
"name": "upholds", | ||
"slug": "upholds", | ||
"verb": "upholds", | ||
"reverse_verb": "is upheld by", | ||
} | ||
Predicate.objects.update_or_create( | ||
name=upheld_predicate["name"], defaults=upheld_predicate | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("peachjam", "0108_update_ingestor_api_url"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
add_overturned_and_upheld_predicates, migrations.RunPython.noop | ||
), | ||
] |