-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Ordering AWX does not work fields were duplicated
- Loading branch information
elias-boulharts
committed
Dec 18, 2023
1 parent
f360771
commit 8e862a6
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
service_catalog/migrations/0040_alter_towersurveyfield_unique_together.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,27 @@ | ||
# Generated by Django 4.2.6 on 2023-12-18 10:18 | ||
|
||
from django.db import migrations | ||
|
||
def clean_tower_survey_fields(apps, schema_editor): | ||
Operation = apps.get_model("service_catalog", "Operation") | ||
for operation in Operation.objects.all(): | ||
if operation.tower_survey_fields.filter(position=0).count() > 1: | ||
operation.tower_survey_fields.exclude(position=0).delete() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('service_catalog', '0039_alter_request_options_alter_request_state_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(clean_tower_survey_fields), | ||
migrations.AlterUniqueTogether( | ||
name='towersurveyfield', | ||
unique_together={('operation', 'variable')}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='towersurveyfield', | ||
options={'default_permissions': ('add', 'change', 'delete', 'view', 'list'), 'ordering': ('position',)}, | ||
), | ||
] |
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