diff --git a/src/locale/en_US/LC_MESSAGES/django.po b/src/locale/en_US/LC_MESSAGES/django.po index cd1932195..a402e1d86 100644 --- a/src/locale/en_US/LC_MESSAGES/django.po +++ b/src/locale/en_US/LC_MESSAGES/django.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: PyCon TW\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-15 17:45+0800\n" +"POT-Creation-Date: 2024-06-21 07:48+0800\n" "PO-Revision-Date: 2022-07-11 02:23+0800\n" "Last-Translator: Tom Chen \n" "Language-Team: English (United States) (http://www.transifex.com/pycon-" @@ -506,7 +506,7 @@ msgstr "keynote events" msgid "Keynote: {speaker}" msgstr "Keynote: {speaker}" -#: events/models.py:318 sponsors/models.py:97 sponsors/models.py:113 +#: events/models.py:318 sponsors/models.py:103 sponsors/models.py:119 msgid "sponsor" msgstr "sponsor" @@ -1418,23 +1418,27 @@ msgstr "Stage {stage} dump for {proposal}" msgid "name" msgstr "name" -#: sponsors/models.py:27 +#: sponsors/models.py:28 +msgid "is shown" +msgstr "whether to show on the website" + +#: sponsors/models.py:33 msgid "website URL" msgstr "website URL" -#: sponsors/models.py:31 +#: sponsors/models.py:37 msgid "introduction" msgstr "introduction" -#: sponsors/models.py:34 +#: sponsors/models.py:40 msgid "subtitle" msgstr "subtitle" -#: sponsors/models.py:39 +#: sponsors/models.py:45 msgid "logo (SVG)" msgstr "logo (SVG)" -#: sponsors/models.py:42 +#: sponsors/models.py:48 msgid "" "Vector format of the logo, in SVG. This takes precedence to the raster " "format, if available." @@ -1442,11 +1446,11 @@ msgstr "" "Vector format of the logo, in SVG. This takes precedence to the raster " "format, if available." -#: sponsors/models.py:47 +#: sponsors/models.py:53 msgid "logo (image)" msgstr "logo (image)" -#: sponsors/models.py:51 +#: sponsors/models.py:57 msgid "" "Raster format of the logo, e.g. PNG, JPEG. This is used as fallback when the " "SVG file is not available." @@ -1454,71 +1458,71 @@ msgstr "" "Raster format of the logo, e.g. PNG, JPEG. This is used as fallback when the " "SVG file is not available." -#: sponsors/models.py:56 +#: sponsors/models.py:62 msgid "order" msgstr "order" -#: sponsors/models.py:76 +#: sponsors/models.py:82 msgid "platinum" msgstr "platinum" -#: sponsors/models.py:77 +#: sponsors/models.py:83 msgid "gold" msgstr "gold" -#: sponsors/models.py:78 +#: sponsors/models.py:84 msgid "silver" msgstr "silver" -#: sponsors/models.py:79 +#: sponsors/models.py:85 msgid "bronze" msgstr "bronze" -#: sponsors/models.py:80 +#: sponsors/models.py:86 msgid "special" msgstr "special" -#: sponsors/models.py:81 +#: sponsors/models.py:87 msgid "special-thanks" msgstr "special-thanks" -#: sponsors/models.py:82 +#: sponsors/models.py:88 msgid "organizer" msgstr "organizer" -#: sponsors/models.py:83 +#: sponsors/models.py:89 msgid "co-organizer" msgstr "co-organizer" -#: sponsors/models.py:92 +#: sponsors/models.py:98 msgid "level" msgstr "level" -#: sponsors/models.py:98 +#: sponsors/models.py:104 msgid "sponsors" msgstr "sponsors" -#: sponsors/models.py:118 +#: sponsors/models.py:124 msgid "open role name" msgstr "open role name" -#: sponsors/models.py:123 +#: sponsors/models.py:129 msgid "open role description" msgstr "open role description" -#: sponsors/models.py:127 +#: sponsors/models.py:133 msgid "open role requirements" msgstr "open role requirements" -#: sponsors/models.py:132 +#: sponsors/models.py:138 msgid "open role URL" msgstr "open role URL" -#: sponsors/models.py:137 +#: sponsors/models.py:143 msgid "open role" msgstr "open role" -#: sponsors/models.py:138 +#: sponsors/models.py:144 msgid "open roles" msgstr "open roles" diff --git a/src/locale/zh_Hant/LC_MESSAGES/django.po b/src/locale/zh_Hant/LC_MESSAGES/django.po index 645976e65..a1e05ee09 100644 --- a/src/locale/zh_Hant/LC_MESSAGES/django.po +++ b/src/locale/zh_Hant/LC_MESSAGES/django.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: PyCon TW\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-15 17:45+0800\n" +"POT-Creation-Date: 2024-06-21 07:48+0800\n" "PO-Revision-Date: 2022-07-11 02:25+0800\n" "Last-Translator: Tom Chen \n" "Language-Team: Chinese Traditional (http://www.transifex.com/pycon-taiwan/" @@ -513,7 +513,7 @@ msgstr "基調演講" msgid "Keynote: {speaker}" msgstr "基調演講:{speaker}" -#: events/models.py:318 sponsors/models.py:97 sponsors/models.py:113 +#: events/models.py:318 sponsors/models.py:103 sponsors/models.py:119 msgid "sponsor" msgstr "贊助" @@ -1375,104 +1375,108 @@ msgstr "第 {stage} 階段封存《{proposal}》" msgid "name" msgstr "名稱" -#: sponsors/models.py:27 +#: sponsors/models.py:28 +msgid "is shown" +msgstr "顯示於官網" + +#: sponsors/models.py:33 msgid "website URL" msgstr "網站 URL" -#: sponsors/models.py:31 +#: sponsors/models.py:37 msgid "introduction" msgstr "簡介" -#: sponsors/models.py:34 +#: sponsors/models.py:40 msgid "subtitle" msgstr "副標題" -#: sponsors/models.py:39 +#: sponsors/models.py:45 msgid "logo (SVG)" msgstr "logo (SVG)" -#: sponsors/models.py:42 +#: sponsors/models.py:48 msgid "" "Vector format of the logo, in SVG. This takes precedence to the raster " "format, if available." msgstr "即使有點陣式圖形格式的圖標,還是會優先採用向量式SVG格式的圖標。" -#: sponsors/models.py:47 +#: sponsors/models.py:53 msgid "logo (image)" msgstr "logo (圖片)" -#: sponsors/models.py:51 +#: sponsors/models.py:57 msgid "" "Raster format of the logo, e.g. PNG, JPEG. This is used as fallback when the " "SVG file is not available." msgstr "" "當SVG格式的檔案不存在時,會回過頭來使用點陣式格式的圖標,例如PNG、JPEG。" -#: sponsors/models.py:56 +#: sponsors/models.py:62 msgid "order" msgstr "排序" -#: sponsors/models.py:76 +#: sponsors/models.py:82 msgid "platinum" msgstr "白金級" -#: sponsors/models.py:77 +#: sponsors/models.py:83 msgid "gold" msgstr "金級" -#: sponsors/models.py:78 +#: sponsors/models.py:84 msgid "silver" msgstr "銀級" -#: sponsors/models.py:79 +#: sponsors/models.py:85 msgid "bronze" msgstr "銅級" -#: sponsors/models.py:80 +#: sponsors/models.py:86 msgid "special" msgstr "特別贊助" -#: sponsors/models.py:81 +#: sponsors/models.py:87 msgid "special-thanks" msgstr "特別感謝" -#: sponsors/models.py:82 +#: sponsors/models.py:88 msgid "organizer" msgstr "主辦單位" -#: sponsors/models.py:83 +#: sponsors/models.py:89 msgid "co-organizer" msgstr "協辦單位" -#: sponsors/models.py:92 +#: sponsors/models.py:98 msgid "level" msgstr "等級" -#: sponsors/models.py:98 +#: sponsors/models.py:104 msgid "sponsors" msgstr "贊助" -#: sponsors/models.py:118 +#: sponsors/models.py:124 msgid "open role name" msgstr "職缺名稱" -#: sponsors/models.py:123 +#: sponsors/models.py:129 msgid "open role description" msgstr "職缺說明" -#: sponsors/models.py:127 +#: sponsors/models.py:133 msgid "open role requirements" msgstr "職缺需求" -#: sponsors/models.py:132 +#: sponsors/models.py:138 msgid "open role URL" msgstr "職缺 URL" -#: sponsors/models.py:137 +#: sponsors/models.py:143 msgid "open role" msgstr "職缺" -#: sponsors/models.py:138 +#: sponsors/models.py:144 msgid "open roles" msgstr "職缺" diff --git a/src/sponsors/admin.py b/src/sponsors/admin.py index 90468743a..7bc1744a9 100644 --- a/src/sponsors/admin.py +++ b/src/sponsors/admin.py @@ -7,7 +7,7 @@ @admin.register(Sponsor) class SponsorAdmin(TranslationAdmin): fields = [ - 'name', 'level', 'website_url', 'intro', 'subtitle', + 'name', 'level', 'is_shown', 'website_url', 'intro', 'subtitle', 'logo_svg', 'logo_image', 'order' ] list_display = ['name', 'level', 'order'] diff --git a/src/sponsors/api/views.py b/src/sponsors/api/views.py index 022ddd959..34142d59b 100644 --- a/src/sponsors/api/views.py +++ b/src/sponsors/api/views.py @@ -20,6 +20,9 @@ def get(self, request): if sponsor.level_en_name not in level_dict: level_dict[sponsor.level_en_name] = [] + if sponsor.is_shown is False: + continue + level_dict[sponsor.level_en_name].append({ "name_en_us": sponsor.name_en_us, "name_zh_hant": sponsor.name_zh_hant, diff --git a/src/sponsors/migrations/0033_sponsor_is_shown.py b/src/sponsors/migrations/0033_sponsor_is_shown.py new file mode 100644 index 000000000..39d4d12b9 --- /dev/null +++ b/src/sponsors/migrations/0033_sponsor_is_shown.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.25 on 2024-06-02 09:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sponsors', '0032_fix_verbose_typo'), + ] + + operations = [ + migrations.AddField( + model_name='sponsor', + name='is_shown', + field=models.BooleanField(default=False, verbose_name='is shown'), + ), + ] diff --git a/src/sponsors/models.py b/src/sponsors/models.py index 9691af375..d10401a16 100644 --- a/src/sponsors/models.py +++ b/src/sponsors/models.py @@ -23,6 +23,12 @@ class Sponsor(ConferenceRelated): verbose_name=_('name'), max_length=100, ) + + is_shown = models.BooleanField( + verbose_name=_('is shown'), + default=False, + ) + website_url = models.URLField( verbose_name=_('website URL'), max_length=255, blank=True, diff --git a/src/sponsors/tests/test_api.py b/src/sponsors/tests/test_api.py index 169188988..374354ccb 100644 --- a/src/sponsors/tests/test_api.py +++ b/src/sponsors/tests/test_api.py @@ -6,12 +6,13 @@ @pytest.fixture(autouse=True, scope='function') def test_data(): # sponsors - # platinum - sponsor_1 = Sponsor.objects.create(name='1', level=1) - # gold - sponsor_2 = Sponsor.objects.create(name='2', level=2, order=2) - sponsor_3 = Sponsor.objects.create(name='3', level=2, order=None) # noqa - sponsor_4 = Sponsor.objects.create(name='4', level=2, order=1) # noqa + # # platinum + sponsor_1 = Sponsor.objects.create(name='1', level=1, is_shown=True) + # # gold + sponsor_2 = Sponsor.objects.create(name='2', level=2, order=2, is_shown=True) + sponsor_3 = Sponsor.objects.create(name='3', level=2, order=None, is_shown=True) # noqa + sponsor_4 = Sponsor.objects.create(name='4', level=2, order=1, is_shown=True) # noqa + sponsor_5 = Sponsor.objects.create(name='5', level=2, order=3, is_shown=False) # noqa # roles OpenRole.objects.create(sponsor=sponsor_1, name='11', description='...')