from django.db import models


def team_member_image_name(instance, filename):
    return 'team/{0}'.format(instance.name)


class TeamMember(models.Model):
    bio = models.TextField(
        verbose_name='biography')
    name = models.CharField(
        max_length=50,
        unique=True,
        verbose_name='name')
    picture = models.ImageField(
        blank=True,
        null=True,
        upload_to=team_member_image_name)

    def __str__(self):
        """Return the team member's name"""
        return self.name

import os

from django.db import models


def team_member_image_name(instance, filename):
    _, ext = os.path.splitext(filename)

    return 'team/{0}{1}'.format(instance.name, ext)


class TeamMember(models.Model):
    bio = models.TextField(
        verbose_name='biography')
    name = models.CharField(
        max_length=50,
        unique=True,
        verbose_name='name')
    picture = models.ImageField(
        blank=True,
        null=True,
        upload_to=team_member_image_name)

    def __str__(self):
        """Return the team member's name"""
        return self.name

Save team member picture with extension.
Save team member picture with extension.

+ import os
+ 
  from django.db import models
  
  
  def team_member_image_name(instance, filename):
+     _, ext = os.path.splitext(filename)
+ 
-     return 'team/{0}'.format(instance.name)
+     return 'team/{0}{1}'.format(instance.name, ext)
  
  
  class TeamMember(models.Model):
      bio = models.TextField(
          verbose_name='biography')
      name = models.CharField(
          max_length=50,
          unique=True,
          verbose_name='name')
      picture = models.ImageField(
          blank=True,
          null=True,
          upload_to=team_member_image_name)
  
      def __str__(self):
          """Return the team member's name"""
          return self.name
  
Save team member picture with extension.
## Code Before:
from django.db import models


def team_member_image_name(instance, filename):
    return 'team/{0}'.format(instance.name)


class TeamMember(models.Model):
    bio = models.TextField(
        verbose_name='biography')
    name = models.CharField(
        max_length=50,
        unique=True,
        verbose_name='name')
    picture = models.ImageField(
        blank=True,
        null=True,
        upload_to=team_member_image_name)

    def __str__(self):
        """Return the team member's name"""
        return self.name

## Instruction:
Save team member picture with extension.
## Code After:
import os

from django.db import models


def team_member_image_name(instance, filename):
    _, ext = os.path.splitext(filename)

    return 'team/{0}{1}'.format(instance.name, ext)


class TeamMember(models.Model):
    bio = models.TextField(
        verbose_name='biography')
    name = models.CharField(
        max_length=50,
        unique=True,
        verbose_name='name')
    picture = models.ImageField(
        blank=True,
        null=True,
        upload_to=team_member_image_name)

    def __str__(self):
        """Return the team member's name"""
        return self.name
