Browse Source

Fixes bug #913641 - Dashboard can't delete snapshots.

Change-Id: I788b02f177bc8ef66845ed6a2e9c5892a2ed7985
Kiall Mac Innes 7 years ago
parent
commit
8cef264638

+ 2
- 2
django-openstack/django_openstack/dash/views/images.py View File

@@ -68,7 +68,7 @@ class UpdateImageForm(forms.SelfHandlingForm):
68 68
             LOG.exception(error_retrieving)
69 69
             messages.error(request, error_retrieving)
70 70
 
71
-        if image.owner == request.user.username:
71
+        if image.owner == request.user.tenant_id:
72 72
             try:
73 73
                 meta = {
74 74
                     'is_public': True,
@@ -185,7 +185,7 @@ class DeleteImage(forms.SelfHandlingForm):
185 185
         tenant_id = request.user.tenant_id
186 186
         try:
187 187
             image = api.image_get(request, image_id)
188
-            if image.owner == request.user.username:
188
+            if image.owner == request.user.tenant_id:
189 189
                 api.image_delete(request, image_id)
190 190
             else:
191 191
                 messages.info(request, "Unable to delete image, you are not \

+ 1
- 1
django-openstack/django_openstack/templates/django_openstack/dash/images/_list.html View File

@@ -16,7 +16,7 @@
16 16
       <td>{{image.status|capfirst}}</td>
17 17
       <td id="actions">
18 18
           <ul>
19
-      {% if image.owner == request.user.username %}
19
+      {% if image.owner == request.user.tenant_id %}
20 20
             <li class="form">{% include "django_openstack/dash/images/_delete.html" with form=delete_form %}</li>
21 21
             <li><a href="{% url dash_images_update request.user.tenant_id image.id %}">Edit</a></li>
22 22
       {% endif %}

Loading…
Cancel
Save