Karen,

this is a good solution if I wanted to do the validation inside the
view, where this value is available.
However, I want to raise a ValidationError inside the ModelForm class.
Therefore I need this value inside this class.

Is their a way to get a similar value in the newforms ModelForm class?

On 7 apr, 16:06, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 7, 2008 at 9:37 AM, Petar <[EMAIL PROTECTED]> wrote:
>
> > Hi Michael,
>
> > your suggestion doesn't work for my situation. It isn't important if
> > the value has been filled in, but only if the value has changed from
> > the originally filled in value.
>
> Then you can checked the entered value against the initial one:
>
> form.initial['field_name']
>
> Karen
>
>
>
> > On 7 apr, 02:31, Michael <[EMAIL PROTECTED]> wrote:
> > > Inside the clean method you have access to self.instance.pk, which
> > returns
> > > true if there an instance (with an already established primary key) or
> > false
> > > if there isn't already an instance.
>
> > > Hope that helps,
>
> > > Michael
>
> > > On Sun, Apr 6, 2008 at 5:44 PM, Petar <[EMAIL PROTECTED]> wrote:
>
> > > > Dear someone,
>
> > > > I have a ModelForm for my User (standard django) model. I want to
> > > > check if the email is unique so I created a clean_email method which
> > > > works fine. The only problem is that I only want to check the email
> > > > address when it's changed.
>
> > > > Is their a way to get the 'initial' value of the email formfield and
> > > > only perform a check if it has changed?
>
> > > > Thanks in advance,
> > > > Pero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to