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 533bc8e
Show file tree
Hide file tree
Showing 3 changed files with 21 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
15 changes: 12 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,26 @@
from typing import Any
from typing import TYPE_CHECKING, Any

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:
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
5 changes: 5 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,14 @@
from django.utils.translation import gettext_lazy as _

from wagtail_bynder import get_video_model

from .base import BaseBynderSyncCommand


class Command(BaseBynderSyncCommand):
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 533bc8e

Please sign in to comment.