from a site instance with the ManyToMany relationship to the kiosk, I would like to check if the kiosk object is part of the relationship.
I could do
self.apps.get(id=app_id).exists() and check if True
or
self.apps.get(id=app_id) and catch the ObjectDoesNotExist error
or
self.apps.filter(id=app_id) and check if True
- If I need to catch a possible ObjectDoesNotExist error, I can also use the second
- I can do the second one, but it doesn't seem super clean.
- can use the third, but using a filter by a unique identifier seems wrong to me.
You can tell me to use everything that works, and that will be a valid answer; -)
source
share