Эх сурвалжийг харах

fix filed resource_id in models

blezz-tech 1 сар өмнө
parent
commit
bf62781ff1

+ 7 - 7
handlers/classes/Order.py

@@ -36,7 +36,7 @@ class Order(object):
             receiver=None,
             receiver_screen_name=None,
             client=None,
-            resource_id=None,
+            resource=None,
             attempts=None,
             asap=None,
             money_limit=None,
@@ -79,7 +79,7 @@ class Order(object):
         self.receiver = receiver
         self.receiver_screen_name = receiver_screen_name
         self.client = client
-        self.resource_id = resource_id
+        self.resource = resource
         self.attempts = attempts
         self.asap = asap
         self.money_limit = money_limit
@@ -124,7 +124,7 @@ class Order(object):
             self.receiver,
             self.receiver_screen_name,
             self.client,
-            self.resource_id,
+            self.resource,
             self.attempts,
             self.asap,
             self.money_limit,
@@ -186,13 +186,13 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 "receiver_screen_name": "Marfa Clientovna",
 "client": 1,
 "client_screen_name": "Fedor Client",
-"resource_id": 1,
+"resource": 1,
 "attempts": null
 }
 '''
 # надо адаптировать класс к новому формату JSON
 # class Order(object):
-#     def __init__(self, id,order_synced, ticket, status, title, note, due_date, id_metaservice, is_global, is_visible, service, service_type, status_changed_date,time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client=None, resource_id=None, attempts=None, asap=None):
+#     def __init__(self, id,order_synced, ticket, status, title, note, due_date, id_metaservice, is_global, is_visible, service, service_type, status_changed_date,time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client=None, resource=None, attempts=None, asap=None):
 #         self.order_synced = order_synced
 #         self.id = id
 #         self.ticket = ticket
@@ -238,11 +238,11 @@ https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
 #         self.receiver = receiver
 #         self.receiver_screen_name = receiver_screen_name
 #         self.client = client
-#         self.resource_id = resource_id
+#         self.resource = resource
 #         self.attempts = attempts
 #         self.asap = asap
 #         #доделать до конца по аналогии с закоммиченным json
 #     def __str__(self):
-#         return "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32} , {33} ,{34}".format(self.order_synced, self.id, self.ticket, self.status, self.title, self.note, self.due_date, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_type, self.status_changed_date, self.time_created,self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client, self.resource_id, self.attempts, self.asap)
+#         return "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32} , {33} ,{34}".format(self.order_synced, self.id, self.ticket, self.status, self.title, self.note, self.due_date, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_type, self.status_changed_date, self.time_created,self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client, self.resource, self.attempts, self.asap)
 
 # \n добавляете в местах с пустой строкой в шаблоне

+ 1 - 1
models/webservice_running.py

@@ -8,7 +8,7 @@ class OrdersLocal(models.Model):
     OrdersLocal - таблица с заказами
     """
     order_synced = models.ForeignKey(Orders, on_delete=models.DO_NOTHING)
-    resource_id = models.ForeignKey(
+    resource = models.ForeignKey(
         Resource,
         null=True,
         on_delete=models.DO_NOTHING