adding
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Appointment, Customer, LedgerEntry, Product, StockMovement
|
||||
|
||||
|
||||
@admin.register(Customer)
|
||||
class CustomerAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "phone", "user", "updated_at")
|
||||
search_fields = ("name", "phone", "email", "user__phone")
|
||||
|
||||
|
||||
@admin.register(LedgerEntry)
|
||||
class LedgerEntryAdmin(admin.ModelAdmin):
|
||||
list_display = ("title", "entry_type", "amount", "entry_date", "user")
|
||||
list_filter = ("entry_type", "category")
|
||||
search_fields = ("title", "user__phone")
|
||||
|
||||
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "sku", "category", "quantity", "unit_price", "user")
|
||||
list_filter = ("category",)
|
||||
search_fields = ("name", "sku", "user__phone")
|
||||
|
||||
|
||||
@admin.register(StockMovement)
|
||||
class StockMovementAdmin(admin.ModelAdmin):
|
||||
list_display = ("product", "delta", "quantity_after", "created_at")
|
||||
search_fields = ("product__name", "product__user__phone")
|
||||
readonly_fields = ("product", "delta", "quantity_after", "note", "created_at")
|
||||
|
||||
def has_add_permission(self, request):
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(Appointment)
|
||||
class AppointmentAdmin(admin.ModelAdmin):
|
||||
list_display = ("customer_name", "title", "start_at", "status", "user")
|
||||
list_filter = ("status",)
|
||||
search_fields = ("customer_name", "customer_phone", "user__phone")
|
||||
Reference in New Issue
Block a user