1
You’re probably looking for this: https://docs.djangoproject.com/en/dev/ref/models/instances/#django.db.models.Model.get_FOO_display
{{ object.get_field_display }}
0
As per my understanding you need to get selected option text when ever it will change or submitted right?, then you need to represent all options like this in a way so you will get whole object of option which is selected, then you can extract the value of even text from it.
Follow this:
<select ng-model="selectOption" ng-change="changedValue(selectOption)"
data-ng-options="option as allOptions.name for option in allOptions">
<option value="">Select Account</option>
// Controller will be like this :
function ctrl($scope){
$scope.itemList=[];
$scope.allOptions=[{id:1,name:"a"},{id:2,name:"b"},{id:3,name:"c"}]
$scope.changedValue=function(item){
$scope.itemList.push(item.name);
}
}
- Django form.is_valid() is always False while uploading images
- Maintain path redirect after signup in Django
- Django exercises
Source:stackexchange.com