def init_with_context(self, context):
        """
        Find the current URL based on the context.
        It uses :func:`get_edited_object` to find the model,
        and calls ``get_absolute_url()`` to get the frontend URL.
        """
        super(ReturnToSiteItem, self).init_with_context(context)

        # See if the current page is being edited, update URL accordingly.
        edited_model = self.get_edited_object(context['request'])
        if edited_model:
            try:
                url = edited_model.get_absolute_url()
            except (AttributeError, urls.NoReverseMatch) as e:
                pass
            else:
                if url:
                    self.url = url
def init_with_context ( self , context ) : super ( ReturnToSiteItem , self ) . init_with_context ( context ) edited_model = self . get_edited_object ( context [ 'request' ] ) if edited_model : try : url = edited_model . get_absolute_url ( ) except ( AttributeError , urls . NoReverseMatch ) as e : pass else : if url : self . url = url
Find the current URL based on the context.
        It uses :func:`get_edited_object` to find the model,
        and calls ``get_absolute_url()`` to get the frontend URL.