title: limit choices in the drop down of subcategory based on related category in Django admin
body: <p>I have three models as</p>
  
  <pre><code>class Category(models.Model):
         name = models.CharField(max_length=128)
  
  class SubCategory(models.Model):
      category = models.ForeignKey(Category)
      name = models.CharField(max_length = 400)
  
  class Document(models.Model):
      category = models.ForeignKey(Category, null=True,blank=True,help_text=_('Required'))
      subcategory = models.ForeignKey(SubCategory, null=True, blank=True, help_text =_('Required'))
      title = models.CharField(max_length=300)
  </code></pre>
  
  <p>Now in Admin interface I have category, subcategory and title field.
  If a user is trying to select any subcategory then only that
  subcategory item should be displayed which are related to Category.
  A simple example is Country, state dropdown.
  I am trying to get it from Modelform like</p>
  
  <pre><code>class DocumentAdminModelForm(ModelForm):
  
     def __init__(self, *args, **kwargs):    
         super(DocumentAdminModelForm, self).__init__(*args, **kwargs)
         self.fields['sub_category'] = forms.ModelChoiceField(queryset = SubCategory.objects.filter(category__id = self.fields['category'] ))
  </code></pre>
  
  <p>but it is not working. Should I use some ajax and jquery for this or
  is there any other way you can suggest ??</p>
  
  <p>Thanks</p>