Enhancements into the admin panel with the Attachment inlines
parent
d865ab1615
commit
e24b3261a0
|
@ -1,19 +1,26 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
import reversion
|
from django.contrib.contenttypes import generic
|
||||||
|
|
||||||
from greenmine.projects.milestones.admin import MilestoneInline
|
from greenmine.projects.milestones.admin import MilestoneInline
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
import reversion
|
||||||
|
|
||||||
|
|
||||||
class AttachmentAdmin(reversion.VersionAdmin):
|
class AttachmentAdmin(reversion.VersionAdmin):
|
||||||
list_display = ["id", "owner"]
|
list_display = ["project", "attached_file", "owner"]
|
||||||
|
|
||||||
admin.site.register(models.Attachment, AttachmentAdmin)
|
admin.site.register(models.Attachment, AttachmentAdmin)
|
||||||
|
|
||||||
|
|
||||||
|
class AttachmentInline(generic.GenericTabularInline):
|
||||||
|
model = models.Attachment
|
||||||
|
fields = ("attached_file", "owner")
|
||||||
|
extra = 0
|
||||||
|
|
||||||
|
|
||||||
class MembershipAdmin(admin.ModelAdmin):
|
class MembershipAdmin(admin.ModelAdmin):
|
||||||
list_display = ['project', 'role', 'user']
|
list_display = ['project', 'role', 'user']
|
||||||
list_filter = ['project', 'role']
|
list_filter = ['project', 'role']
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from greenmine.projects.admin import AttachmentInline
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
@ -9,5 +11,6 @@ import reversion
|
||||||
|
|
||||||
class IssueAdmin(reversion.VersionAdmin):
|
class IssueAdmin(reversion.VersionAdmin):
|
||||||
list_display = ["subject", "type"]
|
list_display = ["subject", "type"]
|
||||||
|
inlines = [AttachmentInline]
|
||||||
|
|
||||||
admin.site.register(models.Issue, IssueAdmin)
|
admin.site.register(models.Issue, IssueAdmin)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from greenmine.projects.admin import AttachmentInline
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
@ -9,5 +11,6 @@ import reversion
|
||||||
|
|
||||||
class QuestionAdmin(reversion.VersionAdmin):
|
class QuestionAdmin(reversion.VersionAdmin):
|
||||||
list_display = ["subject", "project", "owner"]
|
list_display = ["subject", "project", "owner"]
|
||||||
|
inlines = [AttachmentInline]
|
||||||
|
|
||||||
admin.site.register(models.Question, QuestionAdmin)
|
admin.site.register(models.Question, QuestionAdmin)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from greenmine.projects.admin import AttachmentInline
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
@ -10,6 +12,7 @@ import reversion
|
||||||
class TaskAdmin(reversion.VersionAdmin):
|
class TaskAdmin(reversion.VersionAdmin):
|
||||||
list_display = ["subject", "ref", "user_story", "milestone", "project", "user_story_id"]
|
list_display = ["subject", "ref", "user_story", "milestone", "project", "user_story_id"]
|
||||||
list_filter = ["user_story", "milestone", "project"]
|
list_filter = ["user_story", "milestone", "project"]
|
||||||
|
inlines = [AttachmentInline]
|
||||||
|
|
||||||
def user_story_id(self, instance):
|
def user_story_id(self, instance):
|
||||||
return instance.user_story.id
|
return instance.user_story.id
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from greenmine.projects.admin import AttachmentInline
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
@ -29,6 +31,6 @@ class RolePointsInline(admin.TabularInline):
|
||||||
class UserStoryAdmin(reversion.VersionAdmin):
|
class UserStoryAdmin(reversion.VersionAdmin):
|
||||||
list_display = ["id", "ref", "milestone", "project", "owner", 'status', 'is_closed']
|
list_display = ["id", "ref", "milestone", "project", "owner", 'status', 'is_closed']
|
||||||
list_filter = ["milestone", "project"]
|
list_filter = ["milestone", "project"]
|
||||||
inlines = [RolePointsInline]
|
inlines = [RolePointsInline, AttachmentInline]
|
||||||
|
|
||||||
admin.site.register(models.UserStory, UserStoryAdmin)
|
admin.site.register(models.UserStory, UserStoryAdmin)
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from greenmine.projects.wiki.models import WikiPage
|
from greenmine.projects.wiki.models import WikiPage
|
||||||
|
from greenmine.projects.admin import AttachmentInline
|
||||||
|
|
||||||
|
from . import models
|
||||||
|
|
||||||
class WikiPageAdmin(admin.ModelAdmin):
|
class WikiPageAdmin(admin.ModelAdmin):
|
||||||
list_display = ["slug", "project", "owner"]
|
list_display = ["project", "slug", "owner"]
|
||||||
|
inlines = [AttachmentInline]
|
||||||
|
|
||||||
admin.site.register(WikiPage, WikiPageAdmin)
|
admin.site.register(models.WikiPage, WikiPageAdmin)
|
||||||
|
|
Loading…
Reference in New Issue