I'm using Django as my framework but am doing things beyond regular
web development as I have some a lot of "components" outside of any of
the django apps that I am often interacting with and, in some of
these, I want to be able to make calls to the database for a model but
want to be able to pass in the model's name as a variable since I want
to write re-usable code as much as possible... I have really been
struggling in figuring out how to do this and would appreciate any
advice.. below is some example code of what I am trying to do:

def call_database_from_variable (dict_variables)
    from web1.dict_variables['appname'].models import
dict_variables['modelname']
    p =
dict_variables['modelname'].objects.filter(status_listurl='u')

dict_variables={'app':'myappname','model':'Mymodelname','field':'field_i_want_to_get'}
call_database_from_variable (dict_variables)

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