-
Notifications
You must be signed in to change notification settings - Fork 2
Multiple allowed formats #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e726972
Add formats list field and validation
tumb1er beb1e20
Add data migration
tumb1er a03f5ad
Drop format field
tumb1er 367058a
Fix migration
tumb1er 35fc67c
Localization update
tumb1er 8dc8b2e
Fix type annotation
tumb1er 9b58504
Fix type annotation again
tumb1er c4d53dd
Add test for exact aspect check
tumb1er 48dbaee
Rise coverage
tumb1er b780e5f
Fix test
tumb1er File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ msgid "" | |
| msgstr "" | ||
| "Project-Id-Version: PACKAGE VERSION\n" | ||
| "Report-Msgid-Bugs-To: \n" | ||
| "POT-Creation-Date: 2020-04-02 09:43+0000\n" | ||
| "POT-Creation-Date: 2020-04-06 13:24+0000\n" | ||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
|
|
@@ -24,8 +24,8 @@ msgstr "" | |
| msgid "Image assets" | ||
| msgstr "Ассеты" | ||
|
|
||
| #: image_assets/forms.py:13 image_assets/models.py:71 | ||
| #: image_assets/models.py:161 image_assets/models.py:178 | ||
| #: image_assets/forms.py:13 image_assets/models.py:70 | ||
| #: image_assets/models.py:155 image_assets/models.py:191 | ||
| msgid "Asset Type" | ||
| msgstr "Тип ассета" | ||
|
|
||
|
|
@@ -39,54 +39,56 @@ msgstr "Отсутствуют обязательные типы ассетов: | |
| msgid "Duplicate active assets for types: %s" | ||
| msgstr "Дублируются активные ассеты следующих типов: %s" | ||
|
|
||
| #: image_assets/models.py:46 | ||
| #: image_assets/models.py:45 | ||
| msgid "Slug" | ||
| msgstr "Слаг" | ||
|
|
||
| #: image_assets/models.py:48 | ||
| msgid "Image Format" | ||
| #: image_assets/models.py:46 | ||
| #, fuzzy | ||
| #| msgid "Image Format" | ||
| msgid "Formats" | ||
| msgstr "Формат изображения" | ||
|
|
||
| #: image_assets/models.py:50 | ||
| #: image_assets/models.py:49 | ||
| msgid "Min Width" | ||
| msgstr "Минимальная ширина" | ||
|
|
||
| #: image_assets/models.py:52 | ||
| #: image_assets/models.py:51 | ||
| msgid "Min Height" | ||
| msgstr "Минимальная высота" | ||
|
|
||
| #: image_assets/models.py:54 | ||
| #: image_assets/models.py:53 | ||
| msgid "Aspect" | ||
| msgstr "Аспект" | ||
|
|
||
| #: image_assets/models.py:56 | ||
| #: image_assets/models.py:55 | ||
| msgid "Aspect accuracy" | ||
| msgstr "Погрешность аспекта" | ||
|
|
||
| #: image_assets/models.py:58 | ||
| #: image_assets/models.py:57 | ||
| msgid "Max file size" | ||
| msgstr "Максимальный размер файла" | ||
|
|
||
| #: image_assets/models.py:61 | ||
| #: image_assets/models.py:60 | ||
| msgid "Required for" | ||
| msgstr "Обязателен для" | ||
|
|
||
| #: image_assets/models.py:65 | ||
| #: image_assets/models.py:64 | ||
| msgid "Allowed for" | ||
| msgstr "Допустим для" | ||
|
|
||
| #: image_assets/models.py:72 | ||
| #: image_assets/models.py:71 | ||
| msgid "Asset Types" | ||
| msgstr "Типы ассетов" | ||
|
|
||
| #: image_assets/models.py:91 | ||
| #: image_assets/models.py:97 | ||
| #, python-format | ||
| msgid "File size must be not greater than %s" | ||
| msgstr "Размер файла должен быть не более %s" | ||
|
|
||
| #: image_assets/models.py:113 | ||
| #: image_assets/models.py:106 | ||
| #, python-format | ||
| msgid "Image format must be %s" | ||
| msgid "Image format must be one of %s" | ||
| msgstr "Формат изображения должен быть %s" | ||
|
|
||
| #: image_assets/models.py:117 | ||
|
|
@@ -99,44 +101,44 @@ msgstr "Ширина изображения должна быть не мень | |
| msgid "Image height must be not less than %s" | ||
| msgstr "Высота изображения должна быть не меньше %s" | ||
|
|
||
| #: image_assets/models.py:128 | ||
| #: image_assets/models.py:133 | ||
| #, python-format | ||
| msgid "Image aspect must be %s" | ||
| msgstr "Аспект изображения должен быть %s" | ||
|
|
||
| #: image_assets/models.py:132 | ||
| #: image_assets/models.py:137 | ||
| #, python-format | ||
| msgid "Image aspect must be %(aspect)s ± %(accuracy)s" | ||
| msgstr "Аспект изображения должен быть %(aspect)s ± %(accuracy)s" | ||
|
|
||
| #: image_assets/models.py:149 | ||
| msgid "Asset" | ||
| msgstr "Ассет" | ||
|
|
||
| #: image_assets/models.py:150 | ||
| msgid "Assets" | ||
| msgstr "Ассеты" | ||
|
|
||
| #: image_assets/models.py:159 image_assets/models.py:176 | ||
| #: image_assets/models.py:153 image_assets/models.py:189 | ||
| msgid "Image" | ||
| msgstr "Изображение" | ||
|
|
||
| #: image_assets/models.py:162 | ||
| #: image_assets/models.py:156 | ||
| msgid "Active" | ||
| msgstr "Активен" | ||
|
|
||
| #: image_assets/models.py:165 image_assets/models.py:181 | ||
| #: image_assets/models.py:159 image_assets/models.py:194 | ||
| msgid "Content Type" | ||
| msgstr "Тип объекта" | ||
|
|
||
| #: image_assets/models.py:166 image_assets/models.py:182 | ||
| #: image_assets/models.py:160 image_assets/models.py:195 | ||
| msgid "Object ID" | ||
| msgstr "ID объекта" | ||
|
|
||
| #: image_assets/models.py:187 | ||
| #: image_assets/models.py:165 | ||
| msgid "Asset" | ||
| msgstr "Ассет" | ||
|
|
||
| #: image_assets/models.py:166 | ||
| msgid "Assets" | ||
| msgstr "Ассеты" | ||
|
|
||
| #: image_assets/models.py:200 | ||
| msgid "Deleted Asset" | ||
| msgstr "Удаленный ассет" | ||
|
|
||
| #: image_assets/models.py:188 | ||
| #: image_assets/models.py:201 | ||
| msgid "Deleted Assets" | ||
| msgstr "Удаленные ассеты" | ||
This file contains hidden or 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 hidden or 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 hidden or 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,25 @@ | ||
| # Generated by Django 3.0.5 on 2020-04-06 12:10 | ||
|
|
||
| import bitfield.models | ||
| from django.db import migrations | ||
|
|
||
| from image_assets import defaults | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ('image_assets', '0004_auto_20200402_0942'), | ||
| ] | ||
|
|
||
| operations = [] | ||
| if defaults.ASSET_TYPE_MODEL == 'image_assets.AssetType': | ||
| operations.extend([ | ||
| migrations.AddField( | ||
| model_name='assettype', | ||
| name='formats', | ||
| field=bitfield.models.BitField( | ||
| (('jpeg', 'JPEG'), ('png', 'PNG')), | ||
| default=0), | ||
| ), | ||
|
|
||
| ]) |
This file contains hidden or 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 3.0.5 on 2020-04-06 13:02 | ||
|
|
||
| from django.db import migrations | ||
| from image_assets import defaults | ||
|
|
||
|
|
||
| # noinspection PyUnusedLocal | ||
| def migrate_formats(apps, schema_editor): | ||
| app_label, model_name = defaults.ASSET_TYPE_MODEL.split('.') | ||
| # noinspection PyPep8Naming | ||
| AssetType = apps.get_model(app_label, model_name) | ||
|
|
||
| for at in AssetType.objects.all(): | ||
| flag = getattr(AssetType.formats, at.format) | ||
| at.formats = flag | ||
| at.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('image_assets', '0005_assettype_formats'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RunPython(migrate_formats, migrations.RunPython.noop), | ||
| ] |
This file contains hidden or 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,33 @@ | ||
| # Generated by Django 3.0.5 on 2020-04-06 13:13 | ||
|
|
||
| import bitfield.models | ||
| from django.db import migrations, models | ||
| import image_assets.validators | ||
| from image_assets import defaults | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ('image_assets', '0006_migrate_formats'), | ||
| ] | ||
| operations = [] | ||
| if defaults.ASSET_TYPE_MODEL == 'image_assets.AssetType': | ||
| operations.extend([ | ||
| migrations.RemoveField( | ||
| model_name='assettype', | ||
| name='format', | ||
| ), | ||
| migrations.AlterField( | ||
| model_name='asset', | ||
| name='image', | ||
| field=models.ImageField(upload_to='', validators=[ | ||
| image_assets.validators.AssetValidator()], | ||
| verbose_name='Image'), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name='assettype', | ||
| name='formats', | ||
| field=bitfield.models.BitField( | ||
| (('jpeg', 'JPEG'), ('png', 'PNG')), default=0), | ||
| ), | ||
| ]) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.