mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-01-19 01:23:02 +08:00
26 lines
721 B
Python
26 lines
721 B
Python
from django.contrib import admin
|
|
from unfold.admin import ModelAdmin
|
|
from .models import DocumentRequestUnit, DocumentRequest
|
|
from unfold.contrib.filters.admin import RangeDateFilter
|
|
|
|
# Register your models here.
|
|
|
|
|
|
@admin.register(DocumentRequestUnit)
|
|
class DocumentRequestUnitAdmin(ModelAdmin):
|
|
search_fields = ["id"]
|
|
list_display = ["id", "get_document_title", "copies"]
|
|
|
|
def get_document_title(self, obj):
|
|
return obj.document.name
|
|
|
|
get_document_title.short_description = "Document"
|
|
|
|
|
|
@admin.register(DocumentRequest)
|
|
class DocumentRequestAdmin(ModelAdmin):
|
|
list_filter = [
|
|
("date_requested", RangeDateFilter),
|
|
]
|
|
|
|
list_display = ["id", "date_requested", "status", "college"]
|