

def formfield(self, **kwargs):
    db = kwargs.pop('using', None)
    if isinstance(self.rel.to, six.string_types):
        raise ValueError(('Cannot create form field for %r yet, because its related model %r has not been loaded yet' % (self.name, self.rel.to)))
    defaults = {
        'form_class': forms.ModelChoiceField,
        'queryset': self.rel.to._default_manager.using(db).complex_filter(self.rel.limit_choices_to),
        'to_field_name': self.rel.field_name,
    }
    kwargs.update(kwargs)
    return super(ForeignKey, self).formfield(**defaults)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/models/fields/related.py ForeignKey.formfield/VarMisuse@108/174 `defaults`->`kwargs`