def METHOD_NAME(self):
    project = self.project
    if not project.is_draft:
        messages.info(self.request, _("Project is already published"))
        return
    if project.published_modules.count() == 0:
        messages.error(
            self.request, _("Project cannot be published. " "No module is added.")
        )
        return
    dashboard = get_project_dashboard(project)
    num_valid, num_required = dashboard.get_project_progress()
    for module in project.published_modules:
        nums = dashboard.get_module_progress(module)
        num_valid = num_valid + nums[0]
        num_required = num_required + nums[1]
    is_complete = num_valid == num_required
    if not is_complete:
        messages.error(
            self.request,
            _("Project cannot be published. " "Required fields are missing."),
        )
        return
    responses = signals.project_pre_publish.send(
        sender=None, project=project, user=self.request.user
    )
    errors = [str(msg) for func, msg in responses if msg]
    if errors:
        msg = _("Project cannot be published.") + " \n" + "\n".join(errors)
        messages.error(self.request, msg)
        return
    project.is_draft = False
    project.save()
    signals.project_published.send(
        sender=None, project=project, user=self.request.user
    )
    messages.success(self.request, _("the project has been published."))