def user_num_documents(user):
 return Document.objects.filter(revisions__creator=user).exclude(html__startswith='<p>REDIRECT <a').distinct().count()

def user_num_documents ( user ) : return Document . objects . filter ( revisions__creator = user ) . exclude ( html__startswith = '<p>REDIRECT <a' ) . distinct ( ) . count ( )
count the number of documents a user has contributed to .