Beispiel #1
0
def load_categories(request):
        '''load_categories is a method used by the mobiles to load available categories and dependencies'''
        all_categories = ReportCategory.objects.all().order_by('category_class','secondary_category_class')
        #Right !
        return HttpResponse(ReportCategory.listToJSON(all_categories), mimetype='application/json')
Beispiel #2
0
def secondary_category_for_main_category(request):
    main_category_id = int(request.GET["main_category"])
    secondary_categories = ReportCategory.objects.filter(category_class=main_category_id)
    jsonstring = ReportCategory.listToJSON(secondary_categories)
    return HttpResponse(jsonstring, mimetype="application/json")