I'm looking at a problem and see how to solve it, probably badly, with
eval(), but don't see what the right solution is.

I want to use Jeditable more or less to make fields on models editable.
Jeditable sends the HTML ID, as well as updated value, when someone makes an
in_place edit. I am following a convention where the HTML ID is something
like *model*_*field*_*id*, and I would like an Ajax view to do some error
checking and if the provided ID is appropriate, take an ID of
entity_description_1 to pull up the Entity with id 1 and set its description
field to the updated value.

I see a way to do this with eval, badly, but what I'd guess of Django is
that there's a way to call .get(model_name) or something like that to avoid
an eval. Is there a dynamic equivalent to
directory.models.Entity.objects.get(pk = 1) or instance.description = value
where "Entity" and "description" are effectively replaced by dynamically
provided values?

-- 
→ Jonathan Hayward, christos.jonathan.hayw...@gmail.com
→ An Orthodox Christian author: theology, literature, et cetera.
→ My award-winning collection is available for free reading online:
☩ I invite you to visit my main site at http://JonathansCorner.com/

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