# Path: content_gallery/admin.py
# class ImageAdminInline(GenericInlineModelAdmin):
#     """
#     Inline model admin of Image that could be added to related models.
#     Adds to admin page a collection of images related to the object.
#     """
#     model = models.Image
#     form = forms.ImageAdminInlineForm
#     template = "content_gallery/admin/image_admin_inline.html"
#     extra = 0
# 
#     class Media:
#         js = (
#             utils.create_static_url(
#                 "content_gallery/js/content-gallery-view.js"
#             ),
#             utils.create_static_url(
#                 "content_gallery/admin/js/content-gallery-admin-view.js"
#             ),
#             utils.create_static_url(
#                 "content_gallery/admin/js/content-gallery-inline-admin.js"
#             ),
#         )
#         css = {
#             "all": (
#                 utils.create_static_url(
#                     "content_gallery/css/content-gallery.css"
#                 ),
#                 utils.create_static_url(
#                     "content_gallery/admin/css/content-gallery-admin.css"
#                 ),
#                 utils.create_static_url(
#                     "content_gallery/admin/css/"
#                     "content-gallery-inline-admin.css"
#                 ),
#             )
#         }
# 
#     def get_queryset(self, request):
#         """
#         Returns a collection of Image objects ordered by 'position' value.
#         """
#         qs = super().get_queryset(request)
#         return qs.order_by('position')
# 
#     def get_formset(self, request, obj=None, **kwargs):
#         """
#         Adds 'preview_url_pattern' attribute to the formset object.
#         The attribute contains the pattern of URL used by JavaScript code
#         to get data of new added image to show its preview.
#         """
#         formset = super().get_formset(request, obj, **kwargs)
#         url = utils.get_admin_new_image_preview_url_pattern()
#         setattr(formset, 'preview_url_pattern', url)
#         return formset


from django.contrib import admin
from content_gallery.admin import ImageAdminInline
from . import models



# add ImageAdminInline inline that allows to manage
# related images on the Cat admin page (add, remove, sort)

class CatAdmin(admin.ModelAdmin):
    inlines = [
        ImageAdminInline,
    ]


# Path: content_gallery/admin.py
# class ImageAdminInline(GenericInlineModelAdmin):
#     """
#     Inline model admin of Image that could be added to related models.
#     Adds to admin page a collection of images related to the object.
#     """
#     model = models.Image
#     form = forms.ImageAdminInlineForm
#     template = "content_gallery/admin/image_admin_inline.html"
#     extra = 0
# 
#     class Media:
#         js = (
#             utils.create_static_url(
#                 "content_gallery/js/content-gallery-view.js"
#             ),
#             utils.create_static_url(
#                 "content_gallery/admin/js/content-gallery-admin-view.js"
#             ),
#             utils.create_static_url(
#                 "content_gallery/admin/js/content-gallery-inline-admin.js"
#             ),
#         )
#         css = {
#             "all": (
#                 utils.create_static_url(
#                     "content_gallery/css/content-gallery.css"
#                 ),
#                 utils.create_static_url(
#                     "content_gallery/admin/css/content-gallery-admin.css"
#                 ),
#                 utils.create_static_url(
#                     "content_gallery/admin/css/"
#                     "content-gallery-inline-admin.css"
#                 ),
#             )
#         }
# 
#     def get_queryset(self, request):
#         """
#         Returns a collection of Image objects ordered by 'position' value.
#         """
#         qs = super().get_queryset(request)
#         return qs.order_by('position')
# 
#     def get_formset(self, request, obj=None, **kwargs):
#         """
#         Adds 'preview_url_pattern' attribute to the formset object.
#         The attribute contains the pattern of URL used by JavaScript code
#         to get data of new added image to show its preview.
#         """
#         formset = super().get_formset(request, obj, **kwargs)
#         url = utils.get_admin_new_image_preview_url_pattern()
#         setattr(formset, 'preview_url_pattern', url)
#         return formset


# Path: content_gallery_testapp/testapp/admin.py
from django.contrib import admin
from content_gallery.admin import ImageAdminInline
from . import models




# add ImageAdminInline inline that allows to manage
# related images on the Cat admin page (add, remove, sort)

class CatAdmin(admin.ModelAdmin):
    inlines = [
        ImageAdminInline,
    ]


admin.site.register(models.Cat, CatAdmin)