adminka togirlandi
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
from django.contrib import admin
|
||||
from unfold.admin import ModelAdmin # noqa
|
||||
|
||||
from apps.geology.models import Category
|
||||
|
||||
|
||||
@admin.register(Category)
|
||||
class CategoryAdmin(ModelAdmin):
|
||||
class CategoryAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "created_at", "updated_at")
|
||||
search_fields = ("name",)
|
||||
list_filter = ("created_at", "updated_at")
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from unfold.admin import ModelAdmin
|
||||
|
||||
from apps.geology.models import GalleryCategory, Gallery
|
||||
|
||||
|
||||
@admin.register(GalleryCategory)
|
||||
class GalleryCategoryAdmin(ModelAdmin):
|
||||
class GalleryCategoryAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "name", "created_at", "updated_at")
|
||||
search_fields = ("name",)
|
||||
filter_horizontal = ("gallery",)
|
||||
list_filter = ("created_at", "updated_at")
|
||||
exclude = ("count",)
|
||||
|
||||
|
||||
@admin.register(Gallery)
|
||||
class GalleryAdmin(ModelAdmin):
|
||||
class GalleryAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "name", "created_at", "updated_at")
|
||||
search_fields = ("name",)
|
||||
list_filter = ("created_at", "updated_at")
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from django.contrib import admin
|
||||
from unfold.admin import ModelAdmin # noqa
|
||||
|
||||
from apps.geology.models import Geology
|
||||
|
||||
|
||||
@admin.register(Geology)
|
||||
class GeologyAdmin(ModelAdmin):
|
||||
class GeologyAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "category", "created_at", "updated_at")
|
||||
search_fields = ("name", "title", "body1", "body2", "body3")
|
||||
list_filter = ("category", "created_at", "updated_at")
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
from django.contrib import admin
|
||||
from unfold.admin import ModelAdmin # noqa
|
||||
|
||||
from apps.geology.models import Photo
|
||||
|
||||
|
||||
@admin.register(Photo)
|
||||
class PhotoAdmin(ModelAdmin):
|
||||
class PhotoAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "description", "type", "size", "image", "created_at")
|
||||
search_fields = ("name", "description", "type", "size", "image")
|
||||
list_filter = ("type",)
|
||||
|
||||
@@ -1,33 +1 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from django.contrib.auth.models import Group, User
|
||||
from unfold.admin import ModelAdmin # noqa
|
||||
from unfold.forms import (
|
||||
UserChangeForm,
|
||||
UserCreationForm,
|
||||
AdminPasswordChangeForm,
|
||||
) # noqa
|
||||
|
||||
admin.site.unregister(Group)
|
||||
admin.site.unregister(User)
|
||||
|
||||
|
||||
@admin.register(Group)
|
||||
class GroupAdmin(BaseGroupAdmin, ModelAdmin):
|
||||
list_display = ("name",)
|
||||
search_fields = ("name",)
|
||||
filter_vertical = ("permissions",)
|
||||
|
||||
|
||||
@admin.register(User)
|
||||
class UserAdmin(BaseUserAdmin, ModelAdmin):
|
||||
change_password_form = AdminPasswordChangeForm
|
||||
add_form = UserCreationForm
|
||||
form = UserChangeForm
|
||||
list_display = ("username", "email", "is_active", "is_staff", "is_superuser")
|
||||
list_filter = ("is_active", "is_staff", "is_superuser")
|
||||
search_fields = ("username", "email")
|
||||
ordering = ("username",)
|
||||
list_editable = ("is_active", "is_staff", "is_superuser")
|
||||
filter_vertical = ("groups", "user_permissions")
|
||||
|
||||
Reference in New Issue
Block a user