kopia lustrzana https://github.com/wagtail/wagtail
add support for natural keys to group collection permissions for use in fixtures (#6211)
rodzic
05223db8c3
commit
024717fe0f
|
@ -28,6 +28,7 @@ Changelog
|
|||
* Add `register_snippet_action_menu_item` and `construct_snippet_action_menu` hooks to modify the actions available when creating / editing a snippet (Karl Hobley)
|
||||
* Moved `generate_signature` and `verify_signature` functions into `wagtail.images.utils` (Noah H)
|
||||
* Implement `bulk_to_python` on all structural StreamField block types (Matt Westcott)
|
||||
* Add natural key support to `GroupCollectionPermission` (Jim Jazwiecki)
|
||||
* Fix: Make page-level actions accessible to keyboard users in page listing tables (Jesse Menn)
|
||||
* Fix: `WAGTAILFRONTENDCACHE_LANGUAGES` was being interpreted incorrectly. It now accepts a list of strings, as documented (Karl Hobley)
|
||||
* Fix: Update oEmbed endpoints to use https where available (Matt Westcott)
|
||||
|
|
|
@ -53,6 +53,7 @@ Other features
|
|||
* Add ``register_snippet_action_menu_item`` and ``construct_snippet_action_menu`` hooks to modify the actions available when creating / editing a snippet (Karl Hobley)
|
||||
* Moved ``generate_signature`` and ``verify_signature`` functions into ``wagtail.images.utils`` (Noah H)
|
||||
* Implement ``bulk_to_python`` on all structural StreamField block types (Matt Westcott)
|
||||
* Add natural key support to ``GroupCollectionPermission`` (Jim Jazwiecki)
|
||||
|
||||
|
||||
Bug fixes
|
||||
|
|
|
@ -3603,6 +3603,13 @@ class CollectionMember(models.Model):
|
|||
abstract = True
|
||||
|
||||
|
||||
class GroupCollectionPermissionManager(models.Manager):
|
||||
def get_by_natural_key(self, group, collection, permission):
|
||||
return self.get(group=group,
|
||||
collection=collection,
|
||||
permission=permission)
|
||||
|
||||
|
||||
class GroupCollectionPermission(models.Model):
|
||||
"""
|
||||
A rule indicating that a group has permission for some action (e.g. "create document")
|
||||
|
@ -3633,6 +3640,11 @@ class GroupCollectionPermission(models.Model):
|
|||
self.collection.id, self.collection
|
||||
)
|
||||
|
||||
def natural_key(self):
|
||||
return (self.group, self.collection, self.permission)
|
||||
|
||||
objects = GroupCollectionPermissionManager()
|
||||
|
||||
class Meta:
|
||||
unique_together = ('group', 'collection', 'permission')
|
||||
verbose_name = _('group collection permission')
|
||||
|
|
Ładowanie…
Reference in New Issue