<commit_before>from django import forms
from django.contrib.contenttypes.models import ContentType

from courant.core.dynamic_models.models import *

class DynamicTypeAdminForm(forms.ModelForm):
    @property
    def eligible_bases(self):
        choices = []
        for subclass in DynamicModelBase.__subclasses__():
            ct = ContentType.objects.get_for_model(subclass)
            choices.append((ct.id, unicode(ct))) 
        return choices

    def __init__(self, *args, **kwargs):
        super(DynamicTypeAdminForm, self).__init__(*args, **kwargs)
        self.fields['base'].choices = self.eligible_bases<commit_msg>Changed admin form for DynamicType model to show a proper title-ized version of the eligible models.<commit_after>from django import forms
from django.contrib.contenttypes.models import ContentType

from courant.core.dynamic_models.models import *

class DynamicTypeAdminForm(forms.ModelForm):
    @property
    def eligible_bases(self):
        choices = []
        for subclass in DynamicModelBase.__subclasses__():
            ct = ContentType.objects.get_for_model(subclass)
            choices.append((ct.id, subclass._meta.verbose_name_plural.title())) 
        return choices

    def __init__(self, *args, **kwargs):
        super(DynamicTypeAdminForm, self).__init__(*args, **kwargs)
        self.fields['base'].choices = self.eligible_bases
{'fraction_non_alphanumeric': 0.09768451519536903, 'fraction_numerical': 0.0, 'mean_word_length': 3.720136518771331, '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': '2960027', 'n_tokens_mistral': 389, 'n_tokens_neox': 375, 'n_words': 86}