Returning Value from an anticipated reverse name before instantiation

Consider the following two models

class Something(models.Model):
    name = models.CharField(max_length=255)

    def get_others(self):
        try:
            return self.otherthings.all()
        except Exception:
            pass


class Another(models.Model):
    tie = models.ForeignKey(
        Something,
        on_delete=models.CASCADE,
        related_name="otherthings"
    )

I want to be able to get all related Another models from Something instance models using the custom get_others() method. The above sample works, but I wonder if it is not sloppy. The reverse name “otherthings” only exist for instances (ii.e. after the Meta class has done its thing.)

Is there another way to return self.otherthings.all() without wrapping it within a try/except block?

There is only one related Something accessible from an Another instance : it is another_instance.tie.

The related name otherthings works from Something instances to related Another objects, so the implementation of get_others you give cannot work at all (i.e. it always raises an AttributeError catched by the except block).

So, about saying the above sample works, can you give the statement you execute and the corresponding result showing that “it works” ?

Thank you for that observation. I was half-asleep and frustrated when I drafted those classes. I have corrected the post. The question should now apply

I don’t understand why you need the try/except block there. The expression self.otherthings.all() should return a queryset with 0 or more members.
What is the exception you are getting? What is the code causing the exception? (How are you trying to use get_others that is causing the problem?)

Quite honestly, I can no longer replicate the issue. It has disappeared. I am still watching out for it. I removed the try/except block. So far, no exceptions.

Previously, the error message went something like:
Something does not have “otherthings” attribute