Skip to content

Commit

Permalink
Merge pull request #16 from OVINC-CN/feat_app
Browse files Browse the repository at this point in the history
feat(application): support to hide apps
  • Loading branch information
OrenZhang authored Nov 20, 2024
2 parents d548a4f + 663c547 commit db8aa87
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
18 changes: 18 additions & 0 deletions apps/application/migrations/0003_application_is_hidden.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# pylint: disable=C0103
# Generated by Django 4.2.16 on 2024-11-20 12:20

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("application", "0002_application_app_desc"),
]

operations = [
migrations.AddField(
model_name="application",
name="is_hidden",
field=models.BooleanField(default=False, verbose_name="Is Hidden"),
),
]
1 change: 1 addition & 0 deletions apps/application/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Application(SoftDeletedModel):
app_url = models.URLField(gettext_lazy("App Url"), null=True, blank=True)
app_logo = models.URLField(gettext_lazy("App Logo"), null=True, blank=True)
app_desc = models.TextField(gettext_lazy("App Desc"), null=True, blank=True)
is_hidden = models.BooleanField(gettext_lazy("Is Hidden"), default=False)

objects = ApplicationObjects()

Expand Down
3 changes: 1 addition & 2 deletions apps/application/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from channels.db import database_sync_to_async
from django.contrib.auth import get_user_model
from ovinc_client.core.auth import SessionAuthenticate
from ovinc_client.core.viewsets import MainViewSet
Expand Down Expand Up @@ -30,7 +29,7 @@ async def all(self, request, *args, **kwargs):
"""

# filter
queryset = await database_sync_to_async(Application.get_queryset)()
queryset = Application.get_queryset().filter(is_hidden=False)

# response
serializer = ApplicationListSerializer(queryset, many=True)
Expand Down
5 changes: 4 additions & 1 deletion locale/zh_Hans/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: 2024-07-26 15:46+0800\n"
"POT-Creation-Date: 2024-11-20 20:41+0800\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 Down Expand Up @@ -188,6 +188,9 @@ msgstr "应用图标"
msgid "App Desc"
msgstr "应用描述"

msgid "Is Hidden"
msgstr "是否隐藏"

msgid "Manager"
msgstr "管理员"

Expand Down

0 comments on commit db8aa87

Please sign in to comment.