def signoff(request, locale_code, app_code): """View to show recent sign-offs and opportunities to sign off. This view is the main entry point to localizers to add sign-offs and to review what they're shipping. It's also the entry point for drivers to review existing sign-offs. """ appver = get_object_or_404(AppVersion, code=app_code) lang = get_object_or_404(Locale, code=locale_code) # which pushes to show real_av, flags = (flags4appversions( locales={'id': lang.id}, appversions={'id': appver.id}) .get(appver, {}) .get(lang.code, [None, {}])) actions = list(Action.objects.filter(id__in=flags.values()) .select_related('signoff__push__repository', 'author')) # get current status of signoffs push4action = dict((a.id, a.signoff.push) for a in actions) pending = push4action.get(flags.get(Action.PENDING)) rejected = push4action.get(flags.get(Action.REJECTED)) accepted = push4action.get(flags.get(Action.ACCEPTED)) if real_av != appver.code and accepted is not None: # we're falling back, add the accepted push to the table fallback = accepted else: fallback = None pushes, suggested_signoff = annotated_pushes(appver, lang, actions, flags, fallback) return render(request, 'shipping/signoffs.html', { 'appver': appver, 'language': lang, 'pushes': pushes, 'pending': pending, 'rejected': rejected, 'accepted': accepted, 'suggested_signoff': suggested_signoff, 'login_form_needs_reload': True, 'fallback': fallback, 'real_av': real_av, })
def signoff(request, locale_code, app_code): """View to show recent sign-offs and opportunities to sign off. This view is the main entry point to localizers to add sign-offs and to review what they're shipping. It's also the entry point for drivers to review existing sign-offs. """ appver = get_object_or_404(AppVersion, code=app_code) lang = get_object_or_404(Locale, code=locale_code) forest = appver.tree.l10n repo = get_object_or_404(Repository, locale=lang, forest=forest) # which pushes to show actions = list(a_id for a_id, flag in \ signoff_actions(appversions={'id': appver.id}, locales={'id': lang.id})) actions = list(Action.objects.filter(id__in=actions) .select_related('signoff__push', 'author')) # get current status of signoffs pending, rejected, accepted, initial_diff = signoff_summary(actions) pushes, currentpush, suggested_signoff = annotated_pushes(repo, appver, lang, actions, initial_diff) return render(request, 'shipping/signoffs.html', { 'appver': appver, 'language': lang, 'pushes': pushes, 'current': currentpush, 'pending': pending, 'rejected': rejected, 'accepted': accepted, 'tree': appver.tree.code, 'repo': repo, 'suggested_signoff': suggested_signoff, 'login_form_needs_reload': True, 'request': request, })