'Return whether `user` is allowed to edit document-level metadata.
If the Document doesn\'t have a current_revision (nothing approved) then
all the Document fields are still editable. Once there is an approved
Revision, the Document fields can only be edited by privileged users.'

def allows_editing_by(self, user):

    return ((not self.current_revision) or user.has_perm('wiki.change_document'))
