Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class location(models.Model):
- loc_room = models.CharField(max_length=20, blank=True, null=True)
- loc_block = models.IntegerField(blank=True, null=True)
- loc_shelf = models.CharField(max_length=4, blank=True, null=True)
- class box(models.Model):
- box_contents = models.CharField(max_length=300, blank=True, null=True)
- project_assigned_to = models.ForeignKey('project', null=True)
- location_id = models.ForeignKey('location', null=True)
- def all_assets(request):
- box_data = box.objects.all()
- return render(request, 'main_app/all_assets.html', { "box_data":box_data })
- <thead>
- <tr>
- <th>Assets</th>
- <th>Project</th>
- <th>Room</th>
- <th>Block</th>
- <th>Shelf</th>
- </tr>
- </thead>
- <tbody>
- {% for item in box_data %}
- <tr>
- <td>{{ item.box_contents }}</td>
- <td>{{ item.project_assigned_to }}</td>
- <td>**Here I need to add data from ROOM**</td>
- <td>**Here I need to add data from BLOCK**</td>
- <td>**Here I need to add data from SHELF**</td>
- </tr>
- {% endfor %}
Add Comment
Please, Sign In to add comment