You've already forked hotpocket
BTHLABS-66: Prepping for public release: Take four
Apple gonna Apple... ;)
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from . import association # noqa: F401
|
||||
from . import save # noqa: F401
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
from django.contrib import admin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from hotpocket_backend.apps.saves.models import Association
|
||||
|
||||
|
||||
class AssociationAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'pk', 'account_uuid', 'target', 'created_at', 'render_is_active',
|
||||
)
|
||||
search_fields = ('pk', 'account_uuid')
|
||||
fields = (
|
||||
'pk',
|
||||
'account_uuid',
|
||||
'archived_at',
|
||||
'starred_at',
|
||||
'target_meta',
|
||||
'target_title',
|
||||
'target_description',
|
||||
'created_at',
|
||||
'deleted_at',
|
||||
)
|
||||
readonly_fields = (
|
||||
'pk',
|
||||
'account_uuid',
|
||||
'target_meta',
|
||||
'target',
|
||||
'archived_at',
|
||||
'starred_at',
|
||||
'created_at',
|
||||
'deleted_at',
|
||||
)
|
||||
ordering = ['-created_at']
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
return request.user.is_superuser
|
||||
|
||||
@admin.display(
|
||||
description=_('Is Active?'), boolean=True, ordering='-deleted_at',
|
||||
)
|
||||
def render_is_active(self, obj: Association | None = None) -> bool | None:
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
return obj.is_active
|
||||
|
||||
|
||||
admin.site.register(Association, AssociationAdmin)
|
||||
@@ -11,6 +11,26 @@ class SaveAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'pk', 'key', 'account_uuid', 'created_at', 'render_is_active',
|
||||
)
|
||||
search_fields = ('pk', 'account_uuid', 'url')
|
||||
fields = (
|
||||
'pk',
|
||||
'account_uuid',
|
||||
'key',
|
||||
'url',
|
||||
'title',
|
||||
'description',
|
||||
'last_processed_at',
|
||||
'is_netloc_banned',
|
||||
'created_at',
|
||||
'deleted_at',
|
||||
)
|
||||
readonly_fields = (
|
||||
'pk',
|
||||
'account_uuid',
|
||||
'key',
|
||||
'created_at',
|
||||
'deleted_at',
|
||||
)
|
||||
ordering = ['-created_at']
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
|
||||
Reference in New Issue
Block a user