def unfeature_video(self, video_id, user): if not user.has_perm('videos.edit_video'): raise RpcExceptionEvent(_(u'You have not permission')) try: c = Video.objects.filter(pk=video_id).update(featured=None) except (ValueError, TypeError): raise RpcExceptionEvent(_(u'Incorrect video ID')) if not c: raise RpcExceptionEvent(_(u'Video does not exist')) return {}
def feature_video(self, video_id, user): if not user.has_perm('videos.edit_video'): raise RpcExceptionEvent(_(u'You have not permission')) try: c = Video.objects.filter(pk=video_id).update(featured=datetime.datetime.today()) except (ValueError, TypeError, Video.DoesNotExist): raise RpcExceptionEvent(_(u'Incorrect video ID')) if not c: raise RpcExceptionEvent(_(u'Video does not exist')) update_search_index.delay(Video, video_id) return {}