I have model that looks like this:
class Beacon(models.Model):
name = models.CharField()
bid = models.CharField()
campaigns = models.ManyToMany(Campaign)
location = models.ForeignKey(Location)
In my api view, I am trying to find a specific Beacon given a bid (this is beacon id btw). So I have something that looks like this:
def SawBeacon(request, beacon_id):
if request.method == 'GET':
Beacon = Beacon.objects.filter(bid__beacon_id=%s) % beacon_id
This doesn't work.. But I think you get the idea of what I am trying to do. I want to take the incoming beacon_id argument and filter down to a specific beacon that matches this ID.
- How would I do this?
- When I filter down an object, do I get the object itself or will I get the value?