コード例 #1
0
ファイル: views.py プロジェクト: realsugar/hgadmin
def developer_password(request, login):
    developer = Developer.get_by_login(login)
    if not developer:
        raise Http404

    response = lambda form, login: render_to_response('developers/password.html',
        { 'form' : form, 'login': login })

    if not request.POST:
        form = DeveloperEditForm(initial={ 'login' : login })
        return response(form, login)

    # Validating form and saving developer
    form = DeveloperEditForm(request.POST)
    if form.is_valid():
        developer.set_password(form.cleaned_data['password'])
        developer.save()

        messages.success(request, 'Password updated for %s.' % login)

        return back_to_developers_list()

    # Form is not valid
    return response(form, login)
コード例 #2
0
ファイル: views.py プロジェクト: realsugar/hgadmin
def developer_profile(request, login):
    developer = Developer.get_by_login(login)
    if not developer:
        raise Http404

    return render_to_response('developers/profile.html', {'developer': developer})