bnovo plugin
scheduller
This commit is contained in:
@@ -4,9 +4,7 @@ from .models import (
|
||||
Hotel,
|
||||
UserHotel,
|
||||
APIConfiguration,
|
||||
APIRequestLog,
|
||||
Reservation,
|
||||
Guest,
|
||||
FraudLog
|
||||
)
|
||||
from django.urls import path
|
||||
@@ -69,22 +67,6 @@ class UserHotelAdmin(admin.ModelAdmin):
|
||||
# ordering = ('-hotel',)
|
||||
|
||||
|
||||
@admin.register(APIConfiguration)
|
||||
class ApiConfigurationAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'url', 'token', 'username', 'password', 'last_updated')
|
||||
search_fields = ('name', 'url', 'token', 'username')
|
||||
list_filter = ('last_updated',)
|
||||
ordering = ('-last_updated',)
|
||||
|
||||
|
||||
@admin.register(APIRequestLog)
|
||||
class ApiRequestLogAdmin(admin.ModelAdmin):
|
||||
list_display = ('api', 'request_time', 'response_status', 'response_data')
|
||||
search_fields = ('api__name', 'request_time', 'response_status')
|
||||
list_filter = ('api', 'response_status', 'request_time')
|
||||
ordering = ('-request_time',)
|
||||
|
||||
|
||||
@admin.register(Reservation)
|
||||
class ReservationAdmin(admin.ModelAdmin):
|
||||
list_display = ('reservation_id', 'hotel', 'room_number', 'room_type', 'check_in', 'check_out', 'status', 'price', 'discount')
|
||||
@@ -93,9 +75,3 @@ class ReservationAdmin(admin.ModelAdmin):
|
||||
ordering = ('-check_in',)
|
||||
|
||||
|
||||
@admin.register(Guest)
|
||||
class GuestAdmin(admin.ModelAdmin):
|
||||
list_display = ('reservation', 'name', 'birthdate', 'phone', 'email')
|
||||
search_fields = ('reservation__reservation_id', 'name', 'phone', 'email')
|
||||
list_filter = ('reservation',)
|
||||
ordering = ('-reservation',)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import json
|
||||
import pandas as pd
|
||||
|
||||
# Load the JSON file
|
||||
file_path = '../../modules/analyzed_9.json'
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
data = json.load(file)
|
||||
|
||||
# Process the data into a structured format
|
||||
reservations = []
|
||||
for booking in data:
|
||||
for guest in booking.get("guests", []):
|
||||
reservations.append({
|
||||
"Reservation ID": booking.get("id"),
|
||||
"Hotel Name": booking.get("hotelName"),
|
||||
"Room Number": booking.get("roomNumber"),
|
||||
"Room Type": booking.get("roomTypeName"),
|
||||
"Check-in": booking.get("from"),
|
||||
"Check-out": booking.get("until"),
|
||||
"Status": booking.get("checkInStatus"),
|
||||
"Price": booking.get("reservationPrice"),
|
||||
"Discount": booking.get("discount"),
|
||||
"Guest Name": f"{guest.get('lastName', '')} {guest.get('firstName', '')} {guest.get('middleName', '')}".strip(),
|
||||
"Guest Birthdate": guest.get("birthDate"),
|
||||
"Guest Phone": guest.get("phone"),
|
||||
"Guest Email": guest.get("email"),
|
||||
})
|
||||
|
||||
# Convert to DataFrame for better visualization
|
||||
df_reservations = pd.DataFrame(reservations)
|
||||
|
||||
# Display the structured data
|
||||
import ace_tools as tools; tools.display_dataframe_to_user(name="Structured Reservations Data", dataframe=df_reservations)
|
||||
Reference in New Issue
Block a user