Guest User

Untitled

a guest
Oct 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. class location(models.Model):
  2. loc_room = models.CharField(max_length=20, blank=True, null=True)
  3. loc_block = models.IntegerField(blank=True, null=True)
  4. loc_shelf = models.CharField(max_length=4, blank=True, null=True)
  5.  
  6. class box(models.Model):
  7. box_contents = models.CharField(max_length=300, blank=True, null=True)
  8. project_assigned_to = models.ForeignKey('project', null=True)
  9. location_id = models.ForeignKey('location', null=True)
  10.  
  11. def all_assets(request):
  12. box_data = box.objects.all()
  13. return render(request, 'main_app/all_assets.html', { "box_data":box_data })
  14.  
  15. <thead>
  16. <tr>
  17. <th>Assets</th>
  18. <th>Project</th>
  19. <th>Room</th>
  20. <th>Block</th>
  21. <th>Shelf</th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. {% for item in box_data %}
  26. <tr>
  27. <td>{{ item.box_contents }}</td>
  28. <td>{{ item.project_assigned_to }}</td>
  29. <td>**Here I need to add data from ROOM**</td>
  30. <td>**Here I need to add data from BLOCK**</td>
  31. <td>**Here I need to add data from SHELF**</td>
  32. </tr>
  33. {% endfor %}
Add Comment
Please, Sign In to add comment