mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-01-19 09:33:01 +08:00
27 lines
774 B
Python
27 lines
774 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.documents.title # Assuming the Document model has a 'title' field
|
||
|
|
||
|
get_document_title.short_description = "Document"
|
||
|
|
||
|
|
||
|
@admin.register(DocumentRequest)
|
||
|
class DocumentRequestAdmin(ModelAdmin):
|
||
|
list_filter = [
|
||
|
("date_requested", RangeDateFilter),
|
||
|
]
|
||
|
|
||
|
list_display = ["id", "date_requested", "status", "college"]
|