Exemple #1
0
def listings(request):
    listing_query = ListingOwned.objects
    shards = get_all_shards()
    listings_owned = []
    for shard in shards:
        set_db_for_sharding(listing_query, shard)
        listings_owned += listing_query.filter(is_booked=0, is_active=1)
        print('listings',listings_owned)

    print('listings',listings_owned)
    return render(request, 'app/listings.html', {'listings': listings_owned})
Exemple #2
0
def apartments(request):
    apartment_query = ApartmentOwned.objects
    shards = get_all_shards()
    apartments_owned = []

    for shard in shards:
        print shard
        set_db_for_sharding(apartment_query, shard)
        print apartment_query.all()
        apartments_owned += apartment_query.all()
    print('apartments: ',apartments_owned)
    return render(request, 'app/apartments.html', {'apartments': apartments_owned})
Exemple #3
0
def bookings(request):
    booking_query = BookingPlaced.objects
    shards = get_all_shards()
    bookings_owned = []
    
    for shard in shards:
        set_db_for_sharding(booking_query, shard)
        bookings_owned +=  booking_query.all()

    print('bookings',bookings_owned)
   
    return render(request, 'app/bookings.html', {'bookings': bookings_owned})