hi,
I have this code snippet:
for k,v in match.__dict__.items():
if k in
['_state','id','incident_id','initiaterequest_id','matched']:
continue
if v:
nme = k.split('_')[0]
modl = get_model('incident',nme)
modlinstance = modl.objects.get(pk=int(v))
qlist[nme] = modlinstance
query = Incident.objects.filter(**qlist)
this was working fine. It works fine in the shell. But over the web
django barfs saying: None type does not have attribute 'objects'. But if
I print 'modl' - it gives
<class 'incident.models.Product'>
in the shell if I do
get_model('incident','product').objects.get(pk=1) it works.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8999/incident/showmatches/5/
Django Version: 1.3 SVN-16037
Python Version: 2.6.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'employee',
'incident',
'customer',
'vendor',
'assets',
'products']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in
get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
File
"/usr/lib/python2.6/site-packages/django/contrib/auth/decorators.py" in
_wrapped_view
19. return view_func(request, *args, **kwargs)
File
"/home/lawgon/servicefirst/servicefirst/../servicefirst/incident/views.py" in
showmatches
200. modlinstance = modl.objects.get(pk=int(v))
Exception Type: AttributeError at /incident/showmatches/5/
Exception Value: 'NoneType' object has no attribute 'objects'
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.