當前位置: 首頁>>代碼示例>>Python>>正文


Python Job.title方法代碼示例

本文整理匯總了Python中jobs.models.Job.title方法的典型用法代碼示例。如果您正苦於以下問題:Python Job.title方法的具體用法?Python Job.title怎麽用?Python Job.title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jobs.models.Job的用法示例。


在下文中一共展示了Job.title方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: publish

# 需要導入模塊: from jobs.models import Job [as 別名]
# 或者: from jobs.models.Job import title [as 別名]
    def publish(self, request, pk=None):
        """
        use for draft job publish

        """
        draft_job = self.get_object()
        serializer = ActionSerializer(data=request.data)
        if serializer.is_valid():
            if serializer.data.pop('action') == AVAILABLE_ACTIONS['JOB_PUBLISH']:
                now = datetime.now().strftime('%Y%m%d%H%M%S%f') + '%s' % pk

                job_to_publish = Job()
                job_to_publish.owner = draft_job.owner
                job_to_publish.time_of_publish = timezone.now()
                job_to_publish.job_id = now
                job_to_publish.job_list_type = draft_job.job_list_type
                job_to_publish.status = Job.STATUS.active
                job_to_publish.job_rate = draft_job.job_rate
                job_to_publish.promotion_banner = draft_job.promotion_banner
                job_to_publish.title = draft_job.title
                job_to_publish.detail = draft_job.detail
                job_to_publish.time_of_release = draft_job.time_of_release
                job_to_publish.short_description = draft_job.short_description
                # if job_to_publish.support_image.all():
                #     for image in draft_job.support_image:
                #         SupportImage.objects.create(job=draft_job, image=image.image)
                support_image = SupportImage.objects.get(pk=draft_job.support_image.pk)
                support_image.pk = None
                support_image.save()
                job_to_publish.support_image = support_image
                job_to_publish.postal_code = draft_job.postal_code
                job_to_publish.keywords = draft_job.keywords
                job_to_publish.multiple_job_rates = draft_job.multiple_job_rates
                job_to_publish.save()
                return Response({'status': 'job published'})
            else:
                return Response({'status': 'action not supported'})
        else:
            return Response(serializer.errors,
                            status=status.HTTP_400_BAD_REQUEST)
開發者ID:frusciante,項目名稱:RestAPI,代碼行數:42,代碼來源:views.py


注:本文中的jobs.models.Job.title方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。