admin_panel.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. {% extends "base_generic.html" %}
  2. {% load tags %}
  3. {% block content %}
  4. <div class="container-fluid">
  5. {% if user.is_superuser %}
  6. <h3 style="margin-top: 10px">Products Overview </h3>
  7. <form class="form-inline" method="POST"> {% csrf_token %}
  8. <table class="table table-sm table-hover">
  9. <thead class="">
  10. <tr>
  11. <th scope="col"></th>
  12. <th scope="col"> Product</th>
  13. <th scope="col"> Category</th>
  14. <th scope="col"> Public</th>
  15. <th scope="col"> Editable </th>
  16. <th scope="col"> submitted</th>
  17. </tr>
  18. {% for Product in Product_list %}
  19. <tr class="" >
  20. <td scope="col"><img src="{{Product.media_set.first.image_small.url}}" width="50" height="50" alt="{{ Product.pk }}"> </td>
  21. <td scope="col"> <a href="{% url 'Product-detail' Product.pk %}"> {{Product.title|upper }} </a></td>
  22. <td scope="col">
  23. {% for category in Product.category.all %}
  24. {{category.short_name}}{% if not forloop.last %} | {% endif %}
  25. {% endfor %}
  26. </td>
  27. <td scope="col">
  28. <input type="checkbox" class="form-check-input check" id="{{ Product.pk }}.public" name="{{ Product.pk }}.public" {% if Product.public %}checked="checked"{% endif %}>
  29. </td>
  30. <td scope="col">
  31. <input type="checkbox" class="form-check-input check" id="{{ Product.pk }}.edit" name="{{ Product.pk }}.edit" {% if Product.edit %}checked="checked"{% endif %}>
  32. </td>
  33. <td scope="col"> {{Product.sumbitted}} </td>
  34. </tr>
  35. {% endfor %}
  36. </table>
  37. <button class="btn border-dark rounded-0 mybtn" type="submit">Submit </button>
  38. </form>
  39. {% else %}
  40. <p>You are not authorized to view this page. </p>
  41. {% endif %}
  42. {% endblock %}