def get_context(self, form, user, dataset, resource=None): mode = None if resource: if resource.up_file: mode = 'up_file' elif resource.dl_url: mode = 'dl_url' elif resource.referenced_url: mode = 'referenced_url' elif resource.ftp_file: mode = 'ftp_file' elif form: if form.files.get('up_file'): mode = 'up_file' elif form.data.get('dl_url'): mode = 'dl_url' elif form.data.get('referenced_url'): mode = 'referenced_url' elif form.data.get('ftp_file'): mode = 'ftp_file' return { 'target': datasets_target(dataset, user), 'dataset': dataset, 'resource': resource, 'form': form, 'mode': mode, }
def get(self, request, dataset_id=None, resource_id=None, layer_id=None, *args, **kwargs): user, profile = user_and_profile(request) layer = get_object_or_404(Layer, resource=resource_id) target = datasets_target(layer.resource.dataset, user) context = { 'target': target, 'layer': layer, 'fonts_asjson': json.dumps(MRAHandler.get_fonts()), 'layer_asjson': json.dumps(layer.mra_info), } return render_with_info_profile( request, 'idgo_admin/dataset/resource/layer/style/edit.html', context=context)
def get(self, request, dataset_id=None, resource_id=None, layer_id=None, *args, **kwargs): user, profile = user_and_profile(request) layer = get_object_or_404(Layer, resource=resource_id) form = Form(instance=layer, include={'user': user}) target = datasets_target(layer.resource.dataset, user) context = { 'target': target, 'layer': layer, 'form': form, } return render_with_info_profile( request, 'idgo_admin/dataset/resource/layer/edit.html', context=context)
def layer_styles(request, dataset_id=None, resource_id=None, layer_id=None, *args, **kwargs): user, profile = user_and_profile(request) layer = get_object_or_404(Layer, resource=resource_id) target = datasets_target(layer.resource.dataset, user) context = { 'target': target, 'layer': layer, } return render_with_info_profile( request, 'idgo_admin/dataset/resource/layer/style/styles.html', context=context)