Im create with:
class FooForm(forms.ModelForm):
class Meta:
model = foo
fields = '__all__'
an auto form of the model. this works fine. When i now render the fields with:
{% for field in formfields %}
{{ field}}
{% endfor %}
create me this a field for the foreignkey, like a selectfield:
<select name="foo" required id="id_foo">
<option value="">---------</option>
<option value="1">A</option>
<option value="2" selected>B</option>
<option value="3">C</option>
<option value="4">D</option>
I want but like to display only the selected option like a label:
B
My temporary solution is that I get the name in view.py
via string processing and transfer it to the html.
optionname = str(Form['foo'][PFL['foo'].value()])
name = optionname.split(">")[1].split("<")[0]
I'm really dissatisfied with this solution...