def get_single_form(request, pk, Obj=Post, path_name='', perm='blog.change_post', template_name='ajax/single_field_form.haml', **kwargs): if len(path_name) == 0: path_name = 'post-%s' % kwargs['attr_name'] path_name = 'blog-' + path_name return ajax_get_form(request, Obj, path_name, pk=pk, perm=perm, template_name=template_name, **kwargs)
def get_comment_comment_form(request, pk): comment = get_object_or_404(Comment, pk=pk) if not request.user.is_authenticated() or not ( request.user == comment.user or request.user.has_perm("blog.change_comment") ): return HttpResponseForbidden() args = {"attr_name": "comment", "form_obj": SingleTextareaForm} return ajax_get_form(request, comment, "blog-comment-comment", perm=None, pk=None, **args)
def get_contactLink_model_form(request, pk): kwargs = {"form_obj": ContactLinkForm} return ajax_get_form( request, ContactLink, "about-contactLink-model", pk=pk, perm="about.change_contactlink", is_single=False, **kwargs )
def get_navigationLink_model_form(request, pk): kwargs = {"form_obj": NavigationForm} return ajax_get_form( request, NavigationLink, "about-navigationLink-model", pk=pk, perm="about.change_navigationlink", is_single=False, **kwargs )
def get_single_form(request, model, path_name, pk, perm, template_name='ajax/single_field_form.haml', **kwargs): path_name = 'resume-' + path_name return ajax_get_form(request, model, path_name, pk=pk, perm=perm, template_name=template_name, **kwargs)
def get_project_description_form(request, pk): kwargs = {"attr_name": "description", "form_obj": SingleTextareaForm} return ajax_get_form( request, WorkProject, "about-project-description", pk=pk, perm="about.change_project", **kwargs )
def get_profile_about_me_form(request, pk): kwargs = {"attr_name": "about_me", "form_obj": SingleTextareaForm} return ajax_get_form(request, Profile, "about-profile-about-me", pk=pk, perm="about.change_profile", **kwargs)