I am trying to display the album titles related to my image in my admin interface--class Album(models.Model):title = models.CharField(max_length = 60)def __unicode__(self):return self.titleclass Tag(models.Model):tag = models.CharField(max_length = 50)def __unicode__(self):return self.tagclass Image(models.Model):title = models.CharField(max_length = 60, blank = True, null = True)image = models.FileField(upload_to = get_upload_file_name)tags = models.ManyToManyField(Tag, blank = True)albums = models.ForeignKey('Album')width = models.IntegerField(blank = True, null = True)height = models.IntegerField(blank = True, null = True)created = models.DateTimeField(auto_now_add=True)How I am getting these album titles is with this methoddef albums_(self):lst = [x[1] for x in self.albums.values_list('albums')]return ", ".join(lst)However it is not working correctly. I am not sure how to fix this method. How can I display the album title to the appropriate image?class ImageAdmin(admin.ModelAdmin):search_fields = ["title"]list_display = ["__unicode__", "title", "tags_", "albums_", "created"]list_filter = ["tags", "albums"]admin.site.register(Image, ImageAdmin)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fbcaaf06-0dfd-4001-895e-1d9d483e29e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.