2👍
✅
Pass the beac_data
in the context and iterate through it in the template:
def get(self, request, *args, **kwargs):
user = User.objects.get(username=request.user.username)
beac_data = user.get_profile().owned_beacons.all()
return render(request, self.template_name, {
'form': self.form,
'location': location,
'beac_data': beac_data
})
Then, in the template:
{% for beacon in beac_date %}
{{ beacon.name }}
{{ beacon.factory_id }}
{{ beacon.location }}
{{ beacon.visible }}
{{ beacon.config_id }}
{% endfor %}
Source:stackexchange.com