mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-18 12:13:24 +00:00
Merge branch 'download-all-my-pictures' into 'master'
Fix 'download all my picture button' being displayed in all albums sections This MR fix the following issue where the download all button is displayed in each album (hence it's for all photos & not only by album) ![image](/uploads/c888e2bf8715d18cd2ea26e63f9fac28/image.png) See merge request ae-utbm/Sith!320
This commit is contained in:
commit
35c120a29f
@ -6,7 +6,7 @@ from rest_framework.renderers import JSONRenderer
|
||||
from rest_framework.request import Request
|
||||
from rest_framework.response import Response
|
||||
|
||||
from core.views import can_edit_prop
|
||||
from core.views import can_edit
|
||||
from core.models import User
|
||||
from sas.models import Picture
|
||||
|
||||
@ -24,7 +24,7 @@ def all_pictures_of_user(user: User) -> List[Picture]:
|
||||
@renderer_classes((JSONRenderer,))
|
||||
def all_pictures_of_user_endpoint(request: Request, user: int):
|
||||
requested_user: User = get_object_or_404(User, pk=user)
|
||||
if not can_edit_prop(requested_user, request.user):
|
||||
if not can_edit(requested_user, request.user):
|
||||
raise PermissionDenied
|
||||
|
||||
return Response(
|
||||
|
@ -5,8 +5,10 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if can_edit(profile, user) %}
|
||||
<button id="download_all_pictures", onclick=download_pictures()>{% trans %}Download all my pictures{% endtrans %}</button>
|
||||
{% endif %}
|
||||
{% for a in albums %}
|
||||
<button id="download_all_pictures", onclick=download_pictures()>{% trans %}Download all my pictures{% endtrans %}</button>
|
||||
<div style="padding: 10px">
|
||||
<h4>{{ a.name }}</h4>
|
||||
<hr>
|
||||
|
Loading…
Reference in New Issue
Block a user