from django.db import models


class Picture(models.Model):
    """
    This is a small demo using just two fields. ImageField depends on PIL or
    pillow (where Pillow is easily installable in a virtualenv. If you have
    problems installing pillow, use a more generic FileField instead.
    """

    picture_file = models.ImageField(upload_to="pictures")

    def __unicode__(self):
        return self.picture_file.name

from django.db import models


class Picture(models.Model):
    """
    This is a small demo using just two fields. ImageField depends on PIL or
    pillow (where Pillow is easily installable in a virtualenv. If you have
    problems installing pillow, use a more generic FileField instead.
    """

    file = models.ImageField(upload_to="pictures")

    def __unicode__(self):
        return self.file.name

Use the same name for the field in frontend and backend
Use the same name for the field in frontend and backend

  from django.db import models
  
  
  class Picture(models.Model):
      """
      This is a small demo using just two fields. ImageField depends on PIL or
      pillow (where Pillow is easily installable in a virtualenv. If you have
      problems installing pillow, use a more generic FileField instead.
      """
  
-     picture_file = models.ImageField(upload_to="pictures")
+     file = models.ImageField(upload_to="pictures")
  
      def __unicode__(self):
-         return self.picture_file.name
+         return self.file.name
  
Use the same name for the field in frontend and backend
## Code Before:
from django.db import models


class Picture(models.Model):
    """
    This is a small demo using just two fields. ImageField depends on PIL or
    pillow (where Pillow is easily installable in a virtualenv. If you have
    problems installing pillow, use a more generic FileField instead.
    """

    picture_file = models.ImageField(upload_to="pictures")

    def __unicode__(self):
        return self.picture_file.name

## Instruction:
Use the same name for the field in frontend and backend
## Code After:
from django.db import models


class Picture(models.Model):
    """
    This is a small demo using just two fields. ImageField depends on PIL or
    pillow (where Pillow is easily installable in a virtualenv. If you have
    problems installing pillow, use a more generic FileField instead.
    """

    file = models.ImageField(upload_to="pictures")

    def __unicode__(self):
        return self.file.name
