drf-appkit 1.4.7__tar.gz → 1.4.8__tar.gz
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.
- {drf_appkit-1.4.7/drf_appkit.egg-info → drf_appkit-1.4.8}/PKG-INFO +1 -1
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/shortcuts.py +25 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/util.py +0 -70
- {drf_appkit-1.4.7 → drf_appkit-1.4.8/drf_appkit.egg-info}/PKG-INFO +1 -1
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/setup.cfg +1 -1
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/LICENSE +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/MANIFEST.in +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/README.md +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/filters.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/mixins.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/pagination.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/relations.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/renderers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/serializers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/tests.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/api/views.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/apps.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/auth/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/auth/backends.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/auth/decorators.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/auth/email.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/auth/permissions.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/debug.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/adapters.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/authentication.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/backends.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/endpoints.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/exceptions.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/fields.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/filters.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/mixins.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/permissions.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf/serializers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf_appkit.egg-info/PKG-INFO +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf_appkit.egg-info/SOURCES.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/drf_appkit.egg-info/top_level.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/forms/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/forms/widgets.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/handlers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/jinja2/appkit/forms/widgets/money_widget.html +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/managers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0001_initial.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0002_arrangement_tags.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0003_auto_20210221_0852.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0004_auto_20210309_0655.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0005_auto_20210324_1046.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0006_sitealias.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0007_auto_20211021_1901.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0008_update_autofields.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0009_alter_arrangement_unique_together_and_more.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0010_arrangement_name.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0011_alter_sitealias_options.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0012_alter_sitealias_site.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0013_usergroup.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0014_remove_note_notes_note_content_type_note_object_id.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0015_alter_note_content_type_alter_note_object_id.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0016_alter_arrangementitem_unique_together_and_more.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0017_alter_imageattachment_image.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0018_place_geoposition.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0019_alter_place_geoposition.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0020_remove_arrangement_type_arrangement_content_type.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0021_rename_content_type_arrangement_item_type.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0022_imageattachment_rendition_key_imageattachment_warm.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0023_delete_usergroup.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/0024_place_city_place_country_place_postal_code_and_more.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/migrations/__init__.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/models.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/notification.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/settings.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/storages.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/tasks.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/tests.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/transformers.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/appkit/views.py +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/drf_appkit.egg-info/SOURCES.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/drf_appkit.egg-info/top_level.txt +0 -0
- {drf_appkit-1.4.7 → drf_appkit-1.4.8}/setup.py +0 -0
|
@@ -322,3 +322,28 @@ def send_sms(destination, message):
|
|
|
322
322
|
logger = logging.getLogger("plivo")
|
|
323
323
|
logger.log(logging.ERROR, str(e))
|
|
324
324
|
return False
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def pagination_links(request, page):
|
|
328
|
+
pagination_querydict = request.GET.copy()
|
|
329
|
+
if 'page' in pagination_querydict:
|
|
330
|
+
del pagination_querydict['page']
|
|
331
|
+
pagination_querystring = pagination_querydict.urlencode()
|
|
332
|
+
|
|
333
|
+
paginator = page.paginator
|
|
334
|
+
|
|
335
|
+
previous_page = None
|
|
336
|
+
if page.has_previous():
|
|
337
|
+
previous_page = f'?page={page.previous_page_number()}&{pagination_querystring}'.rstrip('&')
|
|
338
|
+
|
|
339
|
+
next_page = None
|
|
340
|
+
if page.has_next():
|
|
341
|
+
next_page = f'?page={page.next_page_number()}&{pagination_querystring}'.rstrip('&')
|
|
342
|
+
|
|
343
|
+
return {
|
|
344
|
+
'first': f'?page=1&{pagination_querystring}'.rstrip('&'),
|
|
345
|
+
'last': f'?page={paginator.num_pages}&{pagination_querystring}'.rstrip('&'),
|
|
346
|
+
'previous': previous_page or '',
|
|
347
|
+
'next': next_page or '',
|
|
348
|
+
}
|
|
349
|
+
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import hashlib
|
|
3
|
-
import imp
|
|
4
3
|
import inspect
|
|
5
4
|
import ipaddress
|
|
6
5
|
import json
|
|
@@ -104,75 +103,6 @@ def path_components(string, separator='/'):
|
|
|
104
103
|
return [element] + path_components(rest, separator)
|
|
105
104
|
|
|
106
105
|
|
|
107
|
-
def get_module_from_path(module_path, search_path=None):
|
|
108
|
-
"""
|
|
109
|
-
Return the module associate with the given path (e.g. 'django.db'), loading the
|
|
110
|
-
module if necessary. Returns None if the named module cannot be found.
|
|
111
|
-
"""
|
|
112
|
-
if module_path is None:
|
|
113
|
-
return None
|
|
114
|
-
|
|
115
|
-
# Lookup the module path in python's dictionary of loaded modules...
|
|
116
|
-
module = sys.modules.get(module_path)
|
|
117
|
-
if module is None:
|
|
118
|
-
def _get_module(module_name, parent_module=None):
|
|
119
|
-
module_path = parent_module.__name__ + '.' + module_name if parent_module else module_name
|
|
120
|
-
module = sys.modules.get(module_path)
|
|
121
|
-
if module is None:
|
|
122
|
-
(file, path, desc) = imp.find_module(module_name, parent_module.__path__ if parent_module else search_path)
|
|
123
|
-
if file or path:
|
|
124
|
-
try:
|
|
125
|
-
module = imp.load_module(module_path, file, path, desc)
|
|
126
|
-
except Exception as e:
|
|
127
|
-
raise Exception("failed to load '%s' -- %s" % (path, e.message))
|
|
128
|
-
finally:
|
|
129
|
-
if file:
|
|
130
|
-
file.close()
|
|
131
|
-
return module
|
|
132
|
-
for component in path_components(module_path, '.'):
|
|
133
|
-
parent_module = module
|
|
134
|
-
module = _get_module(component, parent_module)
|
|
135
|
-
if module is None:
|
|
136
|
-
logger = logging.getLogger('alpha')
|
|
137
|
-
if parent_module:
|
|
138
|
-
logger.info("module '%s' has no component named '%s'" % (parent_module.__path__, component))
|
|
139
|
-
else:
|
|
140
|
-
logger.info("unknown top-level module '%s"'' % component)
|
|
141
|
-
break
|
|
142
|
-
|
|
143
|
-
return module
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def get_path_from_class(cls):
|
|
147
|
-
"""
|
|
148
|
-
Return the relative path of the given class in the form <module-path>.<class-name>.
|
|
149
|
-
"""
|
|
150
|
-
return '{}.{}'.format(cls.__module__, cls.__name__)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def get_class_from_path(path, superclass=None, search_path=None):
|
|
154
|
-
"""
|
|
155
|
-
Return the class object corresponding to the given path, which has the
|
|
156
|
-
form <module-path>.<class-name>.
|
|
157
|
-
"""
|
|
158
|
-
module_path, class_name = string.rsplit(path, '.', 1)
|
|
159
|
-
module = get_module_from_path(module_path, search_path)
|
|
160
|
-
return get_class_from_module(module, class_name, superclass) if module else None
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
def get_class_from_module(module, class_name, superclass=None):
|
|
164
|
-
"""
|
|
165
|
-
Return the named class from the given module; optionally require the class
|
|
166
|
-
be derived from the given superclass.
|
|
167
|
-
"""
|
|
168
|
-
cls = module.__dict__.get(class_name)
|
|
169
|
-
if not inspect.isclass(cls):
|
|
170
|
-
raise Exception("module '{}' has no class-valued attribute '{}'".format(module.__name__, class_name))
|
|
171
|
-
if superclass and not issubclass(cls, superclass):
|
|
172
|
-
raise Exception("class '{}' of module '{}' is not derived from class '{}'".format(class_name, module.__name__, superclass.__name__))
|
|
173
|
-
return cls
|
|
174
|
-
|
|
175
|
-
|
|
176
106
|
def assign_timestamps(obj, date_created, date_modified):
|
|
177
107
|
with connections[obj._state.db].cursor() as cursor:
|
|
178
108
|
query_template = "UPDATE {trg_table_name} SET date_created='{date_created}',date_modified='{date_modified}' WHERE id={pk}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|