On Fri, Jul 17, 2009 at 9:53 PM, Beetle B.<anli...@gmail.com> wrote:
>
> Hi,
>
> 1. In the Python code, how can I access various Meta properties of a
> model (e.g. verbose_name, etc). At the moment, I do it via
> model._meta.verbose_name, but I always get chills down my spine when I
> access properties beginning with a single underscore. Is there a
> "proper" way?

Yes - you pass the data you want in the context as a normal context variable.

> 2. Can someone explain the rationale behind not allowing access to
> properties of objects that begin with double underscores in the
> template? It worked in 1.02, but with SVN I can't access anything like
> object.__class__. I'm merely curious as to why this was restricted. In
> one or two cases, life was easier for me when I could do it.

To the best of my knowledge, you have _never_ been able to access
'protected and private' attributes(i.e., attributes starting with _)
in a template. Are you certain you were able to do this in the past?

If this is true, it would be a major backwards incompatibility, and
one that we will need to fix. However, I'm not aware of any changes
that have been made to the template system since v1.0 was released -
certainly none that would make this change.

Can you provide specifics of the Django versions that you believe
allowed this behaviour, and the earliest version in which you are
aware that it was removed?

Yours
Russ Magee %-)

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

Reply via email to