Exemplo n.º 1
0
def edit_alias(request, project_slug, id=None):
    proj = get_object_or_404(Project.objects.for_admin_user(request.user), slug=project_slug)
    if id:
        alias = proj.aliases.get(pk=id)
        form = AliasForm(instance=alias, data=request.POST or None)
    else:
        form = AliasForm(request.POST or None)

    if request.method == "POST" and form.is_valid():
        alias = form.save()
        return HttpResponseRedirect(alias.project.get_absolute_url())
    return render_to_response("projects/alias_edit.html", {"form": form}, context_instance=RequestContext(request))
Exemplo n.º 2
0
def edit_alias(request, project_slug, id=None):
    proj = get_object_or_404(Project.objects.all(), slug=project_slug)
    if id:
        alias = proj.aliases.get(pk=id)
        form = AliasForm(instance=alias, data=request.POST or None)
    else:
        form = AliasForm(request.POST or None)

    if request.method == 'POST' and form.is_valid():
        alias = form.save()
        return HttpResponseRedirect(alias.project.get_absolute_url())
    return render_to_response('projects/alias_edit.html', {'form': form},
                              context_instance=RequestContext(request))
Exemplo n.º 3
0
def edit_alias(request, project_slug, alias_id=None):
    """Edit project alias form view"""
    proj = get_object_or_404(Project.objects.for_admin_user(request.user),
                             slug=project_slug)
    if alias_id:
        alias = proj.aliases.get(pk=alias_id)
        form = AliasForm(instance=alias, data=request.POST or None)
    else:
        form = AliasForm(request.POST or None)

    if request.method == 'POST' and form.is_valid():
        alias = form.save()
        return HttpResponseRedirect(alias.project.get_absolute_url())
    return render(request, 'projects/alias_edit.html', {'form': form})
Exemplo n.º 4
0
def edit_alias(request, project_slug, alias_id=None):
    """Edit project alias form view."""
    proj = get_object_or_404(
        Project.objects.for_admin_user(request.user), slug=project_slug)
    if alias_id:
        alias = proj.aliases.get(pk=alias_id)
        form = AliasForm(instance=alias, data=request.POST or None)
    else:
        form = AliasForm(request.POST or None)

    if request.method == 'POST' and form.is_valid():
        alias = form.save()
        return HttpResponseRedirect(alias.project.get_absolute_url())
    return render(
        request,
        'projects/alias_edit.html',
        {'form': form},
    )