Skip to content

Commit

Permalink
Add 'help' to existing management commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ababic committed Apr 4, 2024
1 parent 54f105e commit 64afe0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from django.utils.translation import gettext_lazy as _
from wagtail.documents import get_document_model

from .base import BaseBynderSyncCommand


class Command(BaseBynderSyncCommand):
help = _(
"Update stale Wagtail document library items to reflect recent asset changes in Bynder."
)
model = get_document_model()
bynder_asset_type: str = "document"
page_size: int = 200
14 changes: 11 additions & 3 deletions src/wagtail_bynder/management/commands/update_stale_images.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from typing import Any
from typing import Any, TYPE_CHECKING

from django.utils.translation import gettext_lazy as _
from wagtail.images import get_image_model
from wagtail.images.models import AbstractImage

from .base import BaseBynderSyncCommand

if TYPE_CHECKING:

Check failure on line 8 in src/wagtail_bynder/management/commands/update_stale_images.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

wagtail_bynder/management/commands/update_stale_images.py:1:1: I001 Import block is un-sorted or un-formatted
from wagtail_bynder.models import BynderAssetMixin


class Command(BaseBynderSyncCommand):
help = _(
"Update stale Wagtail image library items to reflect recent asset updates in Bynder."
)
model = get_image_model()
bynder_asset_type: str = "image"
page_size: int = 200

def update_object(self, obj: AbstractImage, asset_data: dict[str, Any]) -> None:
def update_object(
self, obj: "BynderAssetMixin", asset_data: dict[str, Any]
) -> None:
"""
Overrides `BaseBynderSyncCommand.update_object()` to fetch the
complete asset details before handing off to `obj.update_from_asset_data()`.
Expand Down
2 changes: 2 additions & 0 deletions src/wagtail_bynder/management/commands/update_stale_videos.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.utils.translation import gettext_lazy as _
from wagtail_bynder import get_video_model

from .base import BaseBynderSyncCommand


class Command(BaseBynderSyncCommand):

Check failure on line 7 in src/wagtail_bynder/management/commands/update_stale_videos.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

wagtail_bynder/management/commands/update_stale_videos.py:1:1: I001 Import block is un-sorted or un-formatted
help = _("Update stale Wagtail video library items to reflect recent asset updates in Bynder.")
model = get_video_model()
bynder_asset_type: str = "video"
page_size: int = 200

0 comments on commit 64afe0d

Please sign in to comment.