Commit eb88a059 authored by Michal Čihař's avatar Michal Čihař

Various code fixes

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent a0ba4cdc
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.http import Http404 from django.http import Http404
...@@ -149,8 +150,8 @@ class TranslationViewSet(MultipleFieldMixin, RawFileViewSet): ...@@ -149,8 +150,8 @@ class TranslationViewSet(MultipleFieldMixin, RawFileViewSet):
fmt = self.format_kwarg or request.query_params.get('format') fmt = self.format_kwarg or request.query_params.get('format')
return download_translation_file(obj, fmt) return download_translation_file(obj, fmt)
elif request.method in ('PUT', 'POST'): elif request.method in ('PUT', 'POST'):
if (not can_upload_translation(request.user, obj) if (not can_upload_translation(request.user, obj) or
or obj.is_locked(request.user)): obj.is_locked(request.user)):
raise PermissionDenied() raise PermissionDenied()
ret, count = obj.merge_upload( ret, count = obj.merge_upload(
...@@ -161,6 +162,7 @@ class TranslationViewSet(MultipleFieldMixin, RawFileViewSet): ...@@ -161,6 +162,7 @@ class TranslationViewSet(MultipleFieldMixin, RawFileViewSet):
return Response(data={'result': ret, 'count': count}) return Response(data={'result': ret, 'count': count})
class LanguageViewSet(viewsets.ReadOnlyModelViewSet): class LanguageViewSet(viewsets.ReadOnlyModelViewSet):
"""Languages API. """Languages API.
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment