Skip to content

Commit

Permalink
#863 #934 Add MatrixBlock to admin panel. Localize fields (#941)
Browse files Browse the repository at this point in the history
* Add MatrixBlock to admin panel. Localize fields

* Delete todos

* Recompile translate. Edit in_pack colModel

* Create todo to fix i18n
  • Loading branch information
ArtemijRodionov authored Jul 6, 2019
1 parent 1fca36d commit db12eb7
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 37 deletions.
2 changes: 2 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ deploy-dev:

# update internationalization messages
i18n:
# @todo #934:15m Wait user approval for `make i18n`
# See the parent issue for details
$(dc) run --rm app bash -c "\
python manage.py makemessages --ignore 'venv/**' \
&& python manage.py compilemessages -l ru \
Expand Down
3 changes: 1 addition & 2 deletions front/js/components/admin.es6
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const customColModels = [
{
name: 'in_pack',
// @todo #858:15m Localize Product.in_pack field
label: 'in pack',
label: 'в упаковке',
editable: true,
editoptions: {
type: 'number',
Expand Down
6 changes: 6 additions & 0 deletions shopelectro/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ def id_(self, obj):
return obj.fake_order_number


class MatrixBlockAdmin(mixins.PermissionsControl):

list_display = ['category', 'block_size']


se_admin = SEAdminSite(name='se_admin')
se_admin.register(CustomPage, models.CustomPageAdmin)
se_admin.register(FlatPage, models.FlatPageAdmin)
Expand All @@ -298,5 +303,6 @@ def id_(self, obj):
se_admin.register(se_models.ProductFeedback, ProductFeedbackPageAdmin)
se_admin.register(se_models.TagGroup, TagGroupAdmin)
se_admin.register(se_models.Tag, TagAdmin)
se_admin.register(se_models.MatrixBlock, MatrixBlockAdmin)

se_admin.register(Redirect)
Binary file modified shopelectro/locale/ru/LC_MESSAGES/django.mo
Binary file not shown.
86 changes: 58 additions & 28 deletions shopelectro/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-03 10:00+0000\n"
"POT-Creation-Date: 2019-07-05 12:54+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"
Expand All @@ -20,88 +20,124 @@ msgstr ""
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
"%100>=11 && n%100<=14)? 2 : 3);\n"

#: shopelectro/admin.py:25
#: shopelectro/admin.py:45
msgid "has tags"
msgstr "По тегам"

#: shopelectro/admin.py:30
#: shopelectro/admin.py:50
msgid "Has tags"
msgstr "С тегами"

#: shopelectro/admin.py:31
#: shopelectro/admin.py:51
msgid "Has no tags"
msgstr "Без тегов"

#: shopelectro/admin.py:47
#: shopelectro/admin.py:65
msgid "has category"
msgstr "По категориями"

#: shopelectro/admin.py:52
#: shopelectro/admin.py:70
msgid "Has category"
msgstr "С категориями"

#: shopelectro/admin.py:53
#: shopelectro/admin.py:71
msgid "Has no category"
msgstr "Без категорий"

#: shopelectro/admin.py:146
#: shopelectro/admin.py:178
#, fuzzy
#| msgid "vendor_code"
msgid "Vendor code"
msgstr "артикул"

#: shopelectro/admin.py:184
msgid "Price"
msgstr "Цена"

#: shopelectro/admin.py:210
msgid "Link"
msgstr "Ссылка"

#: shopelectro/admin.py:189
#: shopelectro/admin.py:253
msgid "Group"
msgstr "Группа тегов"

#: shopelectro/admin.py:274
msgid "Sends email notifications about placed orders"
msgstr "Отправить письмо"

#: shopelectro/models.py:81
msgid "Matrix block"
msgstr "Раздел на странице каталога"

#: shopelectro/models.py:82
msgid "Matrix blocks"
msgstr "Разделы на странице каталога"

#: shopelectro/models.py:91 shopelectro/models.py:132
msgid "category"
msgstr "категория"

#: shopelectro/models.py:88
#: shopelectro/models.py:98
msgid "block size"
msgstr "размер раздела"

#: shopelectro/models.py:139
msgid "tags"
msgstr "теги"

#: shopelectro/models.py:91
#: shopelectro/models.py:149
msgid "vendor_code"
msgstr "артикул"

#: shopelectro/models.py:93
#: shopelectro/models.py:152
msgid "purchase_price"
msgstr "закупочная цена"

#: shopelectro/models.py:94
#: shopelectro/models.py:154
msgid "wholesale_small"
msgstr "мелкий опт"

#: shopelectro/models.py:95
#: shopelectro/models.py:156
msgid "wholesale_medium"
msgstr "средний опт"

#: shopelectro/models.py:96
#: shopelectro/models.py:158
msgid "wholesale_large"
msgstr "крупный опт"

#: shopelectro/models.py:118
#: shopelectro/models.py:162
msgid "in pack"
msgstr "в упаковке"

#: shopelectro/models.py:198
msgid "date"
msgstr "дата"

#: shopelectro/models.py:119 shopelectro/models.py:167
#: shopelectro/models.py:206
#: shopelectro/models.py:200
msgid "name"
msgstr "название"

#: shopelectro/models.py:120
#: shopelectro/models.py:202
msgid "rating"
msgstr "рейтинг"

#: shopelectro/models.py:121
#: shopelectro/models.py:204
msgid "dignities"
msgstr "достоинства"

#: shopelectro/models.py:122 shopelectro/models.py:123
#: shopelectro/models.py:206 shopelectro/models.py:208
msgid "limitations"
msgstr "недостатки"

#: shopelectro/models.py:169 shopelectro/models.py:208
#: shopelectro/models.py:248
msgid "revenue"
msgstr "прибыль"

#: shopelectro/tests/tests_views.py:754
msgid "Product"
msgstr "Товар"

msgid "position"
msgstr "позиция"

Expand All @@ -117,9 +153,6 @@ msgstr "Категории"
msgid "parent"
msgstr "родитель"

msgid "Product"
msgstr "Товар"

msgid "Products"
msgstr "Товары"

Expand Down Expand Up @@ -186,9 +219,6 @@ msgstr "Сделать неактивными"
msgid "Parent"
msgstr "Родитель"

msgid "Price"
msgstr "Цена"

msgid "Table editor"
msgstr "Табличный редактор"

Expand Down
8 changes: 1 addition & 7 deletions shopelectro/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ def blocks(self):
class MatrixBlock(models.Model):
"""It is an UI element of catalog matrix."""

# @todo #880:30m Add MatrixBlock to the admin panel.
# Inline it on Category Edit page.

# @todo #880:60m Use MatrixBlock in the matrix view.
# Get the block_size data from the matrix view and fill out the model.

class Meta:
verbose_name = _('Matrix block')
verbose_name_plural = _('Matrix blocks')
Expand All @@ -89,7 +83,7 @@ class Meta:
on_delete=models.CASCADE,
primary_key=True,
verbose_name=_('category'),
related_name=_('matrix_block'),
related_name='matrix_block',
limit_choices_to={'level': 0},
)

Expand Down

4 comments on commit db12eb7

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on db12eb7 Jul 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 880-c9d8b5dc disappeared from shopelectro/models.py, that's why I closed #934. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on db12eb7 Jul 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 880-51a8e904 disappeared from shopelectro/models.py, that's why I closed #935. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on db12eb7 Jul 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 858-5815cddb disappeared from front/js/components/admin.es6, that's why I closed #863. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on db12eb7 Jul 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 934-a8735256 discovered in docker/Makefile and submitted as #942. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.