django-restit 4.1.39__py3-none-any.whl → 4.1.40__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.1.39
3
+ Version: 4.1.40
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -343,7 +343,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
343
343
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
344
344
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
345
345
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
346
- rest/__init__.py,sha256=WCk9nGwCFbBQVug3zr3M079Ai-Et6ZKbfVT4QHH04Tg,121
346
+ rest/__init__.py,sha256=qEmZBxIJWeZCVLWbDDx_XIDFv831Xv6nqEGRAnU33JA,121
347
347
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
348
348
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
349
349
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -385,10 +385,10 @@ rest/rpc.py,sha256=8n6LdtUyLqpwvdH1dtVT1e2ODYxOj1CEYs8mm_-vqwA,3612
385
385
  rest/search.py,sha256=UPnUldROiq65KmnEn-FIsgnpxk0wcXVu7I2NGfB7A-Q,7645
386
386
  rest/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
387
387
  rest/serializers/collection.py,sha256=7vDmuz6alautQVr9VsVCFQdQdJcZR9tkrOEs2b_mKQw,2015
388
- rest/serializers/csv.py,sha256=nae_SIIpDH7HReErjNacVxEujzTvJqQxHd29BY-RXh0,2975
388
+ rest/serializers/csv.py,sha256=CVD0erB2Ebl7mqgrMAZ2FxZSZpyVDCoSS4FHiEjuvDM,3252
389
389
  rest/serializers/excel.py,sha256=KtxqZZU5Huzo31tyVVWbshMudeSAImKLO71ufQQt0-c,1077
390
390
  rest/serializers/json.py,sha256=R1has2PZQuXacA6WwfdrBnMG4rSM6CrnXQOhGoAU6Dk,1736
391
- rest/serializers/legacy.py,sha256=AhwXFZQQ2XedV5ztQiHPbDRkd4vDX1iTejZrHH-r5Gs,61795
391
+ rest/serializers/legacy.py,sha256=LgU8Sr7yFoiOso1Tb-LkJ-vphGcbEc4BKuSCCuD62R8,61800
392
392
  rest/serializers/model.py,sha256=kbwtREE--n7YKUfTzErfYhHsgiuqnLdS52z1owrXaQI,7532
393
393
  rest/serializers/profiler.py,sha256=OxOimhEyvCAuzUBC9Q1dz2xaakjAqmSnekMATsjduXM,997
394
394
  rest/serializers/response.py,sha256=8PtxZznl8E_OQbCA1epIHcMxSJJYf9VOW_syXh19nz4,6509
@@ -474,7 +474,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
474
474
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
475
475
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
476
476
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
477
- django_restit-4.1.39.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
478
- django_restit-4.1.39.dist-info/METADATA,sha256=ufCEq9L9tZDuAUoEGIpYsosJQfxGQHMjg4LeS0cFDVQ,7573
479
- django_restit-4.1.39.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
480
- django_restit-4.1.39.dist-info/RECORD,,
477
+ django_restit-4.1.40.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
478
+ django_restit-4.1.40.dist-info/METADATA,sha256=Sm4DNuvkHqUeY2ZqBYmql_qo9BrmwWxp6Usuj02yjAU,7573
479
+ django_restit-4.1.40.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
480
+ django_restit-4.1.40.dist-info/RECORD,,
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.1.39"
4
+ __version__ = "4.1.40"
rest/serializers/csv.py CHANGED
@@ -5,38 +5,42 @@ import csv
5
5
 
6
6
 
7
7
  def flattenObject(obj, field_names):
8
- NOT_FOUND = "-!@#$%^&*()-"
9
-
10
8
  row = []
11
9
  for f in field_names:
12
- d = getattr(obj, f, NOT_FOUND)
13
- if d != NOT_FOUND:
14
- if callable(d):
15
- d = d()
16
- elif "." in f:
17
- f1, f2 = f.split('.')
18
- d1 = getattr(obj, f1, None)
19
- if d1:
20
- if not hasattr(d1, f2):
21
- if hasattr(d1, "first"):
22
- d1 = d1.first()
23
- d = getattr(d1, f2, "")
10
+ d = ""
11
+ if "__" in f:
12
+ f = f.replace("__", ".")
13
+ if "." in f:
14
+ # we could use obj.getFieldValue
15
+ keys = f.split('.')
16
+ f1 = keys[0]
17
+ f2 = keys[1]
18
+ if f1 == "metadata" and hasattr(obj, "getProperty"):
19
+ if len(keys) > 2:
20
+ d = obj.getProperty(f2, category=keys[2])
21
+ else:
22
+ d = obj.getProperty(f2)
23
+ elif hasattr(obj, "getFieldValue"):
24
+ d = obj.getFieldValue(f, "t/a")
24
25
  if callable(d):
25
26
  d = d()
26
27
  else:
27
- d = ""
28
- elif "__" in f:
29
- f1, f2 = f.split('__')
30
- d1 = getattr(obj, f1, None)
31
- if d1:
32
- if not hasattr(d1, f2):
33
- if hasattr(d1, "first"):
34
- d1 = d1.first()
35
- d = getattr(d1, f2, "")
36
- else:
37
- d = ""
28
+ d1 = getattr(obj, f1, None)
29
+ if d1 is not None:
30
+ if not hasattr(d1, f2):
31
+ if hasattr(d1, "first"):
32
+ d1 = d1.first()
33
+ d = getattr(d1, f2, "")
34
+ if callable(d):
35
+ d = d()
38
36
  else:
37
+ d = getattr(obj, f, "n/a")
38
+ if callable(d):
39
+ d = d()
40
+ if d is None:
39
41
  d = "n/a"
42
+ elif hasattr(d, "pk"):
43
+ d = d.pk
40
44
  row.append(str(d))
41
45
  return row
42
46
 
@@ -226,6 +226,7 @@ class RawQuery(object):
226
226
  sql += " OFFSET %d" % self.offset
227
227
 
228
228
  return sql + ";"
229
+
229
230
  def run(self):
230
231
  return self.model.objects.raw(self.sql())
231
232