|
@@ -23,7 +23,7 @@ from users.views import profile_pre_actions, profile_post_actions
|
23
|
23
|
from users.forms import UserProfileFormLanguageOnly
|
24
|
24
|
from .userviews import get_wrapper_instance as get_userview_wrapper_instance
|
25
|
25
|
import zipfile
|
26
|
|
-from pygal.views.userviews import query_view
|
|
26
|
+from pygal.views.userviews import query_view, ItemDoesNotEsistWithinParent
|
27
|
27
|
|
28
|
28
|
|
29
|
29
|
def pygal_item_does_not_exist(request, context):
|
|
@@ -155,7 +155,10 @@ def pygal_userview_infoview(request, responsetype, rel_path):
|
155
|
155
|
#
|
156
|
156
|
if w.may_read():
|
157
|
157
|
context.set_additional_title(w.name)
|
158
|
|
- return w.render(context)
|
|
158
|
+ try:
|
|
159
|
+ return w.render(context)
|
|
160
|
+ except ItemDoesNotEsistWithinParent:
|
|
161
|
+ return redirect('?'.join([request.META['PATH_INFO'].replace(rel_path, ''), request.META['QUERY_STRING']]))
|
159
|
162
|
else:
|
160
|
163
|
return pygal_access_denied(request, context)
|
161
|
164
|
|
|
@@ -244,7 +247,7 @@ def pygal_addtag(request, rel_path):
|
244
|
247
|
tag_context_adaption(context, w, request, get_item_type(full_path) in [TYPE_IMAGE])
|
245
|
248
|
if request.POST:
|
246
|
249
|
tag = Tag(item=w.item)
|
247
|
|
- form = TagForm(request.POST, instance=tag, factor_to_original=context['factor_to_original'])
|
|
250
|
+ form = TagForm(request.POST, instance=tag, factor_to_original=context.get('factor_to_original'))
|
248
|
251
|
if form.is_valid():
|
249
|
252
|
form.save()
|
250
|
253
|
messages.info(request, _('Thanks for adding a Tag to %s') % w.name)
|
|
@@ -277,7 +280,7 @@ def pygal_tagedit(request, tag_id):
|
277
|
280
|
context['enable_delete_button'] = True
|
278
|
281
|
if request.POST:
|
279
|
282
|
if request.POST.get('save'):
|
280
|
|
- form = TagForm(request.POST, instance=t, factor_to_original=context['factor_to_original'])
|
|
283
|
+ form = TagForm(request.POST, instance=t, factor_to_original=context.get('factor_to_original'))
|
281
|
284
|
if form.is_valid():
|
282
|
285
|
form.save()
|
283
|
286
|
messages.info(request, _('Thanks for editing Tag %(tag_id)d to %(item_name)s') % {'tag_id': tag_id, 'item_name': w.name})
|
|
@@ -287,7 +290,7 @@ def pygal_tagedit(request, tag_id):
|
287
|
290
|
messages.info(request, _('Tag %(tag_id)d of %(item_name)s has been deleted.') % {'tag_id': tag_id, 'item_name': w.name})
|
288
|
291
|
return redirect(get_next(request))
|
289
|
292
|
else:
|
290
|
|
- form = TagForm(instance=t, factor_to_original=context['factor_to_original'])
|
|
293
|
+ form = TagForm(instance=t, factor_to_original=context.get('factor_to_original'))
|
291
|
294
|
context['form'] = form
|
292
|
295
|
return render(request, 'pygal/tagedit.html', context=context)
|
293
|
296
|
|