A follow on question. In a similar vein, I need to be able to call
the object manager on models specified at run time. I figured out how
to get this to work for cases where the arguments are empty, thanks to
Malcolm's assstance:
mgr = getattr(eval(modelName), 'objects');
objs = getattr(mgr, 'all')()
However, when trying to use filters or get with arguments, I can't
figure out how to pass arguments submitted from POST or from another
method.
objs = getattr(mgr, 'filter')(filterField = filterValue) <-- This
doesn't work
objs = getattr(mgr, 'filter')("filterField = filterValue") <-- This
doesn't work
objs = getattr(mgr, 'filter')(filterField, filterValue) <-- This
doesn't work
objs = getattr(mgr, 'filter')(eval(str(filterField) + "=" +
str(filterValue)) <-- This doesn't work
Any ideas on how to do this correctly, by which I mean how to pass the
filter arguments, either directly or as a string? Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---