from django.db import models

def register(cls, admin_cls):
    cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True))


from django.db import models

def get_prepared_date(cls):
    return cls.prepared_date or cls.parent.prepared_date

def register(cls, admin_cls):
    cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True))
    cls.add_to_class('get_prepared_date', get_prepared_date)


Add a get prepared date method
Add a get prepared date method

Child pages won't necessarily have a prepared date and it makes sense to
use the parent date to avoid repetition.

  from django.db import models
+ 
+ def get_prepared_date(cls):
+     return cls.prepared_date or cls.parent.prepared_date
  
  def register(cls, admin_cls):
      cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True))
+     cls.add_to_class('get_prepared_date', get_prepared_date)
  
  
Add a get prepared date method
## Code Before:
from django.db import models

def register(cls, admin_cls):
    cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True))


## Instruction:
Add a get prepared date method
## Code After:
from django.db import models

def get_prepared_date(cls):
    return cls.prepared_date or cls.parent.prepared_date

def register(cls, admin_cls):
    cls.add_to_class('prepared_date', models.TextField('Date of Preparation', blank=True, null=True))
    cls.add_to_class('get_prepared_date', get_prepared_date)

