Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if mystocks.all %}
- <table id="example" class='table table-list-search table-responsive table-hover table-striped bordered" width="100%'>
- <thead class="alert alert-info">
- <tr>
- <th>name</th>
- <th>brand</th>
- <th>id</th>
- <th> suffix</th>
- <th>command</th>
- <th>price</th>
- <th>days </th>
- <th>situation</th>
- </tr>
- </thead>
- {% for item in myst %}
- <tr>
- <td><input type="checkbox" name="todelete" value="{{ item.id }}"></td>
- <td>{{ item.name }}</td>
- <td>{{ item.brand }}</td>
- <td>{{ item.number }}</td>
- <td>{{ item.suffix }}</td>
- <td>{{ item.comment }}</td>
- <td>{{ item.price }}</td>
- <td>{{ item.date|timesince }}</td>
- <td>{{ item.confirm }}</td>
- <td><a href="{{ item.id }}" onclick="return confirm('Are you sre?');">delete</a> </td>
- <td><a href="/stock/{{ item.id }}">Edit</a> </td>
- </tr>
- {% endfor %}
- </table>
- {% else %}
- <p style="margin:2em" > You have no stock</p>
- {% endif %}
- <form class="" method="post">
- {% csrf_token %}
- <input type="submit" name="delete" value="Delete Items" />
- </form>
- def mystocks_view(request):
- if request.method=='POST':
- todel = request.POST.getlist('todelete')
- print(todel)
- Stocks.objects.filter(user=request.user,id__in=todel).delete()
Add Comment
Please, Sign In to add comment