Re: Populating Foreign key in modelform with exclude

2009-05-12 Thread Claude
I too had this issue until I found out I was going about it the wrong way. See Django docs - http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form Your code should be :- formContent = PropertyForm(request.POST) form_instance = formContent.save(commi

Populating Foreign key in modelform with exclude

2009-04-07 Thread ramya
class Property(models.Model): property_id = models.AutoField(primary_key = True) property_name = models.CharField("Name", max_length = 30) user = models.ForeignKey(User) class PropertyForm(ModelForm): class Meta: model = Property exclude = ('user') def addProperty(request): for