34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from django.contrib import admin
|
|
from .models import ContactEditLog, ContactGroup, CustomerProfile
|
|
|
|
|
|
@admin.register(ContactGroup)
|
|
class ContactGroupAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "unit", "is_active", "updated_at")
|
|
list_filter = ("unit", "is_active")
|
|
search_fields = ("name", "description")
|
|
|
|
|
|
@admin.register(CustomerProfile)
|
|
class CustomerProfileAdmin(admin.ModelAdmin):
|
|
list_display = ("user", "stakeholder_type", "organization_name", "first_name", "last_name", "login_blocked")
|
|
list_filter = ("stakeholder_type", "groups", "login_blocked")
|
|
search_fields = ("user__mobile", "organization_name", "first_name", "last_name")
|
|
filter_horizontal = ("groups",)
|
|
|
|
|
|
@admin.register(ContactEditLog)
|
|
class ContactEditLogAdmin(admin.ModelAdmin):
|
|
list_display = ("contact_public_id", "actor_name", "created_at")
|
|
search_fields = ("actor_name", "contact_public_id")
|
|
readonly_fields = ("contact", "contact_public_id", "actor", "actor_name", "changes", "created_at")
|
|
|
|
def has_add_permission(self, request):
|
|
return False
|
|
|
|
def has_change_permission(self, request, obj=None):
|
|
return False
|
|
|
|
def has_delete_permission(self, request, obj=None):
|
|
return False
|