<p>I have a two way foreign relation similar to the following</p>

<pre><code>class Parent(models.Model):
  name = models.CharField(max_length=255)
  favoritechild = models.ForeignKey("Child", blank=True, null=True)

class Child(models.Model):
  name = models.CharField(max_length=255)
  myparent = models.ForeignKey(Parent)
</code></pre>

<p>How do I restrict the choices for Parent.favoritechild to only children whose parent is itself?  I tried</p>

<pre><code>class Parent(models.Model):
  name = models.CharField(max_length=255)
  favoritechild = models.ForeignKey("Child", blank=True, null=True, limit_choices_to = {"myparent": "self"})
</code></pre>

<p>but that causes the admin interface to not list any children.</p>

This isn't how django works. You would only create the relation going one way.
```
```
class Parent(models.Model):
  name = models.CharField(max_length=255)

class Child(models.Model):
  name = models.CharField(max_length=255)
  myparent = models.ForeignKey(Parent)
```
```
And if you were trying to access the children from the parent you would do
```
parent_object.child_set.all()
```
. If you set a related_name in the myparent field, then that is what you would refer to it as. Ex:
```
related_name='children'
```
, then you would do
```
parent_object.children.all()
```
Read the
docs
http://docs.djangoproject.com/en/dev/topics/db/models/#many-to-one-relationships
for more.