list filter and search fields
This commit is contained in:
@@ -25,8 +25,8 @@ class UserAdmin(BaseUserAdmin, ModelAdmin, ImportExportModelAdmin):
|
||||
filter_horizontal = []
|
||||
ordering = []
|
||||
inlines = [UserAddressInLine]
|
||||
list_filter = []
|
||||
search_fields = ['phone', 'first_name', 'last_name', 'full_name', 'email']
|
||||
list_filter = ['is_superuser']
|
||||
search_fields = ['phone', 'first_name', 'last_name', 'email']
|
||||
list_display = ['full_name_display', 'phone', 'email', 'is_superuser', ]
|
||||
readonly_fields = []
|
||||
|
||||
@@ -63,7 +63,6 @@ class UserAdmin(BaseUserAdmin, ModelAdmin, ImportExportModelAdmin):
|
||||
admin.site.unregister(Group)
|
||||
from django.contrib import admin
|
||||
from rest_framework_simplejwt.token_blacklist.models import BlacklistedToken, OutstandingToken
|
||||
# Unregister the BlacklistedToken and OutstandingToken models
|
||||
admin.site.unregister(BlacklistedToken)
|
||||
admin.site.unregister(OutstandingToken)
|
||||
|
||||
@@ -72,11 +71,10 @@ admin.site.unregister(OutstandingToken)
|
||||
class AddressAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
search_fields = ['address', 'name', 'city', 'province']
|
||||
list_display = ['user', 'name', 'address_display', 'postal_code', 'city', 'province', 'for_me']
|
||||
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
formfield_overrides = {
|
||||
models.TextField: {
|
||||
"widget": WysiwygWidget,
|
||||
|
||||
@@ -12,7 +12,8 @@ from django.contrib.postgres.fields import ArrayField
|
||||
class BlogModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
|
||||
search_fields = ['title', 'content', 'summery', ]
|
||||
list_filter = ['category', 'is_published', 'author']
|
||||
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.contrib.postgres.fields import ArrayField
|
||||
class SliderAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
|
||||
search_fields = ['description', 'title']
|
||||
|
||||
compressed_fields = False
|
||||
warn_unsaved_form = True
|
||||
|
||||
@@ -24,6 +24,8 @@ class OrderItemModelInline(TabularInline):
|
||||
class OrderAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
|
||||
list_filter = ['is_paid', 'status']
|
||||
|
||||
list_display = ['user', 'is_paid', 'status', 'discount_code', 'address']
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ class ProductModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
export_form_class = ExportForm
|
||||
inlines = [InStuckColorsInLine]
|
||||
readonly_fields = ('slug', )
|
||||
search_fields = ['name']
|
||||
search_fields = ['name', 'description', ]
|
||||
list_filter = ['currency', 'show', 'category']
|
||||
autocomplete_fields = ['related_products']
|
||||
# compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
@@ -81,7 +82,7 @@ class MainCategoryModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
export_form_class = ExportForm
|
||||
list_display = ['name', ]
|
||||
readonly_fields = ('slug', )
|
||||
|
||||
search_fields = ['name', 'slug']
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
@@ -95,6 +96,9 @@ class MainCategoryModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
class SubCategoryModelAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
list_display = ['name', 'parent', 'show']
|
||||
|
||||
search_fields = ['name', 'slug']
|
||||
list_filter = ['parent', 'show', ]
|
||||
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
|
||||
@@ -114,7 +118,8 @@ class CommentAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
list_display = ['user', 'product', 'display_content','show']
|
||||
|
||||
search_fields = ['content',]
|
||||
list_filter = ['show',]
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ class TicketAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
|
||||
search_fields = ['subject',]
|
||||
list_filter = ['status']
|
||||
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
@@ -34,7 +36,7 @@ class MessageAdmin(ModelAdmin, ImportExportModelAdmin):
|
||||
import_form_class = ImportForm
|
||||
export_form_class = ExportForm
|
||||
list_display = ['ticket', 'sender', 'content_display','created_at']
|
||||
|
||||
search_fields = ['content', ]
|
||||
compressed_fields = True
|
||||
warn_unsaved_form = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user