On Thu, Oct 2, 2008 at 12:02 PM, WillF <[EMAIL PROTECTED]> wrote:

>
>
> Michael, Thanks for the response.
>
> I understand that part but what if i wanted to make it arbitrary. In the
> case of an arbitrary variable called "attribute". Something like
>
> user_profile.get(attribute) where attribute can be anything (ie
> 'firstname',
> 'lastname').
>
> Is there a way to get a arbitrary attribute from the model?
>

attribute_var = 'name'
getattr(model, attribute_var)

Am I not understanding what you are asking? Does that not work?

Mn

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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