def get_funds_schemes_type(request, amc, type): """ Returns the schemes based on schemes amc and type. """ ret = Scheme.objects.get_funds(amc=amc, type=type) ser = SchemeSerializer(ret, many=True) return Response(ser.data)
def schem_list(request): """ Returns a list of all **Schemes** in the system. """ schem = Scheme.objects.all() serial = SchemeSerializer(schem, many=True) return Response(serial.data)
def get_funds_schemes(request, amc, type, sub_type): """ Returns the Schemes based on schemes type and sub_type and amc. """ ret = Scheme.objects.get_funds(amc=amc, type=type, sub_type=sub_type) ser = SchemeSerializer(ret, many=True) return Response(ser.data)
def get_probable_list_for_mismatch(request, amc): amc = AMC.objects.filter(name=amc).first() if amc: ret = Scheme.objects.raw( "SELECT * FROM `todo_scheme` WHERE amc_id = " + str(amc.id) + " and id not in (SELECT todo_scheme_info.scheme_id from todo_scheme_info)" ) ser = SchemeSerializer(ret, many=True) return Response(ser.data) else: return Response("amc not found" + amc, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def get_funds_without_category_or_sub_category(request): cats = Scheme.get_fund_categorization() types = [] subtypes = [] for key in cats: types.append(key) for row in cats[key]: subtypes.append(row["Text"]) # print(row['Text'], "xxx", row['Value']) ret = Scheme.objects.exclude( Q(scheme_type__in=types) or Q(scheme_sub_type__in=subtypes)) ser = SchemeSerializer(ret, many=True) return Response(ser.data)
def get_funds_amc(request, type, sub_type): """ Returns the AMC based on schemes type and sub_type. """ ret = Scheme.objects.get_funds(type=type, sub_type=sub_type) ser = SchemeSerializer(ret, many=True) unique = [] for data in ser.data: if data['amc'] not in unique: unique.append(data['amc']) else: pass response = [] for elem in unique: resp = AMC.objects.get(id=elem) serial = AMCSerializer(resp, many=False) response.append(serial.data) return Response(response)
def get_funds(request, type, sub_type): ret = Scheme.objects.get_funds(type=type, sub_type=sub_type) ser = SchemeSerializer(ret, many=True) return Response(ser.data)
def get_schemes(request, amc_id): ret = Scheme.objects.all().filter(amc=amc_id) ser = SchemeSerializer(ret, many=True) return Response(ser.data)