Hi Everyone, I am quite new to Django(4months actually), I am struggling with this problem for last 2 days, I think I am making some stupid mistake. Any help or input is highly appreciated. I am using Django 1.3, so old (1.1 -) solutions are not helpful much actually there are many on stack-overflow.
In the model I have, BUSINESS_GROUP = ( ('MNC','Multinational'), ('INT','International (Export/Import)'), ('DOM','Domestic/National'), ('LOC','Local'), ('VIR','Virtual'), ) class BusinessGroup(models.Model): bgroup_type = models.CharField(max_length=15, choices = BUSINESS_GROUP, blank = True, null = True) class Business(models.Model): business_group_choices = models.ManyToManyField(BusinessGroup, verbose_name= "Business Group") In Form I am doing like, def __init__(self, *args, **kwargs): self.fields['business_group_choices'].widget = forms.CheckboxSelectMultiple(choices=BUSINESS_GROUP) My view looks like, if request.method == 'POST': form = BusinessForm(request.POST, instance = business) #print request #print form if form.is_valid(): new_business = form.save(commit=False) new_business.created_by = request.user new_business.is_blocked=False form_values = form.cleaned_data new_business.save() assign('edit_business', request.user, new_business) return HttpResponseRedirect(new_business.get_absolute_url()) I am getting error like this, "DOM" is not a valid value for a primary key. "INT" is not a valid value for a primary key. etc. I found source of error here in Django model source, http://www.java2s.com/Open-Source/Python/Web-Frameworks/Django/django/forms/models.py.htm But not clear how to interpret and workout this problem. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.