-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
278 additions
and
62 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
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
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
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
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
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
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
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 4.2.11 on 2024-07-03 09:47 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("hub", "0065_alter_areatype_area_type"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="PersonArea", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("start_date", models.DateField(blank=True, null=True)), | ||
("end_date", models.DateField(blank=True, null=True)), | ||
("person_type", models.CharField(max_length=10)), | ||
( | ||
"area", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="hub.area" | ||
), | ||
), | ||
( | ||
"person", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="hub.person" | ||
), | ||
), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name="person", | ||
name="areas", | ||
field=models.ManyToManyField( | ||
related_name="people", through="hub.PersonArea", to="hub.area" | ||
), | ||
), | ||
] |
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,26 @@ | ||
# Generated by Django 4.2.11 on 2024-07-03 09:49 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def populate_person_areas(apps, schema_editor): | ||
Person = apps.get_model("hub", "Person") | ||
PersonArea = apps.get_model("hub", "PersonArea") | ||
for p in Person.objects.all(): | ||
pa = PersonArea(person=p, area=p.area, person_type=p.person_type) | ||
pa.save() | ||
|
||
|
||
def reverse_noop(apps, schema_editor): # pragma: no cover | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("hub", "0066_personarea_person_areas"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(populate_person_areas, reverse_code=reverse_noop) | ||
] |
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,24 @@ | ||
# Generated by Django 4.2.11 on 2024-07-03 10:36 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("hub", "0067_populate_person_areas"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="person", | ||
name="old_area", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="hub.area", | ||
), | ||
), | ||
] |
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,30 @@ | ||
# Generated by Django 4.2.11 on 2024-07-03 13:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def populate_person_old_area(apps, schema_editor): | ||
Person = apps.get_model("hub", "Person") | ||
for p in Person.objects.all(): | ||
p.old_area = p.area | ||
p.save() | ||
|
||
|
||
def populate_person_area(apps, schema_editor): | ||
Person = apps.get_model("hub", "Person") | ||
for p in Person.objects.all(): | ||
p.area = p.old_area | ||
p.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("hub", "0068_add_person_old_area"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
populate_person_old_area, reverse_code=populate_person_area | ||
) | ||
] |
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,18 @@ | ||
# Generated by Django 4.2.11 on 2024-07-03 10:36 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("hub", "0069_populate_person_old_area"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="person", | ||
name="area", | ||
), | ||
] |
Oops, something went wrong.