def smart_link_create(request): check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE]) if request.method == 'POST': form = SmartLinkForm(request.POST) if form.is_valid(): document_group = form.save() messages.success(request, _(u'Smart link: %s created successfully.') % document_group) return HttpResponseRedirect(reverse('document_group_list')) else: form = SmartLinkForm() return render_to_response('generic_form.html', { 'form': form, 'title': _(u'Create new smart link') }, context_instance=RequestContext(request))
def smart_link_create(request): check_permissions(request.user, [PERMISSION_SMART_LINK_CREATE]) if request.method == 'POST': form = SmartLinkForm(request.POST) if form.is_valid(): document_group = form.save() messages.success( request, _(u'Smart link: %s created successfully.') % document_group) return HttpResponseRedirect(reverse('document_group_list')) else: form = SmartLinkForm() return render_to_response('generic_form.html', { 'form': form, 'title': _(u'Create new smart link') }, context_instance=RequestContext(request))
def smart_link_edit(request, smart_link_pk): check_permissions(request.user, [PERMISSION_SMART_LINK_EDIT]) smart_link = get_object_or_404(SmartLink, pk=smart_link_pk) if request.method == 'POST': form = SmartLinkForm(request.POST, instance=smart_link) if form.is_valid(): smart_link = form.save() messages.success(request, _(u'Smart link: %s edited successfully.') % smart_link) return HttpResponseRedirect(reverse('document_group_list')) else: form = SmartLinkForm(instance=smart_link) return render_to_response('generic_form.html', { 'navigation_object_name': 'smart_link', 'smart_link': smart_link, 'form': form, 'title': _(u'Edit smart link: %s') % smart_link }, context_instance=RequestContext(request))
def smart_link_edit(request, smart_link_pk): check_permissions(request.user, [PERMISSION_SMART_LINK_EDIT]) smart_link = get_object_or_404(SmartLink, pk=smart_link_pk) if request.method == 'POST': form = SmartLinkForm(request.POST, instance=smart_link) if form.is_valid(): smart_link = form.save() messages.success( request, _(u'Smart link: %s edited successfully.') % smart_link) return HttpResponseRedirect(reverse('document_group_list')) else: form = SmartLinkForm(instance=smart_link) return render_to_response('generic_form.html', { 'navigation_object_name': 'smart_link', 'smart_link': smart_link, 'form': form, 'title': _(u'Edit smart link: %s') % smart_link }, context_instance=RequestContext(request))