I'm trying to display some cont'd items in manytomany in the list display in django, but it is returning an error, follow the codes:
Models.py
class Apenso(models.Model):
usuario = models.ForeignKey(User, blank=True)
processo = models.OneToOneField(Processo, blank=True, default=None)
apensos = models.ManyToManyField(Processo, blank=True, default=None, related_name="Apensos")
def __unicode__(self):
return unicode(self.apenso) or u''
admin.py
class ApensoAdmin(admin.ModelAdmin):
list_display = ('processo', 'get_apensos', 'usuario')
list_display_links = list_display
list_per_page = 30
search_fields = ('processo', 'requerente__nome')
show_change_link = False
def get_apensos(self):
return ", ".join([str(p) for p in self.apenso.all()])
And the error displayed is:
Exception Value:
get_apensos() takes exactly 1 argument (2 given)