changes
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,6 +29,9 @@ def data_deletion(request):
|
||||
Contract.objects.all().delete()
|
||||
Product_Booked.objects.all().delete()
|
||||
Transaction_File.objects.all().delete()
|
||||
Co_Ownership.objects.all().delete()
|
||||
Transaction_Current.objects.all().delete()
|
||||
Transaction_Discount.objects.all().delete()
|
||||
Payment_Schedule.objects.all().delete()
|
||||
Transaction_Detail.objects.all().delete()
|
||||
Transaction.objects.all().delete()
|
||||
|
||||
17
app/views.py
17
app/views.py
@@ -343,7 +343,24 @@ def data_list(request, name):
|
||||
need_serializer = True
|
||||
filter_list = Q()
|
||||
if filter_or != None:
|
||||
field_map = {f.name: f for f in Model._meta.get_fields()}
|
||||
for key, value in ast.literal_eval(filter_or).items():
|
||||
lookup_parts = key.split('__')
|
||||
base_field_name = lookup_parts[0]
|
||||
|
||||
if base_field_name not in field_map:
|
||||
continue
|
||||
|
||||
field_obj = field_map[base_field_name]
|
||||
|
||||
if field_obj.is_relation and len(lookup_parts) == 2 and lookup_parts[1] == 'icontains':
|
||||
continue
|
||||
|
||||
is_numeric = isinstance(field_obj, (aggregator.IntegerField, aggregator.DecimalField, aggregator.FloatField))
|
||||
is_date = isinstance(field_obj, (aggregator.DateField, aggregator.DateTimeField))
|
||||
if (is_numeric or is_date) and key.endswith('__icontains'):
|
||||
continue
|
||||
|
||||
filter_list.add(Q(**{key: value}), Q.OR)
|
||||
|
||||
if filter != None:
|
||||
|
||||
Reference in New Issue
Block a user