Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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
    )
Exemple #4
0
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
    )
Exemple #5
0
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)
Exemple #6
0
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
    )
Exemple #7
0
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)