def settings(request, app_slug): app = get_object_or_404(App, slug=app_slug) if request.method == "POST": form = ApplicationForm(request.POST, instance=app) if form.is_valid(): new_app = form.save() activity = Activity(application=app) activity.action = "Updated the settings on %s" % app.name activity.user = request.user activity.save() return redirect('app', app.slug) else: form = ApplicationForm(instance=app) context = {'form':form, 'app':app} return render(request, 'projects/project_settings.html', context)
def add_application(request): if request.method == "POST": form = ApplicationForm(request.POST) if form.is_valid(): app = form.save() activity = Activity(application=app) activity.action = "Created a new application, %s" % app.name activity.user = request.user activity.save() return redirect("app", app.slug) else: form = ApplicationForm() context = {'form': form} return render(request, 'projects/add_form.html', context)
def add_defect(request, app_slug): context = {} app = get_object_or_404(App, slug=app_slug) context['app'] = app if request.method == "POST": form = IssueForm(app, request.POST) if form.is_valid(): obj = form.save(commit=False) obj.creator = request.user obj.status = "open" obj.application = app obj.save() activity = Activity(application=obj.application) activity.user = request.user activity.action = "Added a new defect #%s" % obj.id activity.issue = obj activity.save() return redirect("open_app_issues", app_slug=app.slug) #return redirect("defect_detail", defect_id=obj.id) else: form = IssueForm(app) context['form'] = form return render(request, 'issues/add_defect.html', context)
def add_defect(request, app_slug): context = {} app = get_object_or_404(App, slug=app_slug) context["app"] = app if request.method == "POST": form = IssueForm(app, request.POST) if form.is_valid(): obj = form.save(commit=False) obj.creator = request.user obj.status = "open" obj.application = app obj.save() activity = Activity(application=obj.application) activity.user = request.user activity.action = "Added a new defect #%s" % obj.id activity.issue = obj activity.save() return redirect("open_app_issues", app_slug=app.slug) # return redirect("defect_detail", defect_id=obj.id) else: form = IssueForm(app) context["form"] = form return render(request, "issues/add_defect.html", context)
def settings(request, app_slug): app = get_object_or_404(App, slug=app_slug) if request.method == "POST": form = ApplicationForm(request.POST, instance=app) if form.is_valid(): new_app = form.save() activity = Activity(application=app) activity.action = "Updated the settings on %s" % app.name activity.user = request.user activity.save() return redirect('app', app.slug) else: form = ApplicationForm(instance=app) context = {'form': form, 'app': app} return render(request, 'projects/project_settings.html', context)