Download apps/evidence/admin/hearing_note_admin.py from jun2024/fc: direct link, hf CLI and curl.
- Browser
- Download file 944 Bytes
-
https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/evidence/admin/hearing_note_admin.py
- Command line
-
hf download hf://spaces/jun2024/fc/apps/evidence/admin/hearing_note_admin.py
-
curl -L -o hearing_note_admin.py https://huggingface.co/spaces/jun2024/fc/resolve/main/apps/evidence/admin/hearing_note_admin.py
944 Bytes
| """庭审笔记 Admin""" | |
| from typing import Any, ClassVar | |
| from django.contrib import admin | |
| from django.utils.translation import gettext_lazy as _ | |
| from apps.evidence.models import HearingNote | |
| class HearingNoteAdmin(admin.ModelAdmin): # type: ignore[type-arg] | |
| list_display: ClassVar = ("case", "content_short", "evidence_count", "created_at") | |
| list_filter: ClassVar = ("case",) | |
| search_fields: ClassVar = ("content", "case__name") | |
| autocomplete_fields: ClassVar = ("case",) | |
| filter_horizontal: ClassVar = ("evidence_items",) | |
| ordering: ClassVar = ["-created_at"] | |
| def content_short(self, obj: HearingNote) -> str: | |
| return obj.content[:50] + "..." if len(obj.content) > 50 else obj.content | |
| def evidence_count(self, obj: HearingNote) -> int: | |
| return obj.evidence_items.count() | |