def post(self, request): model_info = (self.opts.app_label, self.opts.module_name) url_name = 'admin:%s_%s_changelist' % model_info bookmark = Bookmark(content_type=ContentType.objects.get_for_model(self.model), \ title=request.POST['title'], user=self.user, query=request.POST.get('query', ''), \ is_share=request.POST.get('is_share', 0), url_name=url_name) bookmark.save() content = {'title': bookmark.title, 'url': bookmark.url} return self.render_response(content)
def post(self, request): model_info = (self.opts.app_label, self.opts.model_name) url_name = 'xadmin:%s_%s_changelist' % model_info bookmark = Bookmark( content_type=ContentType.objects.get_for_model(self.model), title=request.POST[ 'title'], user=self.user, query=request.POST.get('query', ''), is_share=request.POST.get('is_share', 0), url_name=url_name) bookmark.save() content = {'title': bookmark.title, 'url': bookmark.url} return self.render_response(content)
def post(self, request): model_info = (self.opts.app_label, self.opts.model_name) url_name = "xadmin:%s_%s_changelist" % model_info bookmark = Bookmark( content_type=ContentType.objects.get_for_model(self.model), title=request.POST["title"], user=self.user, query=request.POST.get("query", ""), is_share=request.POST.get("is_share", 0), url_name=url_name, ) bookmark.save() content = {"title": bookmark.title, "url": bookmark.url} return self.render_response(content)
def post(self, request): model_info = (self.opts.app_label, self.opts.module_name) url_name = "admin:%s_%s_changelist" % model_info bookmark = Bookmark( content_type=ContentType.objects.get_for_model(self.model), title=request.POST["title"], user=self.user, query=request.POST.get("query", ""), is_share=request.POST.get("is_share", 0), url_name=url_name, ) bookmark.save() content = {"title": bookmark.title, "url": bookmark.url} return self.render_response(content)
def handle(self, *args, **options): admin = Staff.objects.get(username='******') task_content_type = ContentType.objects.get_for_model(Task) url_name = 'xadmin:tasks_task_changelist' for typ, title in list(Task.TYPE_CHOICES): query = '_p_typ__exact=%d' % typ if typ in [ Task.TYPE_CORRECT, Task.TYPE_CORRECT_VERIFY, Task.TYPE_CORRECT_DIFFICULT, Task.TYPE_PUNCT, Task.TYPE_PUNCT_VERIFY ]: query += '&_cols=batchtask.tripitaka_name.sutra_name.reel_no.priority.task_no.realtime_progress.status.publisher.created_at.picker.picked_at.finished_at.task_link.modify' else: query += '&_cols=batchtask.lqsutra_name.base_reel_name.reel_no.priority.task_no.realtime_progress.status.publisher.created_at.picker.picked_at.finished_at.task_link.modify' bookmark = Bookmark(content_type=task_content_type, title=title, user=admin, query=query, is_share=True, url_name=url_name) bookmark.save()