Log in

One to One to Topic doesnt return title

  • 1
  • 29 Apr '16

For example:

question_1 = models.OneToOneField(Topic, primary_key=True)

but this returns TopicObject in Django Admin. Is there anyway around this?


nitelyEsteban Castro Borsani
  • 1
  • 29 Apr '16

Yes, use list_display in the ModelAdmin or override the __unicode__ method in the models.Model.

PS. None of Spirit models have the unicode method define since I don't use the django admin. If you do, make sure it returns an unique string (ie: appending the pk to the title), it's better for unit-tests.