Commits

Michael Hall  committed ff304d9

case-insensitive matching of app and model names

  • Participants
  • Parent commits f53a5ce

Comments (0)

Files changed (1)

         if field_class is None:
             try:
                 ctype = ContentType.objects.get(model=self.field_type)
-                print "Found ctype: %s" % ctype
+                print "Found ctype: %s (%s.%s)" % (ctype, ctype.app_label, ctype.model)
                 field_class = models.ForeignKey
-                model_def = DynamicModel.objects.get(name=ctype.model, app__name=ctype.app_label)
+                model_def = DynamicModel.objects.get(name__iexact=ctype.model, app__name__iexact=ctype.app_label)
                 model_klass = model_def.as_model()
                 attrs['to'] = model_klass
                 if attrs['to'] is None: