-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webhook.http_content_type to slug (#3569)
- Loading branch information
1 parent
89e720c
commit 5d772d7
Showing
4 changed files
with
59 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
WEBHOOK_CONTENTTYPE_CHOICES = ( | ||
(1, 'application/json'), | ||
(2, 'application/x-www-form-urlencoded'), | ||
) | ||
|
||
|
||
def webhook_contenttype_to_slug(apps, schema_editor): | ||
Webhook = apps.get_model('extras', 'Webhook') | ||
for id, slug in WEBHOOK_CONTENTTYPE_CHOICES: | ||
Webhook.objects.filter(http_content_type=str(id)).update(http_content_type=slug) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
|
||
dependencies = [ | ||
('extras', '0031_3569_exporttemplate_fields'), | ||
] | ||
|
||
operations = [ | ||
|
||
# Webhook.http_content_type | ||
migrations.AlterField( | ||
model_name='webhook', | ||
name='http_content_type', | ||
field=models.CharField(default='application/json', max_length=50), | ||
), | ||
migrations.RunPython( | ||
code=webhook_contenttype_to_slug | ||
), | ||
|
||
] |
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