Use field as default for another field

I am new to Django

So I have this model for a page and it looks like this:
from django.db import models
from django.utils import timezone

# Create your models here.
class Page(models.Model):
    title = models.CharField(max_length=200, unique=True, editable=True)
    body = models.TextField(editable=True, help_text='This is the body of the page')
    url = models.CharField(max_length=128, unique=True, default=Page.title)
    date_created = models.DateTimeField(auto_now_add=True)
    published = models.BooleanField(default=True)
        
    class Meta:
       ordering = ['date_created']
       verbose_name_plural = "pages"

    def __str__(self):
        return self.title

When I run the server it tells me Page in not defined. How can Page not be defined? How do I then make the Page.title the default if no URL is entered?

Help is appreciated thanks

It’s not defined since due to Python’s scoping rules. The class isn’t defined until the end of its definition.

As for filling one field with another, you can either do it in a custom save() for your model, or use a SlugField which will prefill in the admin: https://docs.djangoproject.com/en/3.0/ref/models/fields/#slugfield

Thank you I will check it out