Re: change modelform values after POST

2010-03-29 Thread Paulo Almeida
It depends on what you want. You can set 'created_by' to blank=True and null=False, so it doesn't have to be filled but it is still mandatory in the database. Or, if you never want to set it in the form, you can make it 'editable=False' and it doesn't show up in the form, but it can still be NOT NU

Re: change modelform values after POST

2010-03-27 Thread tc
On 21 mar, 22:38, Bjunix wrote: > You probably want to change the attributes of the model object > directly. > > "If you call save() with commit=False, then it will return an object > that hasn't yet been saved to the database." > Source:http://docs.djangoproject.com/en/dev/topics/forms/modelfor

Re: change modelform values after POST

2010-03-21 Thread Bjunix
You probably want to change the attributes of the model object directly. "If you call save() with commit=False, then it will return an object that hasn't yet been saved to the database." Source: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method So I would do something

change modelform values after POST

2010-03-21 Thread Cesar Devera
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()