class Master(models.Model):
master = models.ForeignKey(User, on_delete=models.CASCADE)
class MasterChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.get_full_name()
class MasterAdmin(admin.ModelAdmin):
...
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'master':
return MasterChoiceField(queryset=User.objects.all())
return super().formfield_for_foreignkey(db_field, request, **kwargs)