Tuesday, February 28, 2012

Re: "model_name" object has no attribute '_adding'

I don't remember reading anything about an "_adding" attribute in the
documentation. However, if you want to check for an INSERT vs an
UPDATE just check for the existence of a primary key

def clean( self ):
from django.core.exceptions import ValidationError
if self.pk is None: (do this)
else: (do this)

2012/2/27 dizzydoc <htc.karanagarwal@gmail.com>:
> Hi django users,
>
> I have just migrated my projected from django 1.2.7 to django 1.3.
>
> I am receiving the following error while saving an object from admin.
>
>  "model_name" object has no attribute '_adding'
>
> I am getting this error in clean method of some of my models where i
> use it the following way:
>
> def clean( self ):
>        from django.core.exceptions import ValidationError
>        if self._adding: (do this)
>        else: (do this)
>
> Please help if you have any clue, while i search for the fix.
>
> Thanks.
>
> --
> 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 django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
Andrés Reyes Monge
armonge@gmail.com
+(505)-8873-7217

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment