Greetings -
I'm not sure if this is a bug or if I'm unknowingly doing something that I
ought not, but I started encountering this exception when I switched my
site from debug to production:
Traceback (most recent call last):
>
> File
> "/usr/local/lib/python2.7/dist-packages/Django-1.4.2-py2.7.egg/django/core/handlers/base.py",
>
> line 111, in get_response
> response = callback(request, *callback_args, **callback_kwargs)
>
> File
> "/usr/local/lib/python2.7/dist-packages/Django-1.4.2-py2.7.egg/django/contrib/auth/decorators.py",
>
> line 20, in _wrapped_view
> return view_func(request, *args, **kwargs)
>
> File "/var/django/acclaimd2/program/api.py", line 813, in
> put_interview_request
> interview_request_json['email'])
>
> File "/var/django/acclaimd2/program/models.py", line 205, in create
> referral=Referral()
>
> File
> "/usr/local/lib/python2.7/dist-packages/Django-1.4.2-py2.7.egg/django/db/models/base.py",
>
> line 349, in __init__
> val = field.get_default()
>
> File
> "/usr/local/lib/python2.7/dist-packages/Django-1.4.2-py2.7.egg/django/db/models/fields/related.py",
>
> line 955, in get_default
> if isinstance(field_default, self.rel.to):
>
> TypeError: isinstance() arg 2 must be a class, type, or tuple of classes
> and types
>
Here's the Referral model for your reference:
> class Referral (models.Model):
> opening =
> models.ForeignKey(Opening,related_name='referrals',null=False,blank=False)
> origin_request =
> models.ForeignKey('common.request',related_name='referrals',null=True,default=None)
> candidate =
> models.ForeignKey(User,related_name='referrals',null=False,blank=False)
> intro = models.TextField(max_length=1000,null=False,blank=False)
> experience = models.TextField(max_length=5000,null=False,blank=False)
> email = models.CharField(max_length=255,null=False,blank=False)
> phone =
> models.CharField(max_length=255,null=False,blank=True,default='')
>
> @staticmethod
> def create(opening,origin_request,candidate,intro,experience,email):
> referral=Referral()
> referral.opening=opening
> referral.origin_request=origin_request
> referral.candidate=candidate
> referral.intro=intro
> referral.experience=experience
> referral.email=email
> referral.save()
> return referral
>
> def __unicode__(self):
> return u"%s" % self.id
>
Again, this works perfectly in DEBUG mode but begins firing off exception
emails to me the minute I switch off debug. I've been hitting my head
against the wall for the better part of the day trying to figure out what's
going on. Any help would be greatly, greatly appreciated.
Thank you!
Derek
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/MA5JAIhRJ-IJ.
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.