Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
806 B
11
Indexable
Never
@app.route('/hos_cart_details/<event_date>')
def get_hos_cart_details(event_date):
    # Fetch hoscd_event_date details using the model class
    results = HosCartDetails.objects.filter(hoscd_event_date=event_date)
    data = [{
        'hoscd_event_date': r.hoscd_event_date,
        'hoscd_buid': r.hoscd_buid,
        'hoscd_createdtime': r.hoscd_createdtime,
        'hoscd_opid': r.hoscd_opid,
        'hoscd_status': r.hoscd_status,
        'hoscd_type': r.hoscd_type,
        'hoscd_updatedtime': r.hoscd_updatedtime,
        'hoscd_username': r.hoscd_username,
        'hoscd_value': r.hoscd_value,
        'hoscd_valuetype': r.hoscd_valuetype
    } for r in results]

    # Get the count of records for the given date
    count = results.count()

    return jsonify({'data': data, 'count': count})