hi. I have a ModelForm based on an Model like this:
class MyModel(models.Model): attr1 = models.CharField() attr2 = models.CharField() attr3 = models.CharField() createdby = models.ForeignKey(User, related_name='createdby', db_column='createdbyid') calculatedfield = models.CharField() class MyModelForm(ModelForm): class Meta: model = MyModel the attribute fields attr1, attr2 and attr3 are properly shown on my html page, and correctly restored on my server-side view like this: def save(request,id): user = request.user try: mymodel = MyModel.objects.get(pk=id) except: mymodel = MyModel() form = MyModelForm(request.POST, instance=mymodel) now comes the problem: I want to set the createdby attribute only on my view, AFTER the html page Post. I want to set the createdby and any other calculated field on server side. is it possible? I tried: form['createdby'] = request.user but it didn't seem to work. this field (createdby) is NOT NULL and so I wouldn't like to set it to NULL, save the form with form.save() and later recover the entity again and manipulate the remaining fields... any ideas? thanks in advance. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.