Re: casting unicode to model

2009-11-19 Thread neridaj
I just found out that get() returns only one object. On Nov 19, 2:30 pm, neridaj wrote: > Thanks for the help. Is get_object_for_this_type() not made to handle > multiple objects? If more than one object is returned I get this > error: get() returned more than one Entry. > > On Nov 19, 4:10 am, D

Re: casting unicode to model

2009-11-19 Thread neridaj
Thanks for the help. Is get_object_for_this_type() not made to handle multiple objects? If more than one object is returned I get this error: get() returned more than one Entry. On Nov 19, 4:10 am, David De La Harpe Golden wrote: > Karen Tracey wrote: > > Undocumented internal routine, but unlike

Re: casting unicode to model

2009-11-19 Thread David De La Harpe Golden
Karen Tracey wrote: > Undocumented internal routine, but unlikely to change: > Just to note the contenttypes framework has a documented way: http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#methods-on-contenttype-instances from django.contrib.contenttypes.models import ContentType

Re: casting unicode to model

2009-11-18 Thread neridaj
Thanks Karen but I'm just getting a 'NoneType' object has no attribute 'objects' with this code: def search(request): query = request.GET.get('q', '') model = request.GET.get('models', '') model_class = get_model(blog, model) results = [] if query: results = model_class

Re: casting unicode to model

2009-11-18 Thread Karen Tracey
On Wed, Nov 18, 2009 at 9:09 PM, neridaj wrote: > Hello, > > I have a select menu which I would like to use as a model selector in > a view but I keep getting 'unicode' object has no attribute 'objects' > because I need to cast this to type Model or something similar. How do > I go about doing th

casting unicode to model

2009-11-18 Thread neridaj
Hello, I have a select menu which I would like to use as a model selector in a view but I keep getting 'unicode' object has no attribute 'objects' because I need to cast this to type Model or something similar. How do I go about doing that. Thanks, J -- You received this message because you ar