Hi,
I got this error below. Can anybody help me? I don't know what causes the
error.
It happens when I add new FilmPerson entry in Admin Interface
class ContentAssoc(models.Model):
object_a = models.PositiveIntegerField()
type_a = models.ForeignKey(ContentType, related_name='type_a')
object_b = models.PositiveIntegerField()
type_b = models.ForeignKey(ContentType, related_name='type_b')
class Meta:
unique_together = ('object_a', 'type_a', 'object_b', 'type_b')
def __unicode__(self):
return self.type_a
class FilmPerson(ContentAssoc):
order = models.PositiveIntegerField()
as_person = models.CharField(max_length=100, null=True)
def getFilm(self):
filmList = Film.objects.get(id=self.object_a)
film = filmList.get()
return film
def getPerson(self):
personList = Person.object.get(id=self.object_b)
person = personList.get()
return person
################## ERROR ###############################
Environment:
Request Method: POST
Request URL: http://localhost:8000/admin/film/filmperson/add/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'x.common',
'x.person',
'x.film',
'x.media']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')
Traceback:
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in root
157. return self.model_page(request, *url.split('/', 2))
File "C:\Python25\lib\site-packages\django\views\decorators\cache.py" in
_wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "C:\Python25\lib\site-packages\django\contrib\admin\sites.py" in
model_page
176. return admin_obj(request, rest_of_url)
File "C:\Python25\lib\site-packages\django\contrib\admin\options.py" in
__call__
191. return self.add_view(request)
File "C:\Python25\lib\site-packages\django\db\transaction.py" in
_commit_on_success
238. res = func(*args, **kw)
File "C:\Python25\lib\site-packages\django\contrib\admin\options.py" in
add_view
499. self.log_addition(request, new_object)
File "C:\Python25\lib\site-packages\django\contrib\admin\options.py" in
log_addition
294. object_repr = force_unicode(object),
File "C:\Python25\lib\site-packages\django\utils\encoding.py" in
force_unicode
49. s = unicode(s)
Exception Type: TypeError at /admin/film/filmperson/add/
Exception Value: coercing to Unicode: need string or buffer, ContentType
found
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---