drf-appkit 1.4.1__tar.gz → 1.4.3__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.1/drf_appkit.egg-info → drf-appkit-1.4.3}/PKG-INFO +1 -1
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/fields.py +8 -1
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/forms/widgets.py +11 -2
- {drf-appkit-1.4.1 → drf-appkit-1.4.3/drf_appkit.egg-info}/PKG-INFO +1 -1
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/setup.cfg +1 -1
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/LICENSE +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/MANIFEST.in +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/README.md +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/filters.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/mixins.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/pagination.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/relations.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/renderers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/serializers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/tests.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/api/views.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/apps.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/auth/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/auth/backends.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/auth/decorators.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/auth/email.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/auth/permissions.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/debug.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/adapters.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/authentication.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/backends.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/endpoints.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/exceptions.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/filters.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/mixins.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/permissions.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf/serializers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf_appkit.egg-info/PKG-INFO +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf_appkit.egg-info/SOURCES.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/drf_appkit.egg-info/top_level.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/forms/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/handlers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/jinja2/appkit/forms/widgets/money_widget.html +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/managers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0001_initial.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0002_arrangement_tags.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0003_auto_20210221_0852.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0004_auto_20210309_0655.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0005_auto_20210324_1046.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0006_sitealias.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0007_auto_20211021_1901.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0008_update_autofields.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0009_alter_arrangement_unique_together_and_more.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0010_arrangement_name.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0011_alter_sitealias_options.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0012_alter_sitealias_site.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0013_usergroup.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0014_remove_note_notes_note_content_type_note_object_id.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0015_alter_note_content_type_alter_note_object_id.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0016_alter_arrangementitem_unique_together_and_more.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0017_alter_imageattachment_image.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0018_place_geoposition.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0019_alter_place_geoposition.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0020_remove_arrangement_type_arrangement_content_type.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0021_rename_content_type_arrangement_item_type.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/0022_imageattachment_rendition_key_imageattachment_warm.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/migrations/__init__.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/models.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/notification.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/settings.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/shortcuts.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/storages.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/tasks.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/tests.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/transformers.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/util.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/appkit/views.py +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/drf_appkit.egg-info/SOURCES.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/drf_appkit.egg-info/top_level.txt +0 -0
- {drf-appkit-1.4.1 → drf-appkit-1.4.3}/setup.py +0 -0
|
@@ -7,9 +7,11 @@ from django.db.models.fields.files import ImageFieldFile
|
|
|
7
7
|
from django.urls import resolve, reverse
|
|
8
8
|
from django.urls.exceptions import NoReverseMatch
|
|
9
9
|
|
|
10
|
-
from appkit.shortcuts import mimetype_for_file
|
|
11
10
|
from rest_framework import fields
|
|
12
11
|
|
|
12
|
+
from ..shortcuts import mimetype_for_file
|
|
13
|
+
from ..util import value_for_attr_path
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
class ContentTypeField(fields.IntegerField):
|
|
15
17
|
def get_attribute(self, instance):
|
|
@@ -19,6 +21,8 @@ class ContentTypeField(fields.IntegerField):
|
|
|
19
21
|
class DocumentPathField(fields.CharField):
|
|
20
22
|
def __init__(self, **kwargs):
|
|
21
23
|
self.url_kwargs = kwargs.pop('url_kwargs', None)
|
|
24
|
+
# May optionally specifu an attribute path to traverse when establishing the object from which to resolve a path
|
|
25
|
+
self.keypath = kwargs.pop('keypath', None)
|
|
22
26
|
super().__init__(**kwargs)
|
|
23
27
|
|
|
24
28
|
def get_detail_url_name(self, instance):
|
|
@@ -49,6 +53,9 @@ class DocumentPathField(fields.CharField):
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
def get_path(self, instance, url_info):
|
|
56
|
+
if self.keypath:
|
|
57
|
+
instance = value_for_attr_path(instance, self.keypath)
|
|
58
|
+
|
|
52
59
|
detail_url_name = self.get_detail_url_name(instance)
|
|
53
60
|
if not detail_url_name:
|
|
54
61
|
return None
|
|
@@ -7,6 +7,7 @@ __all__ = ("MoneyWidget",)
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class MoneyWidget(MultiWidget):
|
|
10
|
+
step = None
|
|
10
11
|
template_name = 'appkit/forms/widgets/money_widget.html'
|
|
11
12
|
|
|
12
13
|
def __init__(
|
|
@@ -19,11 +20,13 @@ class MoneyWidget(MultiWidget):
|
|
|
19
20
|
*args,
|
|
20
21
|
**kwargs
|
|
21
22
|
):
|
|
23
|
+
self.step = step
|
|
24
|
+
|
|
22
25
|
if not amount_widget:
|
|
23
26
|
widget_attrs = {
|
|
24
27
|
'class': 'border-0 py-3 pl-7 pr-20 w-full',
|
|
25
28
|
}
|
|
26
|
-
if isinstance(step, int):
|
|
29
|
+
if isinstance(self.step, int):
|
|
27
30
|
widget_attrs['pattern'] = '[0-9]*'
|
|
28
31
|
amount_widget = TextInput(attrs=widget_attrs)
|
|
29
32
|
|
|
@@ -39,5 +42,11 @@ class MoneyWidget(MultiWidget):
|
|
|
39
42
|
if value is not None:
|
|
40
43
|
if isinstance(value, (list, tuple)):
|
|
41
44
|
return value
|
|
42
|
-
|
|
45
|
+
|
|
46
|
+
amount = value.amount
|
|
47
|
+
if isinstance(self.step, int):
|
|
48
|
+
amount = amount.to_integral_value()
|
|
49
|
+
|
|
50
|
+
currency = value.currency
|
|
51
|
+
return [amount, currency]
|
|
43
52
|
return [None, self.default_currency]
|
|
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
|