Browse Source

fixed orders models nulls

ShariX Developer 1 day ago
parent
commit
30471530fb
2 changed files with 43 additions and 39 deletions
  1. 39 39
      lib/dicts.py
  2. 4 0
      models/orders.py

+ 39 - 39
lib/dicts.py

@@ -11,18 +11,18 @@ def reverse_obj(obj):
 
 
 neg_type = {
-    "disfollow": 0,
-    "prefer": 1,
-    "employee": 2,
-    "contract": 3,
-    "client": 4
+    "disfollow": "0",
+    "prefer": "1",
+    "employee": "2",
+    "contract": "3",
+    "client": "4",
 }
 neg_type_by_code = reverse_obj(neg_type)
 
 type_legal_form = {
-    "self-employed": 0,
-    "ip": 1,
-    "company": 2
+    "self-employed": "0",
+    "ip": "1",
+    "company": "2",
 }
 type_legal_form_by_code = reverse_obj(type_legal_form)
 
@@ -71,18 +71,18 @@ permissions_type = {
 permissions_type_by_code = reverse_obj(permissions_type)
 
 initiator_type = {
-    "manual": 0,
-    "self": 1,
-    "another_user": 2,
-    "metaservice_event": 3,
-    "platform_event": 4
+    "manual": "0",
+    "self": "1",
+    "another_user": "2",
+    "metaservice_event": "3",
+    "platform_event": "4",
 }
 initiator_type_by_code = reverse_obj(initiator_type)
 
 event_type = {
-    "add": 1,
-    "del": 2,
-    "change": 3
+    "add": "1",
+    "del": "2",
+    "change": "3",
 }
 event_type_by_code = reverse_obj(event_type)
 
@@ -91,7 +91,7 @@ status = {
     "true": "t",
     "disabled": "d",
     "switch": "s",
-    "error": "e"
+    "error": "e",
 }
 status_by_code = reverse_obj(status)
 
@@ -128,52 +128,52 @@ doc_type = reverse_obj(doc_type_by_code)
 # FIXME: Примеры
 
 price_type = {
-    "time": 1,
-    "distance": 2,
-    "instance": 3,
-    "tpd": 4,
-    "ipd": 5,
-    "ipt": 6
+    "time": "1",
+    "distance": "2",
+    "instance": "3",
+    "tpd": "4",
+    "ipd": "5",
+    "ipt": "6",
 }
 price_type_by_code = reverse_obj(price_type)
 
 location_type = {
-    "static": 0,
-    "dynamic": 1
+    "static": "0",
+    "dynamic": "1",
 }
 location_type_by_code = reverse_obj(location_type)
 
 provider_type = {
-    "partner": 1,
-    "responsible_person": 2,
-    "service_provider": 3
+    "partner": "1",
+    "responsible_person": "2",
+    "service_provider": "3",
 }
 provider_type_by_code = reverse_obj(provider_type)
 
 service_status = {
-    "online": 1,
-    "offline": 2,
-    "gap": 3
+    "online": "1",
+    "offline": "2",
+    "gap": "3",
 }
 service_status_by_code = reverse_obj(service_status)
 
 activity_status = {
-    "active": 0,
-    "deactivated": 1,
-    "deleted": 2
+    "active": "0",
+    "deactivated": "1",
+    "deleted": "2",
 }
 activity_status_by_code = reverse_obj(activity_status)
 
 transaction_type = {
-    "active": 0,
-    "deactivated": 1
+    "active": "0",
+    "deactivated": "1",
 }
 transaction_type_by_code = reverse_obj(transaction_type)
 
 tax_method = {
-    "Main": 0,
-    "Simple1": 1,
-    "Simple2": 2
+    "Main": "0",
+    "Simple1": "1",
+    "Simple2": "2",
 }
 tax_method_by_code = reverse_obj(tax_method)
 

+ 4 - 0
models/orders.py

@@ -44,6 +44,7 @@ class Orders(models.Model):
     )
     note = models.CharField(
         max_length=150,
+        null=True,
         help_text=HelpTexts.note,
         default='Записи'
     )
@@ -71,12 +72,15 @@ class Orders(models.Model):
         help_text=HelpTexts.time_finish_real
     )
     time_finish_predicted = models.DateTimeField(
+        null=True,
         help_text=HelpTexts.time_finish_predicted
     )
     real_price = models.FloatField(
+        null=True,
         help_text=HelpTexts.real_price
     )
     predicted_price = models.FloatField(
+        null=True,
         help_text=HelpTexts.predicted_price
     )
     # NOTE: Возможно в будующем можнос сделать символом