Re: ModelForm/clean_

2009-03-06 Thread gregor kling
Daniel Roseman wrote: > On Mar 6, 10:37 am, gregor kling > wrote: >> Hello List, >> >> I have a form inheriting from ModelForm. >> class C(ModelForm): >> >> >> class Meta: >> model = SomeModel >> >> def clean_somefield: >> enhanced checks >> >> Now my problem is

Re: ModelForm/clean_

2009-03-06 Thread Daniel Roseman
On Mar 6, 10:37 am, gregor kling wrote: > Hello List, > > I have a form inheriting from ModelForm. > class C(ModelForm): >       > >      class Meta: >          model = SomeModel > >      def clean_somefield: >          enhanced checks > > Now my problem is how to access session data (request.ses

ModelForm/clean_

2009-03-06 Thread gregor kling
Hello List, I have a form inheriting from ModelForm. class C(ModelForm): class Meta: model = SomeModel def clean_somefield: enhanced checks Now my problem is how to access session data (request.session) from within the clean method. Does anyone have a clue how

Re: Get old value of Field in ModelForm clean_* method?

2009-02-12 Thread Malcolm Tredinnick
On Thu, 2009-02-12 at 20:40 -0500, Chris Czub wrote: > No, that is the uncleaned data. > > Maybe a more explicit example will help: > > You go to edit an instance of a model that has a field named "title". > > The value of "title" for this particular instance is currently "Test". > > You chang

Re: Get old value of Field in ModelForm clean_* method?

2009-02-12 Thread Chris Czub
No, that is the uncleaned data. Maybe a more explicit example will help: You go to edit an instance of a model that has a field named "title". The value of "title" for this particular instance is currently "Test". You change the value of "title" from "Test" to "Test123" and click "save". How

Re: Get old value of Field in ModelForm clean_* method?

2009-02-12 Thread Briel
Your problem is a bit unclear, but i think what you are looking for is in self.data in your clean_ method On 12 Feb., 23:56, Chris Czub wrote: > Is there any way to get the old value of a field in a clean_* method > on the ModelForm? > > That is - the validation depends on the old value of the f

Get old value of Field in ModelForm clean_* method?

2009-02-12 Thread Chris Czub
Is there any way to get the old value of a field in a clean_* method on the ModelForm? That is - the validation depends on the old value of the field versus the new value. self.cleaned_data only contains the new value. Thanks, Chris --~--~-~--~~~---~--~~ You re