<commit_before># coding=UTF-8
from django.core.urlresolvers import reverse
from django.utils.encoding import force_unicode
from django.utils.encoding import smart_str
from django.utils.safestring import mark_safe
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.related import RelatedObject
from django.db import models

from exadmin.sites import site
from exadmin.views import BaseAdminPlugin, ListAdminView, CreateAdminView, UpdateAdminView, DeleteAdminView

RELATE_VAR = '_relate'
RELATE_PREFIX = '_rel_'

class RelateMenuPlugin(BaseAdminPlugin):

    related_list = []
    use_related_menu = True

    def get_related_list(self):
        if hasattr(self, '_related_acts'):
            return self._related_acts
            
        _related_acts = []
        for r in self.opts.get_all_related_objects() + self.opts.get_all_related_many_to_many_objects():
            if self.related_list and (r.get_accessor_name() not in self.related_list):
                continue
            if r.model not in self.admin_site._registry.keys():
                continue
            f = r.field
            rel_name = f.rel.get_related_field().name
            _related_acts.append((r.opts.app_label, r.opts.module_name, force_unicode(r.opts.verbose_name), f.name, '%s__%s__exact' % (f.name, rel_name)))

        self._related_acts = _related_acts
        return self._related_acts
    
    def related_link(self, instance):
        links =[]
        for label, model_name, verbose_name, field_name, lookup_name in self.get_related_list():
            list_url = reverse('%s:%s_%s_changelist' % (self.admin_site.app_name, label, model_name))
            add_url = reverse('%s:%s_%s_add' % (self.admin_site.app_name, label, model_name))
            link = ''.join(('<li class="with_menu_btn">',
            '<a href="%s?%s=%s" title="%s"><i class="icon icon-th-list"></i> %s</a>' % \<commit_msg>remove unnecessary param<commit_after># coding=UTF-8
from django.core.urlresolvers import reverse
from django.utils.encoding import force_unicode
from django.utils.encoding import smart_str
from django.utils.safestring import mark_safe
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.related import RelatedObject
from django.db import models

from exadmin.sites import site
from exadmin.views import BaseAdminPlugin, ListAdminView, CreateAdminView, UpdateAdminView, DeleteAdminView

RELATE_PREFIX = '_rel_'

class RelateMenuPlugin(BaseAdminPlugin):

    related_list = []
    use_related_menu = True

    def get_related_list(self):
        if hasattr(self, '_related_acts'):
            return self._related_acts
            
        _related_acts = []
        for r in self.opts.get_all_related_objects() + self.opts.get_all_related_many_to_many_objects():
            if self.related_list and (r.get_accessor_name() not in self.related_list):
                continue
            if r.model not in self.admin_site._registry.keys():
                continue
            f = r.field
            rel_name = f.rel.get_related_field().name
            _related_acts.append((r.opts.app_label, r.opts.module_name, force_unicode(r.opts.verbose_name), f.name, '%s__%s__exact' % (f.name, rel_name)))

        self._related_acts = _related_acts
        return self._related_acts
    
    def related_link(self, instance):
        links =[]
        for label, model_name, verbose_name, field_name, lookup_name in self.get_related_list():
            list_url = reverse('%s:%s_%s_changelist' % (self.admin_site.app_name, label, model_name))
            add_url = reverse('%s:%s_%s_add' % (self.admin_site.app_name, label, model_name))
            link = ''.join(('<li class="with_menu_btn">',
            '<a href="%s?%s=%s" title="%s"><i class="icon icon-th-list"></i> %s</a>' % \
{'fraction_non_alphanumeric': 0.1094488188976378, 'fraction_numerical': 0.0005249343832020997, 'mean_word_length': 3.2533482142857144, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '4407650', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1181, 'n_words': 248}