0
일부 외래 키 관계가있는 몇 가지 모델이 있습니다. forms.py 통해렌더링하는 동안 오류가 발생했습니다 : '긴'객체는 반복 가능하지 않습니다.
은 내가 ModelMultipleChoiceField
위젯
class VariableFieldForm(ModelForm):
custom_field = forms.ModelMultipleChoiceField(queryset=VariableField.objects.all(), widget=FilteredSelectMultiple("Custom Fields", is_stacked=False))
class Meta:
model = VariableField
을 추가하고 저장 한 기록 localhost:8000/admin/product/subcategory/3/
에 액세스를 시도하거나 내가 장고를 사용하고
File "/opt/python2.6/lib/python2.6/site-packages/django/utils/encoding.py" in force_unicode
71. s = unicode(s)
File "/opt/python2.6/lib/python2.6/site-packages/django/forms/forms.py" in __unicode__
408. return self.as_widget()
File "/opt/python2.6/lib/python2.6/site-packages/django/forms/forms.py" in as_widget
439. return widget.render(name, self.value(), attrs=attrs)
File "/opt/python2.6/lib/python2.6/site-packages/django/contrib/admin/widgets.py" in render
39. output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)]
File "/opt/python2.6/lib/python2.6/site-packages/django/forms/widgets.py" in render
581. options = self.render_options(choices, value)
File "/opt/python2.6/lib/python2.6/site-packages/django/forms/widgets.py" in render_options
531. selected_choices = set([force_unicode(v) for v in selected_choices])
Exception Type: TemplateSyntaxError at /admin/product/subcategory/3/
Exception Value: Caught TypeError while rendering: 'long' object is not iterable
다음 역 추적을 얻을 새 레코드를 저장할 때 1.3 및 MySQL
해결 방법에 대한 아이디어?