1from django.contrib import admin
2from myapp.models import Article
3
4def make_published(modeladmin, request, queryset):
5 queryset.update(status='p')
6make_published.short_description = "Mark selected stories as published"
7
8class ArticleAdmin(admin.ModelAdmin):
9 list_display = ['title', 'status']
10 ordering = ['title']
11 actions = [make_published]
12
13admin.site.register(Article, ArticleAdmin)
1# Add this code to admin.py
2#example : Published Article
3def make_published(modeladmin, request, queryset):
4 queryset.update(status='p')
5make_published.short_description = "Mark selected stories as published"