Django Admin Attributes - 2

Bu eğitimimizde Django admin attributes konusuna devam ettik.

@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
    list_display = ("title","created_date","modified_date")
    list_display_links = ("title",)
    list_filter = ("created_date",)
    list_per_page = 100
    search_fields = ("author",)
    search_help_text = "title alanına göre arama işlemi yapabilrisiniz"
    save_on_top = True
    readonly_fields = ("created_date","modified_date")
    autocomplete_fields = ("author",)
    ordering = ("created_date",)

    def update_title(self,request,queryset):
        queryset.update(title="aaaaaaaaaaaaaaaaaa")

    actions = [update_title]

admin.site.register(Category)


@admin.register(Kullanici)
class KullaniciAdmin(admin.ModelAdmin):
    search_fields = ("first_name",)

 


Yorumlar

    Henüz Hiç Yorum Yapılmamış

Yorum Yap