import tempfile import uuid from django.contrib.auth.models import User from django.core.files.storage import FileSystemStorage from django.db import models try: from PIL import Image except ImportError: Image = None else: temp_storage_dir = tempfile.mkdtemp() temp_storage = FileSystemStorage(temp_storage_dir) class MyFileField(models.FileField): pass class Member(models.Model): name = models.CharField(max_length=100) birthdate = models.DateTimeField(blank=True, null=True) gender = models.CharField( max_length=1, blank=True, choices=[("M", "Male"), ("F", "Female")] ) email = models.EmailField(blank=True) def __str__(self): return self.name class Artist(models.Model): pass class Band(Artist): uuid = models.UUIDField(unique=True, default=uuid.uuid4) name = models.CharField(max_length=100) style = models.CharField(max_length=20) members = models.ManyToManyField(Member) def __str__(self): return self.name class UnsafeLimitChoicesTo(models.Model): band = models.ForeignKey( Band, models.CASCADE, limit_choices_to={"name": '"&>