-
Notifications
You must be signed in to change notification settings - Fork 23
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 #946 from ubyssey/django2.2
Upgrade Django to 2.2 LTS
- Loading branch information
Showing
36 changed files
with
357 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# Generated by Django 2.2.2 on 2019-06-07 23:53 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dispatch', '0022_video_meta_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='article', | ||
name='parent', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='article_parent', to='dispatch.Article'), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='reading_time', | ||
field=models.CharField(choices=[('anytime', 'Anytime'), ('morning', 'Morning'), ('midday', 'Midday'), ('evening', 'Evening')], default='anytime', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='subsection', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='article_subsection', to='dispatch.Subsection'), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='template', | ||
field=models.CharField(default='default', max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='topic', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='dispatch.Topic'), | ||
), | ||
migrations.AlterField( | ||
model_name='author', | ||
name='type', | ||
field=models.CharField(blank=True, default='author', max_length=100), | ||
), | ||
migrations.AlterField( | ||
model_name='file', | ||
name='file', | ||
field=models.FileField(upload_to='files/%Y/%m'), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='img', | ||
field=models.ImageField(upload_to='images/%Y/%m'), | ||
), | ||
migrations.AlterField( | ||
model_name='imageattachment', | ||
name='article', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_article', to='dispatch.Article'), | ||
), | ||
migrations.AlterField( | ||
model_name='imageattachment', | ||
name='gallery', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dispatch.ImageGallery'), | ||
), | ||
migrations.AlterField( | ||
model_name='imageattachment', | ||
name='page', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image_page', to='dispatch.Page'), | ||
), | ||
migrations.AlterField( | ||
model_name='integration', | ||
name='settings', | ||
field=models.TextField(default='{}'), | ||
), | ||
migrations.AlterField( | ||
model_name='invite', | ||
name='permissions', | ||
field=models.CharField(default='', max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='issue', | ||
name='file', | ||
field=models.FileField(upload_to='issues/%Y/%m'), | ||
), | ||
migrations.AlterField( | ||
model_name='issue', | ||
name='img', | ||
field=models.ImageField(upload_to='images/%Y/%m'), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='parent', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='page_parent', to='dispatch.Page'), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='parent_page', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='parent_page_fk', to='dispatch.Page'), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='template', | ||
field=models.CharField(default='default', max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='person', | ||
name='image', | ||
field=models.ImageField(null=True, upload_to='images'), | ||
), | ||
migrations.AlterField( | ||
model_name='podcast', | ||
name='category', | ||
field=models.CharField(choices=[('Arts', 'Arts'), ('Business', 'Business'), ('Comedy', 'Comedy'), ('Education', 'Education'), ('Games & Hobbies', 'Games & Hobbies'), ('Government & Organizations', 'Government & Organizations'), ('Health', 'Health'), ('Kids & Family', 'Kids & Family'), ('Music', 'Music'), ('News & Politics', 'News & Politics'), ('Religion & Spirituality', 'Religion & Spirituality'), ('Science & Medicine', 'Science & Medicine'), ('Society & Culture', 'Society & Culture'), ('Sports & Recreation', 'Sports & Recreation'), ('Technology', 'Technology'), ('TV & Film', 'TV & Film')], default='Arts', max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='podcast', | ||
name='explicit', | ||
field=models.CharField(choices=[('No', 'No'), ('Yes', 'Yes'), ('Clean', 'Clean')], default='No', max_length=5), | ||
), | ||
migrations.AlterField( | ||
model_name='podcast', | ||
name='image', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='dispatch.Image'), | ||
), | ||
migrations.AlterField( | ||
model_name='podcastepisode', | ||
name='explicit', | ||
field=models.CharField(choices=[('No', 'No'), ('Yes', 'Yes'), ('Clean', 'Clean')], default='No', max_length=5), | ||
), | ||
migrations.AlterField( | ||
model_name='podcastepisode', | ||
name='file', | ||
field=models.FileField(upload_to='podcasts/'), | ||
), | ||
migrations.AlterField( | ||
model_name='podcastepisode', | ||
name='image', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='dispatch.Image'), | ||
), | ||
migrations.AlterField( | ||
model_name='videoattachment', | ||
name='article', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_article', to='dispatch.Article'), | ||
), | ||
migrations.AlterField( | ||
model_name='videoattachment', | ||
name='page', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='video_page', to='dispatch.Page'), | ||
), | ||
] |
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,92 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2018-10-30 18:59 | ||
|
||
from django.db import migrations, models | ||
|
||
from dispatch.models import Article, Page | ||
|
||
def fix_latest_head(model, item): | ||
latest = model.objects. \ | ||
filter(parent=item.parent). \ | ||
order_by('-id')[0] | ||
|
||
model.objects. \ | ||
filter(parent=item.parent). \ | ||
update(head=None) | ||
|
||
latest.head = True | ||
latest.save(revision=False) | ||
|
||
duplicates = model.objects. \ | ||
filter(slug=item.slug). \ | ||
exclude(parent=item.parent). \ | ||
delete() | ||
|
||
def fix_latest_published(model, item): | ||
latest_items = model.objects. \ | ||
filter(parent_id=item.parent_id, is_published=True). \ | ||
order_by('-id') | ||
|
||
if not latest_items: | ||
return | ||
|
||
model.objects. \ | ||
filter(parent=item.parent). \ | ||
update(is_published=None) | ||
|
||
latest = latest_items[0] | ||
latest.is_published = True | ||
latest.save(revision=False) | ||
|
||
def fix_items(model): | ||
seen = set() | ||
for item in model.objects.order_by('-id'): | ||
if item.slug in seen: | ||
continue | ||
|
||
fix_latest_head(model, item) | ||
fix_latest_published(model, item) | ||
|
||
seen.add(item.slug) | ||
|
||
def remove_duplicates(apps, schema_editor): | ||
fix_items(Article) | ||
fix_items(Page) | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dispatch', '0023_upgrade_to_django2'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='article', | ||
name='head', | ||
field=models.NullBooleanField(db_index=True, default=False), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='is_published', | ||
field=models.NullBooleanField(db_index=True, default=False), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='head', | ||
field=models.NullBooleanField(db_index=True, default=False), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='is_published', | ||
field=models.NullBooleanField(db_index=True, default=False), | ||
), | ||
migrations.RunPython(remove_duplicates), | ||
migrations.AlterUniqueTogether( | ||
name='article', | ||
unique_together=set([('parent', 'slug', 'is_published'), ('slug', 'head'), ('parent', 'slug', 'head')]), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='page', | ||
unique_together=set([('parent', 'slug', 'is_published'), ('slug', 'head'), ('parent', 'slug', 'head')]), | ||
), | ||
] |
51 changes: 51 additions & 0 deletions
51
dispatch/migrations/0025_publishable_constraints_default.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,51 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11 on 2019-05-05 22:30 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dispatch', '0024_publishable_constraints'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='article', | ||
name='head', | ||
field=models.NullBooleanField(db_index=True, default=None), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='is_active', | ||
field=models.NullBooleanField(default=True), | ||
), | ||
migrations.AlterField( | ||
model_name='article', | ||
name='is_published', | ||
field=models.NullBooleanField(db_index=True, default=None), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='head', | ||
field=models.NullBooleanField(db_index=True, default=None), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='is_active', | ||
field=models.NullBooleanField(default=True), | ||
), | ||
migrations.AlterField( | ||
model_name='page', | ||
name='is_published', | ||
field=models.NullBooleanField(db_index=True, default=None), | ||
), | ||
migrations.AlterField( | ||
model_name='topic', | ||
name='slug', | ||
field=models.SlugField(max_length=255, unique=True), | ||
), | ||
] |
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.