def view(request, project_id): try: project = Project.objects.get(pk=project_id) except: return HttpResponse(status=404, content='Project not found') if project.redirectto_project: do_redirect = 'false' != request.GET.get('redirect') if do_redirect: return redirect(project.redirectto_project.get_view_link()) stats = stats_services.project_stats(project) issues_sponsoring = issue_services.search_issues(project_id=project_id, is_sponsored=True)[0:3] issues_kickstarting = issue_services.search_issues(project_id=project_id, is_sponsored=False)[0:3] issues_sponsoring = json.dumps(issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps(issue_services.to_card_dict(issues_kickstarting)) top_sponsors = stats_services.project_top_sponsors(project_id)[0:5] top_programmers = stats_services.project_top_programmers(project_id)[0:5] is_watching = request.user.is_authenticated() and watch_services.is_watching_project(request.user, project.id) return render_to_response('core2/project.html', {'project': project, 'stats': stats, 'tags': json.dumps([t.name for t in project.get_tags()]), 'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting, 'top_sponsors': top_sponsors, 'top_programmers': top_programmers, 'is_watching': is_watching, }, context_instance=RequestContext(request))
def view(request, project_id): try: project = Project.objects.get(pk=project_id) except: return HttpResponse(status=404, content='Project not found') if project.redirectto_project: do_redirect = 'false' != request.GET.get('redirect') if do_redirect: return redirect(project.redirectto_project.get_view_link()) stats = stats_services.project_stats(project) issues_sponsoring = issue_services.search_issues(project_id=project_id, is_sponsored=True)[0:3] issues_kickstarting = issue_services.search_issues(project_id=project_id, is_sponsored=False)[0:3] issues_sponsoring = json.dumps( issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps( issue_services.to_card_dict(issues_kickstarting)) top_sponsors = stats_services.project_top_sponsors(project_id)[0:5] top_programmers = stats_services.project_top_programmers(project_id)[0:5] is_watching = request.user.is_authenticated( ) and watch_services.is_watching_project(request.user, project.id) return render_to_response( 'core2/project.html', { 'project': project, 'stats': stats, 'tags': json.dumps([t.name for t in project.get_tags()]), 'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting, 'top_sponsors': top_sponsors, 'top_programmers': top_programmers, 'is_watching': is_watching, }, context_instance=RequestContext(request))
def home(request): issues_sponsoring = issue_services.search_issues(is_sponsored=True)[0:3] issues_kickstarting = issue_services.search_issues(is_sponsored=False)[0:3] crumbs = [HOME_CRUMB] issues_sponsoring = json.dumps(issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps(issue_services.to_card_dict(issues_kickstarting)) return render_to_response('core2/home.html', {'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting, 'crumbs': crumbs}, context_instance=RequestContext(request))
def home(request): issues_sponsoring = issue_services.search_issues(is_public_suggestion=False)[0:3] issues_kickstarting = issue_services.search_issues(is_public_suggestion=True)[0:3] crumbs = [HOME_CRUMB] issues_sponsoring = json.dumps(issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps(issue_services.to_card_dict(issues_kickstarting)) return render_to_response(template_folder(request) + 'home.html', {'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting, 'crumbs': crumbs}, context_instance=RequestContext(request))
def home(request): if request.user.is_authenticated() and request.user.getUserInfo() is None: return redirect('/core/user/edit') _is_new_layout = is_new_layout(request) size = 3 if _is_new_layout else 20 issues_sponsoring = issue_services.search_issues(is_public_suggestion=False)[0:size] issues_kickstarting = issue_services.search_issues(is_public_suggestion=True)[0:size] if _is_new_layout: issues_sponsoring = json.dumps(issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps(issue_services.to_card_dict(issues_kickstarting)) return render_to_response(template_folder(request) + 'home.html', {'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting}, context_instance=RequestContext(request))
def view(request, project_id): project = Project.objects.get(pk=project_id) stats = stats_services.project_stats(project) issues_sponsoring = issue_services.search_issues(project_id=project_id, is_public_suggestion=False)[0:3] issues_kickstarting = issue_services.search_issues(project_id=project_id, is_public_suggestion=True)[0:3] issues_sponsoring = json.dumps(issue_services.to_card_dict(issues_sponsoring)) issues_kickstarting = json.dumps(issue_services.to_card_dict(issues_kickstarting)) top_sponsors = stats_services.project_top_sponsors(project_id)[0:5] top_programmers = stats_services.project_top_programmers(project_id)[0:5] return render_to_response('core2/project.html', {'project': project, 'stats': stats, 'tags': json.dumps([t.name for t in project.get_tags()]), 'issues_sponsoring': issues_sponsoring, 'issues_kickstarting': issues_kickstarting, 'top_sponsors': top_sponsors, 'top_programmers': top_programmers, }, context_instance=RequestContext(request))
def list_issue_cards(request): offset = int(request.GET.get('offset')) count = int(request.GET.get('count')) if not count: count = 3 proposed = 'proposed' in request.GET count = min(count, 100) query = issue_services.search_issues(is_public_suggestion=proposed) total_count = query.count() issues = query[offset:offset + count] issues = issue_services.to_card_dict(issues) result = {'count': total_count, 'issues': issues} return HttpResponse(json.dumps(result))
def list_issue_cards(request): offset = int(request.GET.get('offset')) count = int(request.GET.get('count')) if not count: count = 3 proposed = 'proposed' in request.GET count = min(count, 100) query = issue_services.search_issues(is_public_suggestion=proposed) total_count = query.count() issues = query[offset: offset + count] issues = issue_services.to_card_dict(issues) result = { 'count': total_count, 'issues': issues } return HttpResponse(json.dumps(result))
def list_issue_cards(request): offset = int(request.GET.get('offset')) count = int(request.GET.get('count')) if not count: count = 3 sponsoring = request.GET.get('sponsoring').lower() == 'true' count = min(count, 100) query = issue_services.search_issues(is_public_suggestion=not sponsoring) total_count = query.count() issues = query[offset: offset + count] issues = issue_services.to_card_dict(issues) result = { 'count': total_count, 'issues': issues } return HttpResponse(json.dumps(result))
def list_issue_cards(request): project_id = None if 'project_id' in request.GET: project_id = int(request.GET.get('project_id')) offset = int(request.GET.get('offset')) count = int(request.GET.get('count')) if not count: count = 3 is_sponsored = request.GET.get('sponsoring').lower() == 'true' count = min(count, 100) query = issue_services.search_issues(project_id=project_id, is_sponsored=is_sponsored) total_count = query.count() issues = query[offset:offset + count] issues = issue_services.to_card_dict(issues) result = {'count': total_count, 'issues': issues} return HttpResponse(json.dumps(result))
def list_issue_cards(request): project_id = None if 'project_id' in request.GET: project_id = int(request.GET.get('project_id')) offset = int(request.GET.get('offset')) count = int(request.GET.get('count')) if not count: count = 3 is_sponsored = request.GET.get('sponsoring').lower() == 'true' count = min(count, 100) query = issue_services.search_issues(project_id=project_id, is_sponsored=is_sponsored) total_count = query.count() issues = query[offset: offset + count] issues = issue_services.to_card_dict(issues) result = { 'count': total_count, 'issues': issues } return HttpResponse(json.dumps(result))