the string variable is the name of a model (so I dont know which one
it is) in a known class for a known object in the database, is there
anyway I can change the data for that column without doing a bunch of
if statements trying to figure out which column it actually is. So
for example,
I have t = 'bar' and foo = modelName.objects.get(id = 4)
I want to do something like:
foo.t = "new value" or foo[t] = "new value" (but those dont work).
rather than writing a bunch of if statements like
if t = 'modelfieldone'
...
elif t = 'bar'
...
etc.
Is there anyway to do this?
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment