<commit_before>from django.contrib import admin
from django.db.models import F, Sum, IntegerField
from django.utils.translation import ugettext_lazy as _

import nested_admin

from .models import District, Location
from campaigns.models import CampaignLocationShift
from coordinators.models import filter_by_district

from campaigns.admin import VolunteerParticipantInline

from .admin_actions import list_volunteers_by_shift_and_location

class CampaignShiftInline(nested_admin.NestedTabularInline):
    model = CampaignLocationShift
    fields = ['day', 'start', 'end', 'total_places', 'shift_leader']
    readonly_fields = ['day', 'start', 'end', 'total_places']
    exclude = ['volunteers']<commit_msg>Limit location shift leader selection in location admin as well<commit_after>from django.contrib import admin
from django.db.models import F, Sum, IntegerField
from django.utils.translation import ugettext_lazy as _

import nested_admin

from .models import District, Location
from campaigns.models import CampaignLocationShift
from coordinators.models import filter_by_district

from campaigns.admin import (
    VolunteerParticipantInline,
    CampaignLocationShiftForm
)

from .admin_actions import list_volunteers_by_shift_and_location

class CampaignShiftInline(nested_admin.NestedTabularInline):
    form = CampaignLocationShiftForm
    model = CampaignLocationShift
    fields = ['day', 'start', 'end', 'total_places', 'shift_leader']
    readonly_fields = ['day', 'start', 'end', 'total_places']
    exclude = ['volunteers']
{'fraction_non_alphanumeric': 0.07672301690507152, 'fraction_numerical': 0.0, 'mean_word_length': 6.328571428571428, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7211921', 'n_tokens_mistral': 422, 'n_tokens_neox': 417, 'n_words': 121}