Commit bdd96c83 authored by okhin's avatar okhin 🚴

Adding search fields to the campaign admin

parent 89c9928b
...@@ -21,6 +21,7 @@ class CampaignAdmin(TranslationAdmin): ...@@ -21,6 +21,7 @@ class CampaignAdmin(TranslationAdmin):
list_display = ('title', 'organization', 'start_date', 'end_date', 'phone_filter',) list_display = ('title', 'organization', 'start_date', 'end_date', 'phone_filter',)
list_filter = ('organization', 'start_date', 'end_date',) list_filter = ('organization', 'start_date', 'end_date',)
list_select_related = ('organization',) list_select_related = ('organization',)
search_fields = ['title', 'organization__name']
def get_queryset(self, request): def get_queryset(self, request):
qs = super(CampaignAdmin, self).get_queryset(request) qs = super(CampaignAdmin, self).get_queryset(request)
...@@ -41,6 +42,7 @@ class CampaignContactAdmin(admin.ModelAdmin): ...@@ -41,6 +42,7 @@ class CampaignContactAdmin(admin.ModelAdmin):
list_display = ('contact', 'campaign', 'weight') list_display = ('contact', 'campaign', 'weight')
list_select_related = ('contact', 'campaign',) list_select_related = ('contact', 'campaign',)
list_filter = ('campaign',) list_filter = ('campaign',)
search_fields = ['campaign__title', 'contact__first_name', 'contact__last_name']
def get_queryset(self, request): def get_queryset(self, request):
qs = super(CampaignContactAdmin, self).get_queryset(request) qs = super(CampaignContactAdmin, self).get_queryset(request)
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-14 10:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('campaign', '0010_auto_20170613_2015'),
]
operations = [
migrations.AlterModelOptions(
name='argumentary',
options={'verbose_name': 'Argument', 'verbose_name_plural': 'Arguments'},
),
]
...@@ -27,6 +27,10 @@ class Argumentary(models.Model): ...@@ -27,6 +27,10 @@ class Argumentary(models.Model):
title = models.CharField(max_length=255, verbose_name=_('title'), null=True, blank=True) title = models.CharField(max_length=255, verbose_name=_('title'), null=True, blank=True)
text = RichTextField(null=True) text = RichTextField(null=True)
class Meta:
verbose_name = _("Argument")
verbose_name_plural = _("Arguments")
def __str__(self): def __str__(self):
args = {'title': self.campaign.title} args = {'title': self.campaign.title}
return _('Argumentary for %(title)s') % args return _('Argumentary for %(title)s') % args
......
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