Multi-platform: support multiple files per version #201
@ -27,18 +27,13 @@ class ExtensionQuerysetMixin:
|
|||||||
|
|
||||||
|
|
||||||
class MaintainedExtensionMixin:
|
class MaintainedExtensionMixin:
|
||||||
"""Fetch an extension by slug if current user is a maintainer.
|
"""Fetch an extension by slug if current user is a maintainer."""
|
||||||
|
|
||||||
If pk is present, also fetch a corresponding version.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def dispatch(self, *args, **kwargs):
|
def dispatch(self, *args, **kwargs):
|
||||||
self.extension = get_object_or_404(
|
self.extension = get_object_or_404(
|
||||||
Extension.objects.authored_by(self.request.user),
|
Extension.objects.authored_by(self.request.user),
|
||||||
slug=self.kwargs['slug'],
|
slug=self.kwargs['slug'],
|
||||||
)
|
)
|
||||||
if 'pk' in self.kwargs:
|
|
||||||
self.version = get_object_or_404(self.extension.versions, pk=self.kwargs['pk'])
|
|
||||||
return super().dispatch(*args, **kwargs)
|
return super().dispatch(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user