Hi people
I have this form , as my subject says, it is giving me "to many values
to unpack"
class ProductModelForm(forms.ModelForm):
product_model = forms.ModelChoiceField(ProductModel.objects.all(),
None, u'Modelo')
class Meta:
model = ProductModel
exclude = ['maker', 'product_type']
def __init__(self, maker_filter, *args, **kwargs):
self.base_fields['product_model'].query =
ProductModel.objects.all().filter('maker_id = ',maker_filter)
self.base_fields['product_model'].widget.choices =
self.base_fields['product_model'].choices
super(ProductModelForm, self).__init__(*args, **kwargs)
my view is
#just for tesnting I am no using product_type_id, no yet
def product(request, maker_id, product_type_id):
if request.method == 'POST':
pmform = ProductModelForm(request.POST)
if mform.is_valid():
maker = topic = mform.cleaned_data['maker']
path = '/support/helping/product/%s' % maker
return HttpResponseRedirect(path)
else:
pmform = ProductModelForm(maker_filter=maker_id, data=None,
instance=ProductModel)
return render_to_response('helping.html', {'mform': pmform})
please give a hand
--
Carlos Eduardo Sotelo Pinto a.k.a. krlos
GNULinux RU #379182 || GNULinux RM #277661
GNULinux Arequipa Users Group || Debian Arequipa Users Group
--
http://krlosaqp.blogspot.com
pgp.rediris.es 0xF8554F6B
GPG FP:697E FAB8 8E83 1D60 BBFB 2264 9E3D 5761 F855 4F6B
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---