def construct_context(self, request):
        """
        Builds context with various required variables.
        """
        opts = self.model._meta
        app_label = opts.app_label
        object_name = opts.object_name.lower()
        form = self.construct_form(request)

        media = self.media(form)
        context = {
            'user': request.user,
            'title': '%s %s' % (self.label, opts.verbose_name_plural.lower()),
            'tool': self,
            'opts': opts,
            'app_label': app_label,
            'media': media,
            'form': form,
            'changelist_url': reverse('admin:%s_%s_changelist' % (
                app_label, object_name
            ))
        }

        # Pass along fieldset if sepcififed.
        if hasattr(form, 'fieldsets'):
            admin_form = helpers.AdminForm(form, form.fieldsets, {})
            context['adminform'] = admin_form

        return context
def construct_context ( self , request ) : opts = self . model . _meta app_label = opts . app_label object_name = opts . object_name . lower ( ) form = self . construct_form ( request ) media = self . media ( form ) context = { 'user' : request . user , 'title' : '%s %s' % ( self . label , opts . verbose_name_plural . lower ( ) ) , 'tool' : self , 'opts' : opts , 'app_label' : app_label , 'media' : media , 'form' : form , 'changelist_url' : reverse ( 'admin:%s_%s_changelist' % ( app_label , object_name ) ) } if hasattr ( form , 'fieldsets' ) : admin_form = helpers . AdminForm ( form , form . fieldsets , { } ) context [ 'adminform' ] = admin_form return context
Builds context with various required variables.