django-restit 4.2.44__py3-none-any.whl → 4.2.45__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.
- {django_restit-4.2.44.dist-info → django_restit-4.2.45.dist-info}/METADATA +1 -1
- {django_restit-4.2.44.dist-info → django_restit-4.2.45.dist-info}/RECORD +7 -6
- location/migrations/0003_address_postalcode_suffix.py +18 -0
- location/models/address.py +20 -6
- rest/__init__.py +1 -1
- {django_restit-4.2.44.dist-info → django_restit-4.2.45.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.44.dist-info → django_restit-4.2.45.dist-info}/WHEEL +0 -0
@@ -120,9 +120,10 @@ location/admin.py,sha256=6S97Rlgjkk0jM15sbT1OJRPZbgvKn2rn7duCSazOXq4,297
|
|
120
120
|
location/geolocate.py,sha256=UgV129vmSxnqYFBYJD2RQVOcC1-lJJ1zUaxDqOJRbG4,1694
|
121
121
|
location/migrations/0001_initial.py,sha256=E0Kekah0vfp7VGKGYRHFEIFjFRTkd8QnFGSHNFllVv0,7000
|
122
122
|
location/migrations/0002_geoip_subnet_alter_geoip_ip.py,sha256=n-oJrEnIqN9VnMhiZsr34LF-EXBluPm1lz1zusaMkx8,576
|
123
|
+
location/migrations/0003_address_postalcode_suffix.py,sha256=DT8voJeMiSQyUhH-69NHK9YywaChAvIJn1ztL7fCI30,443
|
123
124
|
location/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
125
|
location/models/__init__.py,sha256=rZhldkoKmoJQXjBAK1IIQn7K_OOJvFtIGOGVl_szqbE,230
|
125
|
-
location/models/address.py,sha256=
|
126
|
+
location/models/address.py,sha256=oTPQiLdg2QkfPorlm16re1OoR6TJf4Of2Ew1slun2r8,2596
|
126
127
|
location/models/ip.py,sha256=ZaBFdW1tL1Q3bnS5gIY9SseiQ5xeeP_oyP1hp3czFeA,5984
|
127
128
|
location/models/legacy.py,sha256=8ROsUSZrjGQkUyXeJvoxPdKAWaKfUH-AL9TIeJb7krg,1994
|
128
129
|
location/models/location.py,sha256=01dJPJecbp5orExsIGWOsBC_KkwFRIW0rGDIwyx1r0w,2316
|
@@ -359,7 +360,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
359
360
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
360
361
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
361
362
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
362
|
-
rest/__init__.py,sha256=
|
363
|
+
rest/__init__.py,sha256=1X-W3BH6L-ujXvvzyMW1tIIeqHcQOhgRzb6isSAl9mY,121
|
363
364
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
364
365
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
365
366
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -492,7 +493,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
492
493
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
493
494
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
494
495
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
495
|
-
django_restit-4.2.
|
496
|
-
django_restit-4.2.
|
497
|
-
django_restit-4.2.
|
498
|
-
django_restit-4.2.
|
496
|
+
django_restit-4.2.45.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
497
|
+
django_restit-4.2.45.dist-info/METADATA,sha256=sjprDnHaz3wHRJMOMfpI0y3UMinbPipZ0aB8mboJGdI,7594
|
498
|
+
django_restit-4.2.45.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
499
|
+
django_restit-4.2.45.dist-info/RECORD,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Generated by Django 4.1.4 on 2024-02-20 21:15
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
|
5
|
+
|
6
|
+
class Migration(migrations.Migration):
|
7
|
+
|
8
|
+
dependencies = [
|
9
|
+
('location', '0002_geoip_subnet_alter_geoip_ip'),
|
10
|
+
]
|
11
|
+
|
12
|
+
operations = [
|
13
|
+
migrations.AddField(
|
14
|
+
model_name='address',
|
15
|
+
name='postalcode_suffix',
|
16
|
+
field=models.CharField(blank=True, default=None, max_length=32, null=True),
|
17
|
+
),
|
18
|
+
]
|
location/models/address.py
CHANGED
@@ -27,6 +27,7 @@ class Address(models.Model, rm.RestModel):
|
|
27
27
|
county = models.CharField(max_length=127, blank=True, null=True, default=None)
|
28
28
|
country = models.CharField(max_length=16, blank=True, null=True, default=None)
|
29
29
|
postalcode = models.CharField(max_length=32, blank=True, null=True, default=None)
|
30
|
+
postalcode_suffix = models.CharField(max_length=32, blank=True, null=True, default=None)
|
30
31
|
lat = models.FloatField(default=0.0, blank=True)
|
31
32
|
lng = models.FloatField(default=0.0, blank=True)
|
32
33
|
|
@@ -35,14 +36,27 @@ class Address(models.Model, rm.RestModel):
|
|
35
36
|
return geolocate.getTimeZone(self.lat, self.lng)
|
36
37
|
return None
|
37
38
|
|
39
|
+
def lookup(self):
|
40
|
+
res = geolocate.search("{}, {}, {}".format(self.line1, self.city, self.state))
|
41
|
+
if isinstance(res, list) and len(res):
|
42
|
+
return res[0]
|
43
|
+
return None
|
44
|
+
|
38
45
|
def refresh(self):
|
39
46
|
try:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
addr = self.lookup()
|
48
|
+
if addr:
|
49
|
+
if addr.county:
|
50
|
+
self.county = addr.county
|
51
|
+
self.country = addr.country
|
52
|
+
if addr.lat:
|
53
|
+
self.lat = addr.lat
|
54
|
+
self.lng = addr.lng
|
55
|
+
if not self.postalcode and addr.postal_code:
|
56
|
+
self.postalcode = addr.postal_code
|
57
|
+
if addr.postal_code_suffix:
|
58
|
+
self.postalcode_suffix = addr.postal_code_suffix
|
59
|
+
super(Address, self).save()
|
46
60
|
except Exception:
|
47
61
|
rh.log_exception("address.refresh")
|
48
62
|
|
rest/__init__.py
CHANGED
File without changes
|
File without changes
|