Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix bug 1371258] Filter snippets based on vertical screen resolution.
- Loading branch information
1 parent
4ccb7a1
commit 6e0790c
Showing
6 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
from django_mysql.models.functions import AsType, ColumnAdd | ||
|
||
|
||
def set_default_resolutions(apps, schema_editor): | ||
Snippet = apps.get_model('base', 'Snippet') | ||
resolutions = '0-1024;1024-1920;1920-50000' | ||
Snippet.objects.update( | ||
client_options=ColumnAdd('client_options', | ||
{'screen_resolutions': AsType(resolutions, 'CHAR')}) | ||
) | ||
|
||
|
||
def noop(apps, schema_editor): | ||
# nothing needed to go back in time. | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('base', '0016_auto_20160419_1316'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(set_default_resolutions, 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
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