Reputation: 7
I'm working on a duplicate reporting system on Django, and i created a table on my models.py that goes
class DupReport(models.Model):
count = models.IntegerField()
oldersub = models.ForeignKey('Submission', on_delete=models.CASCADE, related_name='older_sub')
newersub = models.ForeignKey('Submission', on_delete=models.CASCADE, related_name='newer_sub')
And when i go to admin to add a row, the menu that displays the rows works fine, but when i click add DupReport, i get this:
TypeError at /admin/apppickoff/dupreport/add/
str returned non-string (type tuple)
< a href="{% add_preserved_filters history_url %}" class="historylink">{% trans "History" %}< /a>
Upvotes: 0
Views: 1063
Reputation: 14836
Look for a stray comma at the end of any __str__
definitions that you did write.
Returning a value with a comma at the end will turn your value into a tuple containing that value.
Upvotes: 1