Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Can't convert 'Name' object to str implicitly
  2. Request Method: POST
  3. Request URL: http://127.0.0.1:8000/admin/display/nation/add/
  4. Django Version: 1.6.2
  5. Exception Type: TypeError
  6. Exception Value: Can't convert 'Name' object to str implicitly
  7. Exception Location: models.py in __unicode__, line 24
  8.  
  9. class Name(models.Model):
  10. def __unicode__(self):
  11. return 'Name: ' + self.name
  12. id = models.AutoField(primary_key=True)
  13. name = models.CharField(max_length=32)
  14. class Meta:
  15. db_table = 'name'
  16.  
  17. class Nation(models.Model):
  18. def __unicode__(self):
  19. return 'Nation: ' + self.name
  20. id = models.AutoField(primary_key=True)
  21. name = models.ForeignKey(Name)
  22. flag_path = models.CharField(max_length=64)
  23. class Meta:
  24. db_table = 'nation'
  25.  
  26. u'Name: ' + self.name
  27.  
  28. u'Nation: ' + self.name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement