Exemple #1
0
def all_subject_types(request):
    manager = get_database_manager(request.user)
    subjects_data = load_subject_type_with_projects(manager)
    subjects_count = get_subjects_count(manager)
    if "deleted_subject" in request.GET.keys():
        deleted_subject_error_message = _(
            'Sorry. The Identification Number Type you are looking for has been deleted'
        )
        return render_to_response(
            'entity/all_subject_types.html', {
                'all_data': subjects_data,
                'current_language': translation.get_language(),
                'subjects_count': subjects_count,
                'is_pro_sms': get_organization(request).is_pro_sms,
                'deleted_subject_error_message':
                [deleted_subject_error_message],
            },
            context_instance=RequestContext(request))
    else:
        return render_to_response(
            'entity/all_subject_types.html', {
                'all_data': subjects_data,
                'is_pro_sms': get_organization(request).is_pro_sms,
                'current_language': translation.get_language(),
                'subjects_count': subjects_count,
            },
            context_instance=RequestContext(request))
 def test_should_get_count_of_registered_subjects(self):
     self.manager.view.count_non_voided_entities_by_type = Mock(
         return_value=[Row({
             'key': ['clinic'],
             'value': 10
         })])
     subject_count = get_subjects_count(self.manager)
     self.assertEquals(subject_count.get('clinic'), 10)
Exemple #3
0
def all_subject_types(request):
    manager = get_database_manager(request.user)
    subjects_data = load_subject_type_with_projects(manager)
    subjects_count = get_subjects_count(manager)
    return render_to_response('entity/all_subject_types.html', {
        'all_data': subjects_data,
        'current_language': translation.get_language(),
        'subjects_count': subjects_count,
    },
                              context_instance=RequestContext(request))