Q: Django admin foreign key values custom form So, I have a model Puzzle and a model Piece. Piece has as foreignKey to Puzzle. And on the admin, on puzzle form to add a new element, i have a stackedInLine for pieces. But i can only add more if I enter all the data from the piece. Is there a way to add new Pieces to the puzzle by choosing from a dropdown with the Piece values already stored on the DB ?? I google'd forever and found nothing....thanks. So what I have is:
class Puzzle(models.Model):
     name = models.CharField(max_length=200)

class Piece(models.Model):
     name = models.CharField(max_length=200)
     puzzle = models.ForeignKey(Puzzle, null=True)

And on the django backend, when I am editing a puzzle I would like to choose from a dropdown of all the Piece models stored on the DB and "assign" them to the current puzzle i'm editing. Is this possible? I'm at the moment using: 
class PieceInline(admin.StackedInline):
      model = Piece
      extra = 1
class PuzzleAdmin(admin.ModelAdmin):
      model = Piece
      inlines = (PieceInLine, )

So I have a stackedinline of pieces on the puzzle form, but I can only create new ones...

A: What if you create a new model, say:
from django.dispatch import receiver


class PieceSelector(models.Model):
    piece = models.ForeignKey(Piece)

    def __unicode__(self):
        return piece.some_field

@receiver(post_save, sender=Piece)
def piece_post_save_signal_receiver(sender, **kwargs):
    if kwargs['created']:
        PieceSelector.objects.create(piece=kwargs['instance'])

Now, when you create a Piece model object, you should create PieceSelector object too. You can do it using post_save signal of the Piece model and it will provide all the pieces in a dropdown.
When in the admin.py, use PieceSelector as a StackedInline for Puzzle model.
