'Rescan and if necessary create placeholders in the current template.'

def rescan_placeholders(self):

    existing = {}
    placeholders = [pl.slot for pl in self.get_declared_placeholders()]
    for placeholder in self.placeholders.all():
        if (placeholder.slot in placeholders):
            existing[placeholder.slot] = placeholder
    for placeholder in placeholders:
        if (placeholder not in existing):
            existing[placeholder] = self.placeholders.create(slot=placeholder)
    return existing
