• Как сделать redirect django?

    @irina-prog Автор вопроса
    Сергей Горностаев,
    class EditorYMap(StaffRequiredMixin, TemplateView):
        """
        Load the map to the editor page.
        Загрузить карту на страницу редактора.
        """
        template_name = "base/base.html"
    
        def get_context_data(self, **kwargs):
            slug = kwargs.get("slug")
            ymap = Map.objects.filter(slug=slug, active=True).first()
            context = super(EditorYMap, self).get_context_data(**kwargs)
    
            if ymap is not None:
                controls = ymap.controls
    
                if ymap.icon_collection is not None:
                    icons = ymap.icon_collection.icons.filter(active=True)
                else:
                    icons = None
    
                context['djeym_version'] = __version__
                context['form_geo'] = GeoObjectsTransferForm(ymap_id=ymap.pk)
                context['form_controls'] = MapControlsForm(instance=controls)
                context['cluster'] = ymap.icon_cluster
                context['icons'] = icons
                context['tile'] = ymap.tile
                context['presets'] = ymap.presets.all()
                context['tile_sources'] = TileSource.objects.all()
                context['controls'] = controls
                context['external_modules'] = ymap.external_modules
                context['heat_form'] = HeatmapSettingsForm(
                    instance=ymap.heatmap_settings)
                context['general_settings'] = ymap.general_settings
                context['load_indicators'] = LoadIndicator.objects.all()
                context['selected_load_indicator'] = ymap.load_indicator
                context['load_indicator_size'] = ymap.load_indicator_size
                context['category_icons_css'] = [] if DJEYM_YMAPS_ICONS_FOR_CATEGORIES[2] else \
                    DJEYM_YMAPS_ICONS_FOR_CATEGORIES[0]
                context['category_icons_js'] = [] if DJEYM_YMAPS_ICONS_FOR_CATEGORIES[2] else \
                    DJEYM_YMAPS_ICONS_FOR_CATEGORIES[1]
                context['form_cke'] = CKEditorTextareaForm()
                context['category_placemarks'] = ymap.category_placemark.filter(
                    active=True)
                context['category_submarks'] = ymap.subcategory_placemark.filter(
                    active=True)
                context['category_polylines'] = ymap.category_polyline.filter(
                    active=True)
                context['category_polygons'] = ymap.category_polygon.filter(
                    active=True)
    
            context['ymap'] = ymap
            return context