This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1030 from kawazrepos/improve-project-admin
Improve project admin
- Loading branch information
Showing
2 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
from django.contrib import admin | ||
from django.utils.translation import ugettext_lazy as _ | ||
from .models import Category, Project | ||
|
||
|
||
class CategoryAdmin(admin.ModelAdmin): | ||
pass | ||
admin.site.register(Category, CategoryAdmin) | ||
|
||
|
||
class ProjectAdmin(admin.ModelAdmin): | ||
list_display = ('title', 'get_status_display', 'administrator_nickname', 'created_at', 'updated_at') | ||
list_display = ('title', 'get_status_display', 'administrator_nickname', 'created_at', 'updated_at', 'is_legacy') | ||
|
||
def administrator_nickname(self, obj): | ||
@staticmethod | ||
def administrator_nickname(obj): | ||
return obj.administrator.nickname | ||
administrator_nickname.short_description = _("Administrator's nickname") | ||
|
||
@staticmethod | ||
def is_legacy(obj): | ||
return obj.is_legacy | ||
is_legacy.short_description = _('Burned') | ||
|
||
search_fields = ('title', 'body', 'administrator__username', 'administrator__nickname', 'category__label',) | ||
admin.site.register(Project, ProjectAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters