Issue with Django Models and Model Managers

Hello all! This is my first time working with Django and I was curious if anyone could point me in the right direction. I have a Django app that I am doing some work in. I have three separate models with different attributes in them. Below is what the code looks like:

from django.db import models

class Universe(models.Model):
    """A fictional universe."""
    name = models.CharField(max_length=100)
    slug = models.SlugField()
    def __str__(self):

class Show(models.Model):
    """A television show within a universe."""
    name = models.CharField(max_length=100)
    universe = models.ForeignKey(Universe, on_delete=models.CASCADE)
    slug = models.SlugField()
    theme = models.CharField(max_length=100, blank=True)
    seasons = models.IntegerField(blank=True, null=True)
    episodes = models.IntegerField(blank=True, null=True)
    def __str__(self):

class Character(models.Model):
    """A character on a show."""
    first_name = models.CharField(max_length=100)
    last_name = models.CharField(max_length=100)
    actor = models.CharField(max_length=200)
    shows = models.ManyToManyField(Show)
    slug = models.SlugField()
    objects = CharacterManager()
    def __str__(self):
        return '{self.first_name} {self.last_name}'.format(self=self)

    class Meta(object):
        ordering = ('slug', )

The goal is to make it so that a user can create a character, show, and universe in one call using a Character manager.

By digging through the docs I came to this block of code:

class CharacterManager(models.Manager):   
    def create_with_show_and_universe(self, first_name, last_name, actor,
                                      slug, show_name, show_slug,
                                      universe_name, universe_slug):
        first_name = self.create(first_name=first_name)
        last_name = self.create(last_name=last_name)
        actor = self.create(actor=actor)
        slug = self.create(slug=slug) = show_name
        Show.slug = show_slug = universe_name
        Universe.slug = universe_slug

The issue is that I am getting the below error when I try to run the test:

AttributeError: 'NoneType' object has no attribute 'first_name'

This is the test I run:

def test_create_new_character_show_and_universe(self):
	character = models.Character.objects.create_with_show_and_universe(
		actor='Rue McClanahan',
		show_name='Golden Girls',
		universe_name='Golden Girls',

	self.assertEqual(character.first_name, 'Blanche')
	self.assertEqual(character.last_name, 'Devereaux')
	self.assertEqual(, 'Rue McClanahan')
	self.assertEqual(character.slug, 'blanche_devereaux')

I am still digging through the docs surrounding models and model managers. Any help would be appreciated.

Hey George,

nice to meet you! :wave:

It would be awesome to see a working example,
because debugging by only reading is not that easy.

Maybe codesandbox has a template for Django.

Hello, nice to meet you as well! Sorry for the lateness. I managed to sort of kind of get a solution. I don’t believe it was the right solution but it was fine. I was able to get some help from reddit so this can be marked completed or deleted.

Here is the thread that helped me if anyone wants to check it out:

Also I don’t think codesandbox had a django template.