Ejemplo n.º 1
0
def account_receive(sender, **kwargs):

    # If instance is new and not updated
    created = kwargs.get('created')
    if created:
        name = kwargs.get('instance') # Instance = account name (unicode def in Account)
        account = Account.objects.get(name=name)

        # create first box
        box = Box()
        box.account_id = account.id
        box.number = 1
        box.save()