drf-appkit 1.6.0__tar.gz → 1.6.2__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.6.0/drf_appkit.egg-info → drf_appkit-1.6.2}/PKG-INFO +1 -1
- drf_appkit-1.6.2/appkit/migrations/0026_mediaattachment_attributes_and_more.py +25 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/models.py +21 -13
- {drf_appkit-1.6.0 → drf_appkit-1.6.2/drf_appkit.egg-info}/PKG-INFO +1 -1
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/drf_appkit.egg-info/SOURCES.txt +1 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/setup.cfg +1 -1
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/LICENSE +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/MANIFEST.in +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/README.md +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/filters.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/mixins.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/pagination.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/relations.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/renderers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/serializers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/tests.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/api/views.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/apps.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/auth/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/auth/backends.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/auth/decorators.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/auth/email.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/auth/permissions.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/debug.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/adapters.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/authentication.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/backends.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/endpoints.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/exceptions.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/fields.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/filters.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/mixins.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/permissions.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf/serializers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf_appkit.egg-info/PKG-INFO +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf_appkit.egg-info/SOURCES.txt +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/drf_appkit.egg-info/top_level.txt +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/forms/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/forms/widgets.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/handlers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/jinja2/appkit/forms/widgets/money_widget.html +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/managers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0001_initial.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0002_arrangement_tags.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0003_auto_20210221_0852.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0004_auto_20210309_0655.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0005_auto_20210324_1046.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0006_sitealias.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0007_auto_20211021_1901.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0008_update_autofields.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0009_alter_arrangement_unique_together_and_more.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0010_arrangement_name.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0011_alter_sitealias_options.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0012_alter_sitealias_site.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0013_usergroup.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0014_remove_note_notes_note_content_type_note_object_id.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0015_alter_note_content_type_alter_note_object_id.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0016_alter_arrangementitem_unique_together_and_more.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0017_alter_imageattachment_image.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0018_place_geoposition.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0019_alter_place_geoposition.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0020_remove_arrangement_type_arrangement_content_type.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0021_rename_content_type_arrangement_item_type.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0022_imageattachment_rendition_key_imageattachment_warm.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0023_delete_usergroup.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0024_place_city_place_country_place_postal_code_and_more.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/0025_mediaattachment_placeholder.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/migrations/__init__.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/notification.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/settings.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/shortcuts.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/storages.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/tests.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/transformers.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/util.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/appkit/views.py +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/drf_appkit.egg-info/dependency_links.txt +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/drf_appkit.egg-info/top_level.txt +0 -0
- {drf_appkit-1.6.0 → drf_appkit-1.6.2}/setup.py +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated by Django 5.1.7 on 2025-06-08 17:06
|
|
2
|
+
|
|
3
|
+
import django.core.serializers.json
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('appkit', '0025_mediaattachment_placeholder'),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AddField(
|
|
15
|
+
model_name='mediaattachment',
|
|
16
|
+
name='attributes',
|
|
17
|
+
field=models.JSONField(default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
|
|
18
|
+
),
|
|
19
|
+
migrations.AddField(
|
|
20
|
+
model_name='mediaattachment',
|
|
21
|
+
name='media_type',
|
|
22
|
+
field=models.CharField(choices=[('audio', 'Audio'), ('image', 'Image'), ('video', 'Video')], default='image', max_length=5),
|
|
23
|
+
preserve_default=False,
|
|
24
|
+
),
|
|
25
|
+
]
|
|
@@ -177,24 +177,21 @@ class Place(ModelBase):
|
|
|
177
177
|
postal_code = models.CharField(max_length=7, blank=True)
|
|
178
178
|
|
|
179
179
|
def __str__(self):
|
|
180
|
-
if '
|
|
181
|
-
return self.info['
|
|
180
|
+
if 'formatted_address' in self.info:
|
|
181
|
+
return self.info['formatted_address']
|
|
182
182
|
return self.place_id
|
|
183
183
|
|
|
184
184
|
def format(self, *component_types):
|
|
185
185
|
try:
|
|
186
|
-
address_components = self.info['
|
|
186
|
+
address_components = self.info['address_components']
|
|
187
187
|
except KeyError:
|
|
188
|
-
return
|
|
188
|
+
return self.info.get('formattedAddress')
|
|
189
189
|
|
|
190
190
|
address_parts = []
|
|
191
191
|
for component_type in component_types:
|
|
192
192
|
for address_component in address_components:
|
|
193
193
|
if component_type in address_component['types']:
|
|
194
|
-
|
|
195
|
-
address_parts.append(address_component['shortText'])
|
|
196
|
-
elif 'short_name' in address_component:
|
|
197
|
-
address_parts.append(address_component['short_name'])
|
|
194
|
+
address_parts.append(address_component['short_name'])
|
|
198
195
|
return ', '.join(address_parts)
|
|
199
196
|
|
|
200
197
|
|
|
@@ -300,11 +297,24 @@ class Attachment(Document):
|
|
|
300
297
|
return self.object.get_media_attachment_directory(self)
|
|
301
298
|
|
|
302
299
|
|
|
300
|
+
class MediaTypeChoices(models.TextChoices):
|
|
301
|
+
AUDIO = 'audio', _('Audio')
|
|
302
|
+
IMAGE = 'image', _('Image')
|
|
303
|
+
VIDEO = 'video', _('Video')
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class MediaAttachmentManager(models.Manager):
|
|
307
|
+
def ready_videos(self):
|
|
308
|
+
return self.filter(media_type=MediaTypeChoices.VIDEO, attributes__mux__status='ready')
|
|
309
|
+
|
|
310
|
+
|
|
303
311
|
class MediaAttachment(Document):
|
|
304
312
|
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
|
305
313
|
object_id = models.PositiveIntegerField()
|
|
306
314
|
object = GenericForeignKey('content_type', 'object_id')
|
|
315
|
+
attributes = models.JSONField(default=dict, encoder=DjangoJSONEncoder)
|
|
307
316
|
|
|
317
|
+
media_type = models.CharField(choices=MediaTypeChoices.choices, max_length=5)
|
|
308
318
|
image = VersatileImageField(max_length=255, storage=MediaStorage(), upload_to=UploadMediaAttachmentTo())
|
|
309
319
|
width = models.IntegerField()
|
|
310
320
|
height = models.IntegerField()
|
|
@@ -315,6 +325,8 @@ class MediaAttachment(Document):
|
|
|
315
325
|
rendition_key = models.CharField(max_length=20, blank=False, null=True)
|
|
316
326
|
warm = models.BooleanField(default=False, help_text='Indicates whether renditions have been created')
|
|
317
327
|
|
|
328
|
+
objects = MediaAttachmentManager()
|
|
329
|
+
|
|
318
330
|
class Meta:
|
|
319
331
|
ordering = ('position',)
|
|
320
332
|
|
|
@@ -359,7 +371,7 @@ class Thing(models.Model):
|
|
|
359
371
|
description = models.TextField(blank=True)
|
|
360
372
|
|
|
361
373
|
attachments = GenericRelation(Attachment)
|
|
362
|
-
|
|
374
|
+
media_attachments = GenericRelation(MediaAttachment)
|
|
363
375
|
notes = GenericRelation(Note)
|
|
364
376
|
feature_image = models.OneToOneField(MediaAttachment, blank=True, null=True, on_delete=models.SET_NULL)
|
|
365
377
|
place = models.ForeignKey(Place, blank=True, null=True, on_delete=models.SET_NULL)
|
|
@@ -374,10 +386,6 @@ class Thing(models.Model):
|
|
|
374
386
|
def __str__(self):
|
|
375
387
|
return self.name
|
|
376
388
|
|
|
377
|
-
@property
|
|
378
|
-
def image_count(self):
|
|
379
|
-
return self.images.count()
|
|
380
|
-
|
|
381
389
|
|
|
382
390
|
class AbstractProduct(Thing):
|
|
383
391
|
price = MoneyField(max_digits=14, decimal_places=2, blank=True, null=True, default_currency=None)
|
|
@@ -74,6 +74,7 @@ appkit/migrations/0022_imageattachment_rendition_key_imageattachment_warm.py
|
|
|
74
74
|
appkit/migrations/0023_delete_usergroup.py
|
|
75
75
|
appkit/migrations/0024_place_city_place_country_place_postal_code_and_more.py
|
|
76
76
|
appkit/migrations/0025_mediaattachment_placeholder.py
|
|
77
|
+
appkit/migrations/0026_mediaattachment_attributes_and_more.py
|
|
77
78
|
appkit/migrations/__init__.py
|
|
78
79
|
drf_appkit.egg-info/PKG-INFO
|
|
79
80
|
drf_appkit.egg-info/SOURCES.txt
|
|
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
|