feat(contacts): store contact submissions
This commit is contained in:
56
apps/contacts/admin.py
Normal file
56
apps/contacts/admin.py
Normal file
@@ -0,0 +1,56 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from apps.contacts.models import ContactSubmission
|
||||
from core.admins.base import BaseAdmin, SoftDeleteListFilter
|
||||
|
||||
|
||||
@admin.register(ContactSubmission)
|
||||
class ContactSubmissionAdmin(BaseAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"full_name",
|
||||
"email",
|
||||
"mobile",
|
||||
"status",
|
||||
"created_at",
|
||||
"is_deleted",
|
||||
)
|
||||
list_filter = (
|
||||
SoftDeleteListFilter,
|
||||
"status",
|
||||
"created_at",
|
||||
)
|
||||
search_fields = (
|
||||
"first_name",
|
||||
"last_name",
|
||||
"email",
|
||||
"mobile",
|
||||
"message",
|
||||
)
|
||||
readonly_fields = (
|
||||
"id",
|
||||
"ip_address",
|
||||
"user_agent",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
)
|
||||
fields = (
|
||||
"first_name",
|
||||
"last_name",
|
||||
"email",
|
||||
"mobile",
|
||||
"message",
|
||||
"status",
|
||||
"ip_address",
|
||||
"user_agent",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
)
|
||||
|
||||
@admin.display(description="Full name")
|
||||
def full_name(self, obj):
|
||||
return f"{obj.first_name} {obj.last_name}".strip()
|
||||
Reference in New Issue
Block a user