expand proposal admin

This commit is contained in:
James Polley 2017-09-22 16:37:36 +10:00
parent 9b0d830538
commit d22f8e8e35
3 changed files with 42 additions and 18 deletions

View file

@ -2,29 +2,45 @@ from django.contrib import admin
from pinaxcon.proposals import models from pinaxcon.proposals import models
from symposion.proposals import models as symposion_models from symposion.proposals import models as symposion_models
from symposion.reviews.models import ProposalResult
@admin.register(models.TalkProposal)
@admin.register(models.TutorialProposal)
@admin.register(models.MiniconfProposal)
@admin.register(models.SysAdminProposal)
@admin.register(models.KernelProposal)
@admin.register(models.GamesProposal)
@admin.register(models.OpenHardwareProposal)
@admin.register(models.ClsXLCAProposal)
@admin.register(models.FuncProgProposal)
@admin.register(models.OpenEdProposal)
@admin.register(models.OpenGLAMProposal)
@admin.register(models.FPGAProposal)
@admin.register(models.DevDevProposal)
@admin.register(models.ArtTechProposal)
@admin.register(models.BioInformaticsProposal)
class CategoryAdmin(admin.ModelAdmin): class CategoryAdmin(admin.ModelAdmin):
class AdditionalSpeakerInline(admin.TabularInline): class AdditionalSpeakerInline(admin.TabularInline):
model = symposion_models.AdditionalSpeaker model = symposion_models.AdditionalSpeaker
class ProposalResultInline(admin.TabularInline):
model = ProposalResult
readonly_fields = ["score"]
fields = ["status"]
inlines = [ inlines = [
AdditionalSpeakerInline, AdditionalSpeakerInline,
ProposalResultInline,
] ]
for model in [ models.TalkProposal, models.TutorialProposal,
models.MiniconfProposal, models.SysAdminProposal,
models.KernelProposal, models.GamesProposal,
models.OpenHardwareProposal, models.ClsXLCAProposal,
models.FuncProgProposal, models.OpenEdProposal,
models.OpenGLAMProposal, models.FPGAProposal, models.DevDevProposal,
models.ArtTechProposal, models.BioInformaticsProposal ]:
admin.site.register(model, CategoryAdmin,
list_display = [
"id",
"title",
"speaker",
"speaker_email",
"kind",
"target_audience",
"status",
"cancelled",
],
list_filter = [
"result__status",
"cancelled",
],
)

View file

@ -28,5 +28,12 @@ from symposion.proposals.models import ProposalSection, ProposalKind
# ) # )
admin.site.register(ProposalSection) admin.site.register(ProposalSection,
list_display = [
"section",
"start",
"end",
"closed",
"published"
])
admin.site.register(ProposalKind) admin.site.register(ProposalKind)

View file

@ -177,6 +177,7 @@ class ProposalBase(models.Model):
except ObjectDoesNotExist: except ObjectDoesNotExist:
return _('Undecided') return _('Undecided')
def speakers(self): def speakers(self):
yield self.speaker yield self.speaker
speakers = self.additional_speakers.exclude( speakers = self.additional_speakers.exclude(