Guest User

Untitled

a guest
Jan 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. {% if mystocks.all %}
  2.  
  3. <table id="example" class='table table-list-search table-responsive table-hover table-striped bordered" width="100%'>
  4. <thead class="alert alert-info">
  5. <tr>
  6. <th>name</th>
  7. <th>brand</th>
  8. <th>id</th>
  9. <th> suffix</th>
  10. <th>command</th>
  11. <th>price</th>
  12. <th>days </th>
  13. <th>situation</th>
  14. </tr>
  15. </thead>
  16.  
  17.  
  18. {% for item in myst %}
  19.  
  20. <tr>
  21.  
  22. <td><input type="checkbox" name="todelete" value="{{ item.id }}"></td>
  23. <td>{{ item.name }}</td>
  24. <td>{{ item.brand }}</td>
  25. <td>{{ item.number }}</td>
  26. <td>{{ item.suffix }}</td>
  27. <td>{{ item.comment }}</td>
  28. <td>{{ item.price }}</td>
  29. <td>{{ item.date|timesince }}</td>
  30. <td>{{ item.confirm }}</td>
  31. <td><a href="{{ item.id }}" onclick="return confirm('Are you sre?');">delete</a> </td>
  32. <td><a href="/stock/{{ item.id }}">Edit</a> </td>
  33. </tr>
  34.  
  35. {% endfor %}
  36. </table>
  37. {% else %}
  38. <p style="margin:2em" > You have no stock</p>
  39. {% endif %}
  40.  
  41.  
  42. <form class="" method="post">
  43. {% csrf_token %}
  44. <input type="submit" name="delete" value="Delete Items" />
  45. </form>
  46.  
  47. def mystocks_view(request):
  48. if request.method=='POST':
  49. todel = request.POST.getlist('todelete')
  50. print(todel)
  51. Stocks.objects.filter(user=request.user,id__in=todel).delete()
Add Comment
Please, Sign In to add comment