from django.db import models


class Photo(models.Model):
    artist = models.ForeignKey('artists.Artists')
    picture = models.ImageField(null=True, blank=True, upload_to="art_picture/")
    comment = models.TextField(max_length=500)
from django.db import models


class Photo(models.Model):
    artist = models.ForeignKey('artists.Artists')
    picture = models.ImageField(null=True, blank=True, upload_to="art_picture/")
    comment = models.TextField(max_length=500)

    def __str__(self):
        return '{}'.format(self.picture)
Define a '__str__' method for photo model
Define a '__str__' method for photo model

  from django.db import models
  
  
  class Photo(models.Model):
      artist = models.ForeignKey('artists.Artists')
      picture = models.ImageField(null=True, blank=True, upload_to="art_picture/")
      comment = models.TextField(max_length=500)
+ 
+     def __str__(self):
+         return '{}'.format(self.picture)
Define a '__str__' method for photo model
## Code Before:
from django.db import models


class Photo(models.Model):
    artist = models.ForeignKey('artists.Artists')
    picture = models.ImageField(null=True, blank=True, upload_to="art_picture/")
    comment = models.TextField(max_length=500)
## Instruction:
Define a '__str__' method for photo model
## Code After:
from django.db import models


class Photo(models.Model):
    artist = models.ForeignKey('artists.Artists')
    picture = models.ImageField(null=True, blank=True, upload_to="art_picture/")
    comment = models.TextField(max_length=500)

    def __str__(self):
        return '{}'.format(self.picture)