Tuesday, May 18, 2010

Re: Reflect changes made through Manager to model instances

On May 18, 9:21 am, Alexei Selivanov <alexei.seliva...@gmail.com>
wrote:
> Is it possible to reflect changes made through model's Manager to
> model instances? For example I have ProfileManager class like so:
>
> class ProfileManager(models.Manager):
>
>     def activate_profile(self, id, activation_key):
>         # do activation
>
> And I want changes made by this method be visible in Profile instances.

It's not really clear what your question is. Exactly what is
active_profile doing? Using my crystal ball, it seems that you are
passing an ID in, presumably of a Profile instance. So what are you
hoping to happen? Updating the database row corresponding to that ID?

It seems you are going about this the wrong way. activate_profile
should be a **model** method, not a Manager one. Then it would operate
on that instance directly.
--
DR.

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate