<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def forwards(apps, schema_editor):
 """ Re-save all the Works because something earlier didn't create their slugs. """

    Work = apps.get_model('spectator_events', 'Work')

    for work in Work.objects.all():
        if not work.slug:
            work.slug = generate_slug(work.pk)
            work.save()