def edit_app(request, app_id): app = get_object_or_404(App, pk=app_id) form = AppForm(request.POST or None, instance=app) if form.is_valid(): form.save() return render(request, 'gctest/confirm.html', {'result' : "updated"}) return render(request, 'gctest/edit.html', {'form' : form, 'view_url' : 'edit_app'})
def new_app(request): form = AppForm(request.POST or None) if form.is_valid(): form.save() return render(request, 'gctest/confirm.html', {'result': "added"}) return render(request, 'gctest/new.html', { 'form': form, 'view_url': 'new_app' })
def edit_app(request, app_id): app = get_object_or_404(App, pk=app_id) form = AppForm(request.POST or None, instance=app) if form.is_valid(): form.save() return render(request, 'gctest/confirm.html', {'result': "updated"}) return render(request, 'gctest/edit.html', { 'form': form, 'view_url': 'edit_app' })
def new_app(request): form = AppForm(request.POST or None) if form.is_valid(): form.save() return render(request, 'gctest/confirm.html', {'result' : "added"}) return render(request, 'gctest/new.html', {'form' : form, 'view_url' : 'new_app'})