Esempio n. 1
0
def create_account(request):
    return create_object(
        request,
        form_class = get_account_form(request),
        post_save_redirect = reverse('list_accounts'),
        template_name = 'account_form.html',
    )
Esempio n. 2
0
def update_account(request, account_id):
    if not request.user.is_superuser:
        get_object_or_404(Account, owner=request.user, pk=account_id)
    else:
        get_object_or_404(Account, pk=account_id)

    return update_object(
        request,
        form_class = get_account_form(request),
        post_save_redirect = reverse('view_account', kwargs={'account_id': account_id}),
        object_id = account_id,
        template_name = 'account_form.html',
    )