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
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.
2 matches
Mail list logo