django-restit 4.2.44__py3-none-any.whl → 4.2.46__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.
- account/migrations/0019_group_location.py +20 -0
- account/models/group.py +17 -4
- {django_restit-4.2.44.dist-info → django_restit-4.2.46.dist-info}/METADATA +1 -1
- {django_restit-4.2.44.dist-info → django_restit-4.2.46.dist-info}/RECORD +13 -9
- location/migrations/0003_address_postalcode_suffix.py +18 -0
- location/migrations/0004_remove_address_modified_by_address_group_and_more.py +36 -0
- location/models/address.py +34 -7
- location/rpc/__init__.py +1 -0
- location/rpc/address.py +8 -0
- rest/__init__.py +1 -1
- rest/models/base.py +10 -0
- {django_restit-4.2.44.dist-info → django_restit-4.2.46.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.44.dist-info → django_restit-4.2.46.dist-info}/WHEEL +0 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# Generated by Django 4.1.4 on 2024-02-23 20:55
|
2
|
+
|
3
|
+
from django.db import migrations, models
|
4
|
+
import django.db.models.deletion
|
5
|
+
|
6
|
+
|
7
|
+
class Migration(migrations.Migration):
|
8
|
+
|
9
|
+
dependencies = [
|
10
|
+
('location', '0004_remove_address_modified_by_address_group_and_more'),
|
11
|
+
('account', '0018_userpasskey'),
|
12
|
+
]
|
13
|
+
|
14
|
+
operations = [
|
15
|
+
migrations.AddField(
|
16
|
+
model_name='group',
|
17
|
+
name='location',
|
18
|
+
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='location.address'),
|
19
|
+
),
|
20
|
+
]
|
account/models/group.py
CHANGED
@@ -38,6 +38,10 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
38
38
|
# this is the new model for groups having multiple parents
|
39
39
|
children = models.ManyToManyField("self", related_name="parents", symmetrical=False)
|
40
40
|
|
41
|
+
location = models.ForeignKey(
|
42
|
+
"location.Address", default=None, null=True, blank=True,
|
43
|
+
related_name="+", on_delete=models.SET_NULL)
|
44
|
+
|
41
45
|
class RestMeta:
|
42
46
|
SEARCH_FIELDS = [
|
43
47
|
"name"
|
@@ -76,7 +80,8 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
76
80
|
"default": {
|
77
81
|
"graphs": {
|
78
82
|
"self": "basic",
|
79
|
-
"parent": "basic"
|
83
|
+
"parent": "basic",
|
84
|
+
"location": "basic"
|
80
85
|
},
|
81
86
|
"fields": ["metadata"],
|
82
87
|
},
|
@@ -84,9 +89,17 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
84
89
|
"graphs": {
|
85
90
|
"self": "basic",
|
86
91
|
"parent": "basic",
|
87
|
-
"children": "basic"
|
92
|
+
"children": "basic",
|
93
|
+
"location": "basic"
|
88
94
|
},
|
89
|
-
"
|
95
|
+
"extra": ["metadata"],
|
96
|
+
},
|
97
|
+
"location": {
|
98
|
+
"fields": ["name", "kind", "id"],
|
99
|
+
"extra": ["location"],
|
100
|
+
"graphs": {
|
101
|
+
"location": "basic"
|
102
|
+
}
|
90
103
|
},
|
91
104
|
"abstract": {
|
92
105
|
"fields": [
|
@@ -157,7 +170,7 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
157
170
|
raise PermissionDeniedException("invalid parent")
|
158
171
|
qset = qset.filter(parent=parent)
|
159
172
|
elif child_of:
|
160
|
-
parent =
|
173
|
+
parent = request.member.getGroup(child_of)
|
161
174
|
if parent:
|
162
175
|
request.group = None
|
163
176
|
return parent.getAllChildren(grand_children=True)
|
@@ -18,11 +18,12 @@ account/migrations/0015_memberdevice_buid.py,sha256=O3M3mS_O1zn4gQahC3ebRu8tMySo
|
|
18
18
|
account/migrations/0016_authsession_buid.py,sha256=wZdiH_87Ik3jAXYUgtafeAo9IbJq35xDVOlQ_UiTC8k,424
|
19
19
|
account/migrations/0017_rename_requires_topt_member_requires_totp.py,sha256=GksGiF7OQDV2RihyC2OTBzSmDwzCzenThkNs6FKni4M,375
|
20
20
|
account/migrations/0018_userpasskey.py,sha256=SdXYo4TkIeP5wLNfCza3Jq5-gKuUufzTHGBw0hFQOMY,1475
|
21
|
+
account/migrations/0019_group_location.py,sha256=EfMB_w4qWUGDqQeNc453PFZwpjpTeoA6xr6Qgo_YAOM,601
|
21
22
|
account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
23
|
account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
|
23
24
|
account/models/device.py,sha256=XipNpByreGubB5-d4ZBOoIV5Xw14b2Btcgn6fXz8HAc,4105
|
24
25
|
account/models/feeds.py,sha256=FXqcZ1Qy4oYOLzai7-GL4WNd7iKPb5Y3ZqvKQunq1Yk,1861
|
25
|
-
account/models/group.py,sha256=
|
26
|
+
account/models/group.py,sha256=l56gQxR1PQNae3TdtL5ytxdSCPP9miYZ2pBMLqA0d5E,21125
|
26
27
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
27
28
|
account/models/member.py,sha256=XwT4evwN6_THL2bKb_TjtQg7NWNwQqtotMHLScplv1s,50188
|
28
29
|
account/models/membership.py,sha256=K2fd0TJYhfv58HPyjQVlahlOPz3Q6ZwrxVkguG-2Ej8,7806
|
@@ -120,9 +121,11 @@ location/admin.py,sha256=6S97Rlgjkk0jM15sbT1OJRPZbgvKn2rn7duCSazOXq4,297
|
|
120
121
|
location/geolocate.py,sha256=UgV129vmSxnqYFBYJD2RQVOcC1-lJJ1zUaxDqOJRbG4,1694
|
121
122
|
location/migrations/0001_initial.py,sha256=E0Kekah0vfp7VGKGYRHFEIFjFRTkd8QnFGSHNFllVv0,7000
|
122
123
|
location/migrations/0002_geoip_subnet_alter_geoip_ip.py,sha256=n-oJrEnIqN9VnMhiZsr34LF-EXBluPm1lz1zusaMkx8,576
|
124
|
+
location/migrations/0003_address_postalcode_suffix.py,sha256=DT8voJeMiSQyUhH-69NHK9YywaChAvIJn1ztL7fCI30,443
|
125
|
+
location/migrations/0004_remove_address_modified_by_address_group_and_more.py,sha256=Xq0q8oVoElVYbPC779empO4GIQKuRWOyBCUmWg9Wzo4,1270
|
123
126
|
location/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
124
127
|
location/models/__init__.py,sha256=rZhldkoKmoJQXjBAK1IIQn7K_OOJvFtIGOGVl_szqbE,230
|
125
|
-
location/models/address.py,sha256=
|
128
|
+
location/models/address.py,sha256=5059tQZI4XDZJPywQPN0zXIJ8FTUQnONwBkc7DFgwng,3045
|
126
129
|
location/models/ip.py,sha256=ZaBFdW1tL1Q3bnS5gIY9SseiQ5xeeP_oyP1hp3czFeA,5984
|
127
130
|
location/models/legacy.py,sha256=8ROsUSZrjGQkUyXeJvoxPdKAWaKfUH-AL9TIeJb7krg,1994
|
128
131
|
location/models/location.py,sha256=01dJPJecbp5orExsIGWOsBC_KkwFRIW0rGDIwyx1r0w,2316
|
@@ -140,7 +143,8 @@ location/providers/location/google.py,sha256=RXZoYXUcTerE3-7z2BciEuDJJB-f-0_F6jW
|
|
140
143
|
location/providers/timezones/__init__.py,sha256=enslc1cVTju3GKrvpLoAxSHUKkLeREhed-eHkvHWdoM,46
|
141
144
|
location/providers/timezones/google.py,sha256=HyATVCGJ3wHwfc47jQRLnwa8nPeBlmpHOGTxetfg7FU,619
|
142
145
|
location/providers/zillow.py,sha256=nCV_q_9ULRkgxi4HTZHioP6nWDDmApvSf1DcwNLcOxk,1935
|
143
|
-
location/rpc/__init__.py,sha256=
|
146
|
+
location/rpc/__init__.py,sha256=MDs0Qntwff3d128BhjHEFcGTWSomshHQ1VToqMT0YVA,166
|
147
|
+
location/rpc/address.py,sha256=ivkdG5Oc8YnJowEQ8dmiOnZr5OOaIuiw9fuwbrC7gUQ,219
|
144
148
|
location/rpc/ip.py,sha256=TbRRgh4_hykT_Z0PDQrMnCdp_x0nK0Zm_WnvzXuweF4,1305
|
145
149
|
location/rpc/location.py,sha256=D5R54nnmmp8NaHQRkP_TF921Ej6j9nmTUNzX1K5WVPc,779
|
146
150
|
location/rpc/track.py,sha256=jSS9_eiKayM_8iW_4Ldojg9a2_trjfXhnLe_a261x5E,3735
|
@@ -359,7 +363,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
359
363
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
360
364
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
361
365
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
362
|
-
rest/__init__.py,sha256=
|
366
|
+
rest/__init__.py,sha256=XeNEczGva6f-NCiOEuPB5xX3SPad8Q_MV-nviN1P2d0,121
|
363
367
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
364
368
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
365
369
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -391,7 +395,7 @@ rest/middleware/request.py,sha256=JchRNy5L-bGd-7h-KFYekGRvREe2eCkZXKOYqIkP2hI,41
|
|
391
395
|
rest/middleware/session.py,sha256=zHSoQpIzRLmpqr_JvW406wzpvU3W3gDbm5JhtzLAMlE,10240
|
392
396
|
rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75e6U,1901
|
393
397
|
rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
|
394
|
-
rest/models/base.py,sha256=
|
398
|
+
rest/models/base.py,sha256=S6lLCPPEUQRVHn_4S2TwAVSQisdlKz3kqKI4dRKWUBY,67650
|
395
399
|
rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
|
396
400
|
rest/models/metadata.py,sha256=ui0962oaWbYGIbkNs7oaUGKyaca9epsW2H-ywgyH7rg,12631
|
397
401
|
rest/net.py,sha256=LcB2QV6VNRtsSdmiQvYZgwQUDwOPMn_VBdRiZ6OpI-I,2974
|
@@ -492,7 +496,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
492
496
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
493
497
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
494
498
|
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.
|
499
|
+
django_restit-4.2.46.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
500
|
+
django_restit-4.2.46.dist-info/METADATA,sha256=lCBmmksn0kY3P_GgX1stSJMT0zykk8qDWbK9ipwYks4,7594
|
501
|
+
django_restit-4.2.46.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
502
|
+
django_restit-4.2.46.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
|
+
]
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Generated by Django 4.1.4 on 2024-02-23 19:15
|
2
|
+
|
3
|
+
from django.conf import settings
|
4
|
+
from django.db import migrations, models
|
5
|
+
import django.db.models.deletion
|
6
|
+
|
7
|
+
|
8
|
+
class Migration(migrations.Migration):
|
9
|
+
|
10
|
+
dependencies = [
|
11
|
+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
12
|
+
('account', '0018_userpasskey'),
|
13
|
+
('location', '0003_address_postalcode_suffix'),
|
14
|
+
]
|
15
|
+
|
16
|
+
operations = [
|
17
|
+
migrations.RemoveField(
|
18
|
+
model_name='address',
|
19
|
+
name='modified_by',
|
20
|
+
),
|
21
|
+
migrations.AddField(
|
22
|
+
model_name='address',
|
23
|
+
name='group',
|
24
|
+
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='addresses', to='account.group'),
|
25
|
+
),
|
26
|
+
migrations.AddField(
|
27
|
+
model_name='address',
|
28
|
+
name='label',
|
29
|
+
field=models.CharField(blank=True, db_index=True, default=None, max_length=250, null=True),
|
30
|
+
),
|
31
|
+
migrations.AddField(
|
32
|
+
model_name='address',
|
33
|
+
name='member',
|
34
|
+
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='addresses', to=settings.AUTH_USER_MODEL),
|
35
|
+
),
|
36
|
+
]
|
location/models/address.py
CHANGED
@@ -6,6 +6,11 @@ from .. import geolocate
|
|
6
6
|
|
7
7
|
class Address(models.Model, rm.RestModel):
|
8
8
|
class RestMeta:
|
9
|
+
VIEW_PERMS = [
|
10
|
+
"view_all_groups",
|
11
|
+
"manage_groups",
|
12
|
+
"manage_group",
|
13
|
+
"manage_settings"]
|
9
14
|
GRAPHS = {
|
10
15
|
"abstract": {
|
11
16
|
"fields":[
|
@@ -18,7 +23,15 @@ class Address(models.Model, rm.RestModel):
|
|
18
23
|
]
|
19
24
|
}
|
20
25
|
}
|
21
|
-
|
26
|
+
label = models.CharField(
|
27
|
+
max_length=250, null=True, blank=True,
|
28
|
+
default=None, db_index=True)
|
29
|
+
member = models.ForeignKey(
|
30
|
+
"account.User", null=True, blank=True,
|
31
|
+
default=None, on_delete=models.SET_NULL, related_name="addresses")
|
32
|
+
group = models.ForeignKey(
|
33
|
+
"account.Group", null=True, blank=True,
|
34
|
+
default=None, on_delete=models.SET_NULL, related_name="addresses")
|
22
35
|
modified = models.DateTimeField(auto_now=True)
|
23
36
|
line1 = models.CharField(max_length=255, blank=True, null=True, default=None)
|
24
37
|
line2 = models.CharField(max_length=255, blank=True, null=True, default=None)
|
@@ -27,6 +40,7 @@ class Address(models.Model, rm.RestModel):
|
|
27
40
|
county = models.CharField(max_length=127, blank=True, null=True, default=None)
|
28
41
|
country = models.CharField(max_length=16, blank=True, null=True, default=None)
|
29
42
|
postalcode = models.CharField(max_length=32, blank=True, null=True, default=None)
|
43
|
+
postalcode_suffix = models.CharField(max_length=32, blank=True, null=True, default=None)
|
30
44
|
lat = models.FloatField(default=0.0, blank=True)
|
31
45
|
lng = models.FloatField(default=0.0, blank=True)
|
32
46
|
|
@@ -35,14 +49,27 @@ class Address(models.Model, rm.RestModel):
|
|
35
49
|
return geolocate.getTimeZone(self.lat, self.lng)
|
36
50
|
return None
|
37
51
|
|
52
|
+
def lookup(self):
|
53
|
+
res = geolocate.search("{}, {}, {}".format(self.line1, self.city, self.state))
|
54
|
+
if isinstance(res, list) and len(res):
|
55
|
+
return res[0]
|
56
|
+
return None
|
57
|
+
|
38
58
|
def refresh(self):
|
39
59
|
try:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
60
|
+
addr = self.lookup()
|
61
|
+
if addr:
|
62
|
+
if addr.county:
|
63
|
+
self.county = addr.county
|
64
|
+
self.country = addr.country
|
65
|
+
if addr.lat:
|
66
|
+
self.lat = addr.lat
|
67
|
+
self.lng = addr.lng
|
68
|
+
if not self.postalcode and addr.postal_code:
|
69
|
+
self.postalcode = addr.postal_code
|
70
|
+
if addr.postal_code_suffix:
|
71
|
+
self.postalcode_suffix = addr.postal_code_suffix
|
72
|
+
super(Address, self).save()
|
46
73
|
except Exception:
|
47
74
|
rh.log_exception("address.refresh")
|
48
75
|
|
location/rpc/__init__.py
CHANGED
location/rpc/address.py
ADDED
rest/__init__.py
CHANGED
rest/models/base.py
CHANGED
@@ -321,6 +321,16 @@ class RestModel(object):
|
|
321
321
|
def getModel(app_name, model_name):
|
322
322
|
return apps.get_model(app_name, model_name)
|
323
323
|
|
324
|
+
@staticmethod
|
325
|
+
def getModelInstance(app_name, model_name, **kwargs):
|
326
|
+
Model = apps.get_model(app_name, model_name)
|
327
|
+
return Model.objects.filter(**kwargs).last()
|
328
|
+
|
329
|
+
@staticmethod
|
330
|
+
def createModelInstance(app_name, model_name, **kwargs):
|
331
|
+
Model = apps.get_model(app_name, model_name)
|
332
|
+
return Model(**kwargs)
|
333
|
+
|
324
334
|
def restGetGenericModel(self, field):
|
325
335
|
# called by the rest module to magically parse
|
326
336
|
# a component that is marked genericr elation in a graph
|
File without changes
|
File without changes
|