Here is the form
form
class FishTransferForm(forms.ModelForm):
alias_name = forms.CharField(disabled=True, label='Fish to Transfer')
current_sponsor = forms.CharField(disabled=True, label='Current Sponsor')
new_sponsor = forms.ChoiceField(label='New Sponsor', widget=Select)
class Meta:
model = CustomUser
fields = ('current_sponsor', 'alias_name', 'new_sponsor')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
current_sponsor = CustomUser.objects.filter(id=self.instance.sponsor).values('alias_name').first()
new_sponsors = CustomUser.objects.filter(sponsor=self.instance.sponsor, status__gte=3).values('id', 'alias_name')
self.fields['current_sponsor'].initial = current_sponsor['alias_name']
self.fields['new_sponsor'].choices = [(sponsor['id'], sponsor['alias_name']) for sponsor in new_sponsors]