Commit 508eab39 authored by okhin's avatar okhin 🚴

Adding the translations to the admin

parent 1681bea2
from django.contrib import admin
from modeltranslation.admin import TranslationAdmin, TranslationTabularInline
from picampaign.campaign.models import Campaign, CampaignContact, Argumentary
from picampaign.organization.models import Organization
from picampaign.importer.models import Importer
......@@ -10,8 +12,11 @@ class InlineContact(admin.TabularInline):
class InlineImporter(admin.TabularInline):
model = Importer
class CampaignAdmin(admin.ModelAdmin):
inlines = [InlineContact, InlineImporter]
class InlineTranslationArgumentary(TranslationTabularInline):
model = Argumentary
class CampaignAdmin(TranslationAdmin):
inlines = [InlineTranslationArgumentary, InlineContact, InlineImporter]
def get_queryset(self, request):
qs = super(CampaignAdmin, self).get_queryset(request)
......@@ -37,7 +42,7 @@ class CampaignContactAdmin(admin.ModelAdmin):
return qs.filter(campaign__organization__in=user_orgs)
class ArgumentaryAdmin(admin.ModelAdmin):
class ArgumentaryAdmin(TranslationAdmin):
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