On Mar 23, 5:32 pm, Paulo Almeida <igcbioinformat...@gmail.com> wrote:
> I don't have a working sample (never did this), but you may be looking for
> something like this:
>
> class Media:
>        js = get_path()


>
> And in the class where you keep use_editor:
>
> def get_path(self)
>     if self.use_editor:
>         return path1
>     else:
>         return path2
>
>

This is a cool idea, but unfortunately throws me back to the original
problem - the class in Admin.py doesn't know how to get to attributes
on the model it references. So if I do:

 class Media:
        js = get_path()

I get: "name 'get_path' is not defined".

If I do:

        js = Tutorial.get_path()

I get: "unbound method get_editor_path() must be called with Tutorial
instance as first argument (got nothing instead)"

If I do:

        js = Tutorial.get_path(self)

I get: "name 'self' is not defined"

Which is exactly the same problem as when I tried to access the field
directly. Seems like the core of the problem is that for some reason
"self" is not recognized from within admin.py classes.

Thanks for any tips on this.

Scot

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