move the device delete button into the devices table
This commit is contained in:
parent
f57b3a7baf
commit
506401bf99
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
import django_tables2 as tables
|
||||
from django_tables2.utils import A
|
||||
|
||||
from core.tables import CoreTable
|
||||
|
||||
|
@ -10,6 +11,11 @@ from .models import Device
|
|||
class DevicesTable(CoreTable):
|
||||
id = tables.Column(visible=False)
|
||||
name = tables.Column('Device', linkify=True)
|
||||
delete = tables.LinkColumn('device_delete',
|
||||
text='delete',
|
||||
args=[A('pk')], attrs={
|
||||
'a': {'class': 'delete material-icons', }
|
||||
})
|
||||
|
||||
class Meta(CoreTable.Meta):
|
||||
model = Device
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<form method="post">{% csrf_token %}
|
||||
<p>Are you sure you want to delete the device "{{ object }}"?</p>
|
||||
<button type="submit" class="btn btn-danger">Delete</button>
|
||||
<a href="{% url 'device' object.pk %}" class="btn btn-primary">Cancel</a>
|
||||
<a href="{% url 'devices' object.customer.pk %}" class="btn btn-primary">Cancel</a>
|
||||
<input type="hidden" id="previous_page" name="previous_page" value="/previous/page/url">
|
||||
</form>
|
||||
<script>
|
||||
|
|
|
@ -42,6 +42,5 @@
|
|||
</tr>
|
||||
</table>
|
||||
<a href="{% url 'device_update' pk %}" class="edit" title="Edit" data-toggle="tooltip"><i class="material-icons">edit</i></a>
|
||||
<a href="{% url 'device_delete' pk %}" class="delete" title="Delete" data-toggle="tooltip"><i class="material-icons">delete</i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue