def edit_intro_page(request): if not PermissionController.is_admin(request.user): return HttpResponseRedirect("/login/") instance = IntroPageContent.get_instance() if request.method == "POST": form = IntroPageForm(request.POST, instance=instance) if form.is_valid(): form.save() messages.success(request, u"ویرایش اطلاعات با موفقیت انجام شد.") else: messages.error(request, u"فرم نا معتبر است.") else: form = IntroPageForm(instance=instance) return render_to_response("accounts/edit_intro_page.html", {"form": form}, context_instance=RequestContext(request))
def edit_intro_page(request): if not PermissionController.is_admin(request.user): return HttpResponseRedirect('/login/') instance = IntroPageContent.get_instance() if request.method == 'POST': form = IntroPageForm(request.POST, instance=instance) if form.is_valid(): form.save() messages.success(request, u"ویرایش اطلاعات با موفقیت انجام شد.") else: messages.error(request, u"فرم نا معتبر است.") else: form = IntroPageForm(instance=instance) return render_to_response('accounts/edit_intro_page.html', {"form": form}, context_instance=RequestContext(request))
def index(request): context = index_core(request) template = Template(IntroPageContent.get_instance().content) return HttpResponse(template.render(context))