Improving admin

remotes/origin/enhancement/email-actions
Alejandro Alonso 2015-08-18 10:49:05 +02:00 committed by David Barragán Merino
parent 3492b46cc9
commit 3111cf79eb
9 changed files with 73 additions and 6 deletions

View File

@ -17,7 +17,10 @@
from django.contrib import admin
from taiga.projects.milestones.admin import MilestoneInline
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from taiga.users.admin import RoleInline
from . import models
class MembershipAdmin(admin.ModelAdmin):
@ -35,7 +38,7 @@ class ProjectAdmin(admin.ModelAdmin):
list_display = ["name", "owner", "created_date", "total_milestones",
"total_story_points"]
list_display_links = list_display
inlines = [RoleInline, MembershipInline, MilestoneInline]
inlines = [RoleInline, MembershipInline, MilestoneInline, WatchedInline, VoteInline]
def get_object(self, *args, **kwargs):
self.obj = super().get_object(*args, **kwargs)

View File

@ -17,13 +17,16 @@
from django.contrib import admin
from taiga.projects.attachments.admin import AttachmentInline
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from . import models
class IssueAdmin(admin.ModelAdmin):
list_display = ["project", "milestone", "ref", "subject",]
list_display_links = ["ref", "subject",]
# inlines = [AttachmentInline]
inlines = [WatchedInline, VoteInline]
def get_object(self, *args, **kwargs):
self.obj = super().get_object(*args, **kwargs)

View File

@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from . import models
@ -30,6 +32,7 @@ class MilestoneAdmin(admin.ModelAdmin):
list_display_links = list_display
list_filter = ["project"]
readonly_fields = ["owner"]
inlines = [WatchedInline, VoteInline]
admin.site.register(models.Milestone, MilestoneAdmin)

View File

@ -0,0 +1,25 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from . import models
class WatchedInline(GenericTabularInline):
model = models.Watched
extra = 0

View File

@ -17,6 +17,9 @@
from django.contrib import admin
from taiga.projects.attachments.admin import AttachmentInline
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from . import models
@ -24,7 +27,7 @@ class TaskAdmin(admin.ModelAdmin):
list_display = ["project", "milestone", "user_story", "ref", "subject",]
list_display_links = ["ref", "subject",]
list_filter = ["project"]
# inlines = [AttachmentInline]
inlines = [WatchedInline, VoteInline]
def get_object(self, *args, **kwargs):
self.obj = super().get_object(*args, **kwargs)

View File

@ -17,6 +17,8 @@
from django.contrib import admin
from taiga.projects.attachments.admin import AttachmentInline
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from . import models
@ -41,7 +43,7 @@ class UserStoryAdmin(admin.ModelAdmin):
list_display = ["project", "milestone", "ref", "subject",]
list_display_links = ["ref", "subject",]
list_filter = ["project"]
inlines = [RolePointsInline]
inlines = [RolePointsInline, WatchedInline, VoteInline]
def get_object(self, *args, **kwargs):
self.obj = super().get_object(*args, **kwargs)

View File

@ -0,0 +1,25 @@
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from . import models
class VoteInline(GenericTabularInline):
model = models.Vote
extra = 0

View File

@ -63,4 +63,4 @@ class Vote(models.Model):
return None
def __str__(self):
return self.user
return self.user.get_full_name()

View File

@ -17,6 +17,9 @@
from django.contrib import admin
from taiga.projects.attachments.admin import AttachmentInline
from taiga.projects.notifications.admin import WatchedInline
from taiga.projects.votes.admin import VoteInline
from taiga.projects.wiki.models import WikiPage
from . import models
@ -24,7 +27,7 @@ from . import models
class WikiPageAdmin(admin.ModelAdmin):
list_display = ["project", "slug", "owner"]
list_display_links = list_display
# inlines = [AttachmentInline]
inlines = [WatchedInline, VoteInline]
admin.site.register(models.WikiPage, WikiPageAdmin)