Django: How to do reverse foreign key lookup of another class without an instance of this class?
<p>I have the following two Django Classes <code>MyClassA</code> and <code>MyClassB</code>.</p>

<p><code>MyClassB</code> has a foreign key reference to an instance of <code>MyClassA</code>.</p>

<pre><code>from django.db import models

class MyClassA(models.Model):
    name = models.CharField(max_length=50, null=False)

    @classmethod
    def my_method_a(cls):
        # What do I put here to call MyClassB.my_method_b()??


class MyClassB(models.Model):
    name = models.CharField(max_length=50, null=False)
    my_class_a = models.ForeignKey(MyClassA, related_name="MyClassB_my_class_a")

    @staticmethod
    def my_method_b():
        return "Hello"
</code></pre>

<p>From within <code>MyClassA</code>'s class method <code>my_method_a</code>, I would like to call <code>MyClassB</code>'s static method <code>my_method_b</code>. How can I do it? If <code>my_method_a</code> was an instance method, I would simply do <code>self.MyClassB_my_class_a.model.my_method_b()</code>. But since I don't have an instance of <code>MyClassA</code>, I don't know how to do it.</p>

<p>Can I use <code>cls</code> instead of <code>self</code>?</p>

<p>Since it is a <code>staticmethod</code>, you don't need an instance.  </p>

<p>You can call <code>MyClassB.my_method_b()</code> directly.</p>

python django static-methods class-method instance-method