Пример #1
0
    def get(self, request, *args, **kwargs):
        from common.utils import get_item_with_comments

        self.type = request.GET.get('type')
        self.item = get_item_with_comments(self.type)
        if not self.item.votes_on:
            raise Http404
        if request.user.is_authenticated:
            if not self.item.list.is_user_can_see_el(request.user.pk):
                raise Http404
            if self.item.community:
                self.template_name = get_template_community_item(
                    self.item, "generic/items/comment/", "dislikes.html",
                    request.user, request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_user_item(
                    self.item, "generic/items/comment/", "dislikes.html",
                    request.user, request.META['HTTP_USER_AGENT'])
        else:
            if not self.item.list.is_anon_user_can_see_el(request.user.pk):
                raise Http404
            if self.item.community:
                self.template_name = get_template_anon_community_item(
                    self.item, "generic/items/comment/anon_dislikes.html",
                    request.user, request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_user_item(
                    self.item, "generic/items/comment/anon_dislikes.html",
                    request.user, request.META['HTTP_USER_AGENT'])
        return super(ItemDislikes, self).get(request, *args, **kwargs)
Пример #2
0
    def get(self, request, *args, **kwargs):
        self.post = Post.objects.get(pk=self.kwargs["pk"])

        if self.post.community:
            self.community = self.post.community
            self.posts = self.community.get_fixed_posts()
            if request.user.is_authenticated:
                self.template_name = get_template_community_item(
                    self.post, "communities/lenta/", "fix_post_detail.html",
                    request.user, request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_community_item(
                    self.post, "communities/lenta/anon_fix_post_detail.html",
                    request.user, request.META['HTTP_USER_AGENT'])
        else:
            self.posts = self.post.creator.get_fixed_posts()
            if request.user.is_authenticated:
                self.template_name = get_template_user_item(
                    self.post, "users/lenta/", "fix_post_detail.html",
                    request.user, request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_user_item(
                    self.post, "users/lenta/anon_fix_post_detail.html",
                    request.user, request.META['HTTP_USER_AGENT'])
        return super(LoadFixPost, self).get(request, *args, **kwargs)
Пример #3
0
    def get(self, request, *args, **kwargs):
        self.post = Post.objects.get(pk=self.kwargs["pk"])
        self.list = self.post.list
        self.posts = self.list.get_items()

        if self.post.community:
            self.community = self.post.community
            if request.user.is_authenticated:
                self.template_name = get_template_community_item(
                    self.post, "communities/lenta/", "post.html", request.user,
                    request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_community_item(
                    self.post, "communities/lenta/anon_post.html",
                    request.user, request.META['HTTP_USER_AGENT'])
        else:
            if request.user.is_authenticated:
                self.template_name = get_template_user_item(
                    self.post, "users/lenta/", "post.html", request.user,
                    request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_user_item(
                    self.post, "users/lenta/anon_post.html", request.user,
                    request.META['HTTP_USER_AGENT'])
        return super(LoadPost, self).get(request, *args, **kwargs)
Пример #4
0
	def get(self,request,*args,**kwargs):
		from chat.models import Chat

		self.photo = Photo.objects.get(pk=self.kwargs["photo_pk"])
		self.chat = Chat.objects.get(pk=self.kwargs["pk"])

		self.photos_ids = self.chat.get_attach_photos_ids()
		if self.photo.community:
			self.community = self.photo.community
			if request.user.is_administrator_of_community(self.community.pk):
				from gallery.forms import PhotoDescriptionForm
				self.user_form = PhotoDescriptionForm(instance=self.photo)
			if request.user.is_authenticated:
				self.template_name = get_template_community_item(self.photo, "chat/attach/photo/c/", "photo.html", request.user, request.META['HTTP_USER_AGENT'])
			else:
				self.template_name = get_template_anon_community_item(self.photo, "chat/attach/photo/c/anon_photo.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			if request.user.pk == self.photo.creator.pk:
				from gallery.forms import PhotoDescriptionForm
				self.user_form = PhotoDescriptionForm(instance=self.photo)
			if request.user.is_authenticated:
				self.template_name = get_template_user_item(self.photo, "chat/attach/photo/u/", "photo.html", request.user, request.META['HTTP_USER_AGENT'])
			else:
				self.template_name = get_template_anon_user_item(self.photo, "chat/attach/photo/u/anon_photo.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(MessagePhotoDetail,self).get(request,*args,**kwargs)
Пример #5
0
    def get(self, request, *args, **kwargs):
        self.good = Good.objects.get(uuid=self.kwargs["uuid"])
        self.list = self.good.list

        self.goods = self.list.get_items()
        if self.good.community:
            self.community = self.good.community
            if request.user.is_authenticated:
                self.template_name = get_template_community_item(
                    self.good, "goods/user/", "good.html", request.user,
                    request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_community_item(
                    self.good, "goods/user/anon_good.html", request.user,
                    request.META['HTTP_USER_AGENT'])
        else:
            if request.user.is_authenticated:
                self.template_name = get_template_user_item(
                    self.good, "goods/user/", "good.html", request.user,
                    request.META['HTTP_USER_AGENT'])
            else:
                self.template_name = get_template_anon_user_item(
                    self.good, "goods/user/anon_good.html", request.user,
                    request.META['HTTP_USER_AGENT'])
        return super(LoadGood, self).get(request, *args, **kwargs)
Пример #6
0
	def get(self,request,*args,**kwargs):
		self.video = Video.objects.get(pk=self.kwargs["pk"])
		self.list = self.video.list
		self.community = self.list.community
		if request.user.is_authenticated:
			self.template_name = get_template_community_item(self.post, "video/c_video_list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			self.template_name = get_template_anon_community_item(self.post, "video/c_video_list/anon_list.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(CommunityVideoList,self).get(request,*args,**kwargs)
Пример #7
0
	def get(self,request,*args,**kwargs):
		from posts.models import PostComment
		from common.templates import get_template_community_item, get_template_anon_community_item

		self.comment, self.community = PostComment.objects.get(pk=self.kwargs["comment_pk"]), Community.objects.get(pk=self.kwargs["pk"])
		if request.user.is_authenticated:
			self.template_name = get_template_community_item(self.post, "video/c_video_list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			self.template_name = get_template_anon_community_item(self.post, "video/c_video_list/", "anon_list.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(CommunityPostCommentVideoList,self).get(request,*args,**kwargs)
Пример #8
0
    def get(self, request, *args, **kwargs):
        from common.templates import get_template_community_item, get_template_anon_community_item

        self.post = Post.objects.get(pk=self.kwargs["pk"])
        if request.user.is_authenticated:
            self.template_name = get_template_community_item(
                self.post, "posts/post_community/", "detail.html",
                request.user, request.META['HTTP_USER_AGENT'])
        else:
            self.template_name = get_template_anon_community_item(
                self.post, "posts/post_community/", "anon_detail.html",
                request.user, request.META['HTTP_USER_AGENT'])
        return super(PostCommunityDetail, self).get(request, *args, **kwargs)
Пример #9
0
	def get(self,request,*args,**kwargs):
		from stst.models import VideoNumbers

		self.community = Community.objects.get(pk=self.kwargs["pk"])
		self.video = Video.objects.get(pk=self.kwargs["video_pk"])
		if request.user.is_authenticated:
			self.template_name = get_template_community_item(self.post, "video/c_video_detail/", "video.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			self.template_name = get_template_anon_community_item(self.post, "video/c_video_detail/anon_video.html", request.user, request.META['HTTP_USER_AGENT'])
		if request.user.is_authenticated:
			try:
				VideoNumbers.objects.get(user=request.user.pk, video=self.video.pk)
			except:
				VideoNumbers.objects.create(user=request.user.pk, video=self.video.pk, device=request.user.get_device())
		return super(CommunityVideoDetail,self).get(request,*args,**kwargs)
Пример #10
0
    def get(self, request, *args, **kwargs):
        from common.templates import get_template_community_item, get_template_anon_community_item

        self.good, self.c = Good.objects.get(
            pk=self.kwargs["good_pk"]), Community.objects.get(
                pk=self.kwargs["pk"])
        if request.user.is_authenticated:
            self.template_name = get_template_community_item(
                self.post, "goods/c_good/", "detail.html", request.user,
                request.META['HTTP_USER_AGENT'])
        else:
            self.template_name = get_template_anon_community_item(
                self.post, "goods/c_good/anon_detail.html", request.user,
                request.META['HTTP_USER_AGENT'])
        return super(GoodCommunityDetail, self).get(request, *args, **kwargs)
Пример #11
0
	def get(self,request,*args,**kwargs):
		self.photo = Photo.objects.get(pk=self.kwargs["pk"])
		self.list = self.photo.list
		self.photos = self.list.get_items()
		if self.photo.community:
			self.community = self.photo.community
			if request.user.is_authenticated:
				self.template_name = get_template_community_item(self.photo, "gallery/c_photo/photo/", "photo.html", request.user, request.META['HTTP_USER_AGENT'])
			else:
				self.template_name = get_template_anon_community_item(self.photo, "gallery/c_photo/photo/anon_photo.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			if request.user.is_authenticated:
				self.template_name = get_template_user_item(self.photo, "gallery/u_photo/photo/", "photo.html", request.user, request.META['HTTP_USER_AGENT'])
			else:
				self.template_name = get_template_anon_user_item(self.photo, "gallery/u_photo/photo/anon_photo.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(PhotoDetail,self).get(request,*args,**kwargs)
Пример #12
0
	def get(self,request,*args,**kwargs):
		from stst.models import VideoNumbers
		from common.templates import get_template_community_item, get_template_anon_community_item

		self.video = Video.objects.get(pk=self.kwargs["video_pk"])
		self.community = community.objects.get(pk=self.kwargs["pk"])
		if request.user.is_authenticated:
			try:
				VideoNumbers.objects.get(user=request.user.pk, video=self.video.pk)
			except:
				if MOBILE_AGENT_RE.match(request.META['HTTP_USER_AGENT']):
					VideoNumbers.objects.create(user=request.user.pk, video=self.video.pk, platform=1)
				else:
					VideoNumbers.objects.create(user=request.user.pk, video=self.video.pk, platform=0)
		if request.user.is_authenticated:
			self.template_name = get_template_community_item(self.post, "video/c_video_info/", "video.html", request.user, request.META['HTTP_USER_AGENT'])
		else:
			self.template_name = get_template_anon_community_item(self.post, "video/c_video_info/anon_video.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(CommunityVideoInfo,self).get(request,*args,**kwargs)