[Answered ]-Check if object on foreign key is set

1👍

I think using a try…except is the best way to do this. This issue is mentioned in this (invalid) bug report: https://code.djangoproject.com/ticket/12708

1👍

om = OtherModel()

‘Just’ instantiates a python class. Use a model’s manager to save the relationship before accessing the attribute, or set the field to null=True

om = OtherModel.objects.create()

Have a look at the official manager documentation

Leave a comment