Sunday, October 31, 2010

Re: django-registration question: activation_key_expired.boolean = True

On Sun, Oct 31, 2010 at 8:48 AM, adj7388 <adj7388@gmail.com> wrote:
> What does that last line do? I have looked high and low in Django and
> Python documentation, but I can't find an example or explanation of
> this pattern. It appears to be clobbering the method
> 'activation_key_expired()' with a boolean that is always True. Surely
> there's something else at work here, isn't there?  Sorry if this is
> obvious to everyone but me, but I can't find the answer anywhere.

It sets an attribute on the instancemethod object
'activation_key_expired'. Remember: everything is an object, and you
can fiddle with attributes on any object.

This particular object is used by the admin:

http://docs.djangoproject.com/en/1.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Read through that carefully and you'll see the 'boolean' option and a
few other useful tricks.


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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