google-code-export / django-photologue

Automatically exported from code.google.com/p/django-photologue
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Add def __str__(self) to Photo and Gallery classes #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed (at least in Django 0.96) that when you add a gallery and you
select the photos you want in the gallery, it says something to the effect
of "Photo object". This makes it quite difficult to decide which photo to
add if they all say "Photo object" rather than their title. If you add the
line below, it will display the photos title instead of "Photo object".

Add this to class Gallery and class Photo in models.py:
    def __str__(self):
        return self.title

Original issue reported on code.google.com by Blis...@gmail.com on 16 Mar 2008 at 7:22

GoogleCodeExporter commented 9 years ago
Also add this to all other models classes but change it from:
    def __str__(self):
        return self.title
To:
    def __str__(self):
        return self.name

GalleryUpload may need something different since it doesnt have a title or a 
name.
Maybe something like this would work:

    def __str__(self):
        return 'Gallery Upload #' + self.id

Original comment by Blis...@gmail.com on 16 Mar 2008 at 7:29

GoogleCodeExporter commented 9 years ago
Django trunk has been merge with Unicode branch so now using:
def __unicode__(self):
   return self.title

Original comment by remigi...@gmail.com on 16 Mar 2008 at 9:28

GoogleCodeExporter commented 9 years ago
For now __str__ returns __unicode__ for backwards compatibility with 9.6. 
Please let
me know if this causes any issues.

Original comment by justin.d...@gmail.com on 18 Mar 2008 at 1:26