django: admin.StackedInline show full name instead of user name
my inline:
class CollaboratorInLine(admin.StackedInline):
model = Collaborator
extra = 0
my model:
class Collaborator(models.Model):
report = models.ForeignKey(Report)
collaborator = models.ForeignKey(User, limit_choices_to={'groups__name':u'team1'})
def reutnName(self):
return self.collaborator.get_full_name()
def __unicode__(self):
return self.collaborator.get_full_name()
The inline collaborator is shown as a drop downlist, and the ppl are shown as usernames intead of full names. does anyone know how to change it to full name开发者_StackOverflow?
thanks
i got it using formfield_for_manytomany and formfield_for_foreignkey i thought they could only be used in modeladmin, but it could also be used for StackedInline :)
精彩评论