-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate cobb-douglas hardcoded values to newer "a" variables
Issue #3368 Moving forward, it seems all graphs contain a set of fields which all make use of the following properties: * Value * Name (optional) * Min/Max (optional) * Alternate value (optional) We can encapsulate this into an abstraction called a graph "Field". It's still to be determined what this will actually look like on the back-end, I am just trying to understand things conceptually.
- Loading branch information
Showing
10 changed files
with
287 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.14 on 2024-07-29 14:01 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('main', '0115_graph_a1_2_graph_a1_max_2_graph_a1_min_2_graph_a2_2_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='graph', | ||
name='a5_name', | ||
field=models.TextField(blank=True, default=''), | ||
), | ||
] |
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.14 on 2024-07-29 14:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def migrate_cobb_douglas_fields(apps, schema_editor): | ||
Graph = apps.get_model("main", "Graph") | ||
for graph in Graph.objects.filter(graph_type=3): | ||
# Cobb-Douglas | ||
graph.a1 = graph.cobb_douglas_a | ||
graph.a1_name = graph.cobb_douglas_a_name | ||
graph.a2 = graph.cobb_douglas_l | ||
graph.a2_name = graph.cobb_douglas_l_name | ||
graph.a3 = graph.cobb_douglas_k | ||
graph.a3_name = graph.cobb_douglas_k_name | ||
graph.a4 = graph.cobb_douglas_alpha | ||
graph.a4_name = graph.cobb_douglas_alpha_name | ||
graph.a5_name = graph.cobb_douglas_y_name | ||
graph.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('main', '0116_graph_a5_name'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(migrate_cobb_douglas_fields), | ||
] |
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
Oops, something went wrong.