Skip to content

Commit

Permalink
kodilan-com#9 issue is solved
Browse files Browse the repository at this point in the history
  • Loading branch information
tamert committed Jun 6, 2020
1 parent 928dacf commit 76bb56a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions posts/admin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
from django.contrib import admin

from .models import Company, Post, Tag
from django.utils.html import format_html
from django.urls import reverse


def make_published(modeladmin, request, queryset):
queryset.update(status=1)


def make_unpublished(modeladmin, request, queryset):
queryset.update(status=2)


def make_disapproved(modeladmin, request, queryset):
queryset.update(status=0)


make_unpublished.short_description = "Mark posts stories as unpublished"
make_published.short_description = "Mark posts stories as published"
make_disapproved.short_description = "Mark posts stories as disapproved"


class PostAdmin(admin.ModelAdmin):
list_display = ('id', 'slug', 'position', 'detail', 'location', 'status', 'pub_date')
list_filter = ('status', 'position')
actions = [make_published, make_unpublished, make_disapproved]


admin.site.register(Company)
Expand Down

0 comments on commit 76bb56a

Please sign in to comment.