78 lines
2.0 KiB
Python
78 lines
2.0 KiB
Python
from utils.admin_base import CRMModelAdmin
|
|
from django.contrib import admin
|
|
from apps.customer.models import (
|
|
MobileConflict,
|
|
Customer as CustomerModel,
|
|
CustomerNote as CustomerNoteModel,
|
|
ShiveAshenaei as ShiveAshenaeiModel,
|
|
ResponsibleGroup as ResponsibleGroupModel,
|
|
CustomerResponsible as CustomerResponsibleModel,
|
|
CustomerGroupType as CustomerGroupTypeModel,
|
|
CustomerGroup as CustomerGroupModel,
|
|
)
|
|
# Register your models here.
|
|
|
|
|
|
@admin.register(MobileConflict)
|
|
class MobileConflictAdmin(CRMModelAdmin):
|
|
list_display = ('source_model', 'record_id', 'workspace_id', 'original_mobile', 'canonical_mobile', 'created_at')
|
|
list_filter = ('source_model', 'workspace_id')
|
|
search_fields = ('=record_id', '=original_mobile', '=canonical_mobile')
|
|
readonly_fields = ('source_model', 'record_id', 'workspace_id', 'original_mobile', 'canonical_mobile', 'snapshot', '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
|
|
|
|
|
|
class CustomerNoteInline(admin.TabularInline):
|
|
model = CustomerNoteModel
|
|
extra = 0
|
|
fields = ["desc","cuser_role","created_at"]
|
|
readonly_fields = fields
|
|
can_delete = False
|
|
show_change_link = True
|
|
|
|
def has_add_permission(self, request, obj=None):
|
|
return False
|
|
|
|
|
|
@admin.register(CustomerModel)
|
|
class CustomerAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(CustomerNoteModel)
|
|
class CustomerNoteAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(ShiveAshenaeiModel)
|
|
class ShiveAshenaeiAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(ResponsibleGroupModel)
|
|
class ResponsibleGroupAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(CustomerResponsibleModel)
|
|
class CustomerResponsibleAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(CustomerGroupTypeModel)
|
|
class CustomerGroupTypeAdmin(CRMModelAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(CustomerGroupModel)
|
|
class CustomerGroupAdmin(CRMModelAdmin):
|
|
pass
|