'The \'change list\' admin view for this model.'

@csrf_protect_m
def changelist_view(self, request, extra_context=None):

    from django.contrib.admin.views.main import ERROR_FLAG
    opts = self.model._meta
    app_label = opts.app_label
    if (not self.has_change_permission(request, None)):
        raise PermissionDenied
    actions = self.get_actions(request)
    list_display = list(self.list_display)
    if (not actions):
        try:
            list_display.remove('action_checkbox')
        except ValueError:
            pass
    ChangeList = self.get_changelist(request)
    try:
        cl = ChangeList(request, self.model, list_display, self.list_display_links, self.list_filter, self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_editable, self)
    except IncorrectLookupParameters:
        if (ERROR_FLAG in request.GET.keys()):
            return render_to_response('admin/invalid_setup.html', {'title': _('Database    error')})
        return HttpResponseRedirect((((request.path + '?') + ERROR_FLAG) + '=1'))
    action_failed = False
    selected = request.POST.getlist(helpers.ACTION_CHECKBOX_NAME)
    if (actions and (request.method == 'POST') and ('index' in request.POST) and ('_save' not in request.POST)):
        if selected:
            response = self.response_action(request, queryset=cl.get_query_set())
            if response:
                return response
            else:
                action_failed = True
        else:
            msg = _('Items    must    be    selected    in    order    to    perform    actions    on    them.    No    items    have    been    changed.')
            self.message_user(request, msg)
            action_failed = True
    if (actions and (request.method == 'POST') and (helpers.ACTION_CHECKBOX_NAME in request.POST) and ('index' not in request.POST) and ('_save' not in request.POST)):
        if selected:
            response = self.response_action(request, queryset=cl.get_query_set())
            if response:
                return response
            else:
                action_failed = True
    formset = cl.formset = None
    if ((request.method == 'POST') and self.list_editable and ('_save' in request.POST) and (not action_failed)):
        FormSet = self.get_changelist_formset(request)
        formset = cl.formset = FormSet(request.POST, request.FILES, queryset=cl.result_list)
        if formset.is_valid():
            changecount = 0
            for form in formset.forms:
                if form.has_changed():
                    obj = self.save_form(request, form, change=True)
                    self.save_model(request, obj, form, change=True)
                    form.save_m2m()
                    change_msg = self.construct_change_message(request, form, None)
                    self.log_change(request, obj, change_msg)
                    changecount += 1
            if changecount:
                if (changecount == 1):
                    name = force_unicode(opts.verbose_name)
                else:
                    name = force_unicode(opts.verbose_name_plural)
                msg = (ungettext('%(count)s    %(name)s    was    changed    successfully.', '%(count)s    %(name)s    were    changed    successfully.', changecount) % {'count': changecount, 'name': name, 'obj': force_unicode(obj)})
                self.message_user(request, msg)
            return HttpResponseRedirect(request.get_full_path())
    elif self.list_editable:
        FormSet = self.get_changelist_formset(request)
        formset = cl.formset = FormSet(queryset=cl.result_list)
    if formset:
        media = (self.media + formset.media)
    else:
        media = self.media
    if actions:
        action_form = self.action_form(auto_id=None)
        action_form.fields['action'].choices = self.get_action_choices(request)
    else:
        action_form = None
    selection_note_all = ungettext('%(total_count)s    selected', 'All    %(total_count)s    selected', cl.result_count)
    context = {'module_name': force_unicode(opts.verbose_name_plural), 'selection_note': (_('0    of    %(cnt)s    selected') % {'cnt': len(cl.result_list)}), 'selection_note_all': (selection_note_all % {'total_count': cl.result_count}), 'title': cl.title, 'is_popup': cl.is_popup, 'cl': cl, 'media': media, 'has_add_permission': self.has_add_permission(request), 'root_path': self.admin_site.root_path, 'app_label': app_label, 'action_form': action_form, 'actions_on_top': self.actions_on_top, 'actions_on_bottom': self.actions_on_bottom, 'actions_selection_counter': self.actions_selection_counter}
    context.update((extra_context or {}))
    context_instance = template.RequestContext(request, current_app=self.admin_site.name)
    return render_to_response((self.change_list_template or [('admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower())), ('admin/%s/change_list.html' % app_label), 'admin/change_list.html']), context, context_instance=context_instance)
