from django.contrib import admin
from django_admin_listfilter_dropdown.filters import DropdownFilter

# Register your models here.
from .models import PopulationData, CountryGroup


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    list_display = ("country", "code", "year", "population", "get_group")
    list_filter = (
        ("country", DropdownFilter),
        ("code", DropdownFilter),
        ("year", DropdownFilter),
    )
    search_fields = ("country__startswith", "code__startswith")

    def get_group(self, obj):
        return "\n".join([a.country_group for a in obj.group.all()])


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = ("country_group", "get_group")

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return "\n".join([a.country for a in dist])

757705c0dff4cd03ede2123a755400f336b78b45
<mask token>


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = 'country_group', 'get_group'

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return '\n'.join([a.country for a in dist])

<mask token>


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    <mask token>
    <mask token>
    <mask token>

    def get_group(self, obj):
        return '\n'.join([a.country_group for a in obj.group.all()])


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = 'country_group', 'get_group'

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return '\n'.join([a.country for a in dist])

<mask token>


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    list_display = 'country', 'code', 'year', 'population', 'get_group'
    list_filter = ('country', DropdownFilter), ('code', DropdownFilter), (
        'year', DropdownFilter)
    search_fields = 'country__startswith', 'code__startswith'

    def get_group(self, obj):
        return '\n'.join([a.country_group for a in obj.group.all()])


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = 'country_group', 'get_group'

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return '\n'.join([a.country for a in dist])

from django.contrib import admin
from django_admin_listfilter_dropdown.filters import DropdownFilter
from .models import PopulationData, CountryGroup


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    list_display = 'country', 'code', 'year', 'population', 'get_group'
    list_filter = ('country', DropdownFilter), ('code', DropdownFilter), (
        'year', DropdownFilter)
    search_fields = 'country__startswith', 'code__startswith'

    def get_group(self, obj):
        return '\n'.join([a.country_group for a in obj.group.all()])


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = 'country_group', 'get_group'

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return '\n'.join([a.country for a in dist])

from django.contrib import admin
from django_admin_listfilter_dropdown.filters import DropdownFilter

# Register your models here.
from .models import PopulationData, CountryGroup


@admin.register(PopulationData)
class PopulationAdmin(admin.ModelAdmin):
    list_display = ("country", "code", "year", "population", "get_group")
    list_filter = (
        ("country", DropdownFilter),
        ("code", DropdownFilter),
        ("year", DropdownFilter),
    )
    search_fields = ("country__startswith", "code__startswith")

    def get_group(self, obj):
        return "\n".join([a.country_group for a in obj.group.all()])


@admin.register(CountryGroup)
class ContryGroupAdmin(admin.ModelAdmin):
    list_display = ("country_group", "get_group")

    def get_group(self, obj):
        dist = obj.populationdata_set.all().distinct('country')
        return "\n".join([a.country for a in dist])
