from patchwork.models import Patch, Project, Person
-from patchwork.filters import Filters
-from patchwork.forms import LoginForm, PatchForm
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, Http404
-from django.db import transaction
-from django.contrib.auth.models import User
-from django.contrib.auth.decorators import login_required
from patchwork.requestcontext import PatchworkRequestContext
from django.core import serializers, urlresolvers
from django.template.loader import render_to_string
context['projects'] = projects
return render_to_response('patchwork/projects.html', context)
-def project(request, project_id):
- context = PatchworkRequestContext(request)
- project = get_object_or_404(Project, linkname = project_id)
- context.project = project
-
- context['maintainers'] = User.objects.filter( \
- userprofile__maintainer_projects = project)
- context['n_patches'] = Patch.objects.filter(project = project,
- archived = False).count()
- context['n_archived_patches'] = Patch.objects.filter(project = project,
- archived = True).count()
-
- return render_to_response('patchwork/project.html', context)
-
def pwclientrc(request, project_id):
project = get_object_or_404(Project, linkname = project_id)
context = PatchworkRequestContext(request)
context.project = project
+ if request.is_secure():
+ context['scheme'] = 'https'
+ else:
+ context['scheme'] = 'http'
response = HttpResponse(mimetype = "text/plain")
response['Content-Disposition'] = 'attachment; filename=.pwclientrc'
response.write(render_to_string('patchwork/pwclientrc', context))