def edit_developer(request, id): try: dev = models.Developer.objects.get(id = id) except models.Developer.DoesNotExist: raise Http404 if not dev.is_editable: raise Http404 if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): if form.cleaned_data['password'] == dev.password: request.session['dev_edit_rights'] = id redir_url = reverse('jobs_edit_developer_done', args=[id]) return HttpResponseRedirect(redir_url) else: return HttpResponseForbidden('Wrong password. Go back and try again.') if request.method == 'GET': form = PasswordForm() payload = {'form':form} return render_to_response('jobs/editdev.html', payload, RequestContext(request))
def edit_developer(request, id): try: dev = models.Developer.objects.get(id=id) except models.Developer.DoesNotExist: raise Http404 if not dev.is_editable: raise Http404 if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): if form.cleaned_data['password'] == dev.password: request.session['dev_edit_rights'] = id redir_url = reverse('jobs_edit_developer_done', args=[id]) return HttpResponseRedirect(redir_url) else: return HttpResponseForbidden( 'Wrong password. Go back and try again.') if request.method == 'GET': form = PasswordForm() payload = {'form': form} return render_to_response('jobs/editdev.html', payload, RequestContext(request))
order_by = 'created_on' if order_by == 'created_on': order_by = '-created_on' if not order_by in ('name', 'created_on'): order_by = '-created_on' qs = models.Job.objects.all().order_by(order_by) return qs def edit_job(request, id): try: job = models.Job.objects.get(id = id) except models.Job,DoesNotExist: raise Http404 if not job.is_editable: raise Http404 if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): if form.cleaned_data['password'] == job.password: request.session['job_edit_rights'] = id redir_url = reverse('jobs_edit_job_done', args=[id]) return HttpResponseRedirect(redir_url) else: return HttpResponseForbidden('Wrong password. Go back and try again.') if request.method == 'GET': form = PasswordForm() payload = {'form':form} return render_to_response('jobs/editdev.html', payload, RequestContext(request)) def edit_developer(request, id): try: dev = models.Developer.objects.get(id = id)
if order_by == 'created_on': order_by = '-created_on' if not order_by in ('name', 'created_on'): order_by = '-created_on' qs = models.Job.objects.all().order_by(order_by) return qs def edit_job(request, id): try: job = models.Job.objects.get(id=id) except models.Job, DoesNotExist: raise Http404 if not job.is_editable: raise Http404 if request.method == 'POST': form = PasswordForm(request.POST) if form.is_valid(): if form.cleaned_data['password'] == job.password: request.session['job_edit_rights'] = id redir_url = reverse('jobs_edit_job_done', args=[id]) return HttpResponseRedirect(redir_url) else: return HttpResponseForbidden( 'Wrong password. Go back and try again.') if request.method == 'GET': form = PasswordForm() payload = {'form': form} return render_to_response('jobs/editdev.html', payload, RequestContext(request))