Example #1
0
def measures_for_one_ccg(request, ccg_code):
    requested_ccg = get_object_or_404(PCT, code=ccg_code)
    if request.method == 'POST':
        form = _handleCreateBookmark(request, OrgBookmark, OrgBookmarkForm,
                                     'pct')
        if isinstance(form, HttpResponseRedirect):
            return form
    else:
        form = OrgBookmarkForm(initial={
            'pct': requested_ccg.pk,
            'email': getattr(request.user, 'email', '')
        })
    if request.user.is_authenticated():
        signed_up_for_alert = request.user.orgbookmark_set.filter(
            pct=requested_ccg)
    else:
        signed_up_for_alert = False
    practices = Practice.objects.filter(ccg=requested_ccg).filter(
        setting=4).order_by('name')
    context = {
        'ccg': requested_ccg,
        'practices': practices,
        'page_id': ccg_code,
        'form': form,
        'signed_up_for_alert': signed_up_for_alert
    }
    return render(request, 'measures_for_one_ccg.html', context)
Example #2
0
def measures_for_one_practice(request, code):
    p = get_object_or_404(Practice, code=code)
    if request.method == 'POST':
        form = _handleCreateBookmark(request, OrgBookmark, OrgBookmarkForm,
                                     'practice')
        if isinstance(form, HttpResponseRedirect):
            return form
    else:
        form = OrgBookmarkForm(initial={
            'practice': p.pk,
            'email': getattr(request.user, 'email', '')
        })
    if request.user.is_authenticated():
        signed_up_for_alert = request.user.orgbookmark_set.filter(practice=p)
    else:
        signed_up_for_alert = False
    alert_preview_action = reverse('preview-practice-bookmark', args=[p.code])
    context = {
        'practice': p,
        'alert_preview_action': alert_preview_action,
        'page_id': code,
        'form': form,
        'signed_up_for_alert': signed_up_for_alert
    }
    return render(request, 'measures_for_one_practice.html', context)