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
- [Answered ]-Different content type objects in django template
- [Answered ]-Basic celery task function call from inside a django function
- [Answered ]-Django list of all possible error messages which a CharField form validator can raise?
- [Answered ]-Submit form is empty — Django
Source:stackexchange.com