I have a sample form:
class AdminDiscountForm(ModelForm): class Meta: model = Discount exclude = (\'company\',)
t
You could try this:
discount = Discount(company = blah) form = AdminDiscountForm(request.POST, instance=discount) if form.is_valid(): discount = form.save()
And the docs say: By default the clean() method validates the uniqueness of fields that are marked as ... unique_together
unique_together