4π
β
The variable v is a queryset, and you cannot access your models attributes via the queryset. Therefore you should try this to access the first element in your queryset:
for param in section.settingparam_set.all():
v = SettingValue.objects.filter(preset=preset, param=param)
print v[0].id, v[0].value #access first element in query set
Or do this to loop over the items in your queryset:
for param in section.settingparam_set.all():
v = SettingValue.objects.filter(preset=preset, param=param)
for item in v:
print item.id, item.value
π€Thomas Kremmel
Source:stackexchange.com