Commit 89c9928b authored by okhin's avatar okhin 🚴

Campaign admin is done

parent c721b074
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin, TranslationTabularInline
from modeltranslation.admin import TranslationAdmin, TranslationStackedInline
from picampaign.campaign.models import Campaign, CampaignContact, Argumentary
from picampaign.organization.models import Organization
......@@ -13,11 +13,14 @@ class InlineContact(admin.TabularInline):
class InlineImporter(admin.TabularInline):
model = Importer
class InlineTranslationArgumentary(TranslationTabularInline):
class InlineTranslationArgumentary(TranslationStackedInline):
model = Argumentary
class CampaignAdmin(TranslationAdmin):
inlines = [InlineTranslationArgumentary, InlineContact, InlineImporter]
list_display = ('title', 'organization', 'start_date', 'end_date', 'phone_filter',)
list_filter = ('organization', 'start_date', 'end_date',)
list_select_related = ('organization',)
def get_queryset(self, request):
qs = super(CampaignAdmin, self).get_queryset(request)
......@@ -35,6 +38,10 @@ class CampaignAdmin(TranslationAdmin):
request,
**kwargs)
class CampaignContactAdmin(admin.ModelAdmin):
list_display = ('contact', 'campaign', 'weight')
list_select_related = ('contact', 'campaign',)
list_filter = ('campaign',)
def get_queryset(self, request):
qs = super(CampaignContactAdmin, self).get_queryset(request)
if request.user.is_superuser:
......@@ -44,6 +51,10 @@ class CampaignContactAdmin(admin.ModelAdmin):
class ArgumentaryAdmin(TranslationAdmin):
list_display = ('title', 'campaign',)
list_select_related = ('campaign',)
list_filter = ('campaign',)
def get_queryset(self, request):
qs = super(ArgumentaryAdmin, self).get_queryset(request)
if request.user.is_superuser:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment