Re: retrieve model instance from database without model instance

2012-01-23 Thread Brett Epps
Check out the content types framework[1]. You can do something like: ct = ContentType.objects.get(app_label='products', model='product') obj = ct.get_object_for_this_type(name='Venezuelan Beaver Cheese') However, as you can see in the example, you'll need to know the name of the app so that Djan

retrieve model instance from database without model instance

2012-01-23 Thread brian
How do I retrieve a model instance from the database without a model instance? For example from the doc[1] it has: product = Product.objects.get(name='Venezuelan Beaver Cheese') I want something like getInstance( 'Product', 'Venezuelan Beaver Cheese' ) Here are the details of what I'm doing.