Пример #1
0
	def get(self,request,*args,**kwargs):
		self.list = PhotoList.objects.get(pk=self.kwargs["pk"])
		if request.user.is_anonymous:
			self.is_user_can_see_photo_list = self.list.is_anon_user_can_see_el()
			if self.list.community:
				self.community = self.list.community
				from common.templates import get_template_anon_community_list
				self.template_name = get_template_anon_community_list(self.list, "communities/photos/list/anon_photo_list.html", request.user, request.META['HTTP_USER_AGENT'])
				self.is_user_can_see_photo_section = self.community.is_anon_user_can_see_photo()
			else:
				from common.templates import get_template_anon_user_list
				self.template_name = get_template_anon_user_list(self.list, "users/photos/list/anon_photo_list.html", request.user, request.META['HTTP_USER_AGENT'])
				self.is_user_can_see_photo_section = self.list.creator.is_anon_user_can_see_photo()
		else:
			self.is_user_can_see_photo_list = self.list.is_user_can_see_el(request.user.pk)
			self.is_user_can_create_photos = self.list.is_user_can_create_el(request.user.pk)
			if self.list.community:
				self.community = self.list.community
				from common.templates import get_template_community_list
				self.template_name = get_template_community_list(self.list, "communities/photos/list/", "photo_list.html", request.user, request.META['HTTP_USER_AGENT'])
				self.is_user_can_see_photo_section = self.community.is_user_can_see_photo(request.user.pk)
			else:
				from common.templates import get_template_user_list
				self.template_name = get_template_user_list(self.list, "users/photos/list/", "photo_list.html", request.user, request.META['HTTP_USER_AGENT'])
				self.is_user_can_see_photo_section = self.list.creator.is_user_can_see_photo(request.user.pk)
		return super(LoadPhotosList,self).get(request,*args,**kwargs)
Пример #2
0
    def get(self, request, *args, **kwargs):
        self.list = VideoList.objects.get(pk=self.kwargs["pk"])
        if self.list.community:
            self.c = self.list.community
            if request.user.is_authenticated:
                if request.user.is_staff_of_community(self.c.pk):
                    self.get_lists = VideoList.get_community_staff_lists(
                        self.c.pk)
                    self.is_user_can_see_video_section = True
                    self.is_user_can_create_videos = True
                    self.is_user_can_see_video_list = True
                    self.template_name = get_template_community_list(
                        self.list, "video/community/", "list.html",
                        request.user, request.META['HTTP_USER_AGENT'])
                else:
                    self.get_lists = VideoList.get_community_lists(self.c.pk)
                    self.is_user_can_see_video_section = self.c.is_user_can_see_video(
                        request.user.pk)
                    self.is_user_can_see_video_list = self.list.is_user_can_see_el(
                        request.user.pk)
                    self.is_user_can_create_videos = self.list.is_user_can_create_el(
                        request.user.pk)
            elif request.user.is_anonymous:
                self.template_name = get_template_anon_community_list(
                    self.list, "video/community/anon_list.html", request.user,
                    request.META['HTTP_USER_AGENT'])
                self.is_user_can_see_video_section = self.c.is_anon_user_can_see_video(
                )
                self.is_user_can_see_video_list = self.list.is_anon_user_can_see_el(
                )
                self.get_lists = VideoList.get_community_lists(self.c.pk)
        else:
            creator = self.list.creator
            if request.user.is_authenticated:
                if request.user.pk == creator.pk:

                    self.is_user_can_see_video_section = True
                    self.is_user_can_see_video_list = True
                    self.is_user_can_create_videos = True
                else:
                    self.is_user_can_see_video_section = creator.is_user_can_see_video(
                        request.user.pk)
                    self.is_user_can_see_video_list = self.list.is_user_can_see_el(
                        request.user.pk)
                    self.is_user_can_create_videos = self.list.is_user_can_create_el(
                        request.user.pk)
                self.template_name = get_template_user_list(
                    self.list, "video/user/", "list.html", request.user,
                    request.META['HTTP_USER_AGENT'])
            if request.user.is_anonymous:
                self.template_name = get_template_anon_user_list(
                    self.list, "video/user/anon_list.html", request.user,
                    request.META['HTTP_USER_AGENT'])
                self.is_user_can_see_video_section = creator.is_anon_user_can_see_good(
                )
                self.is_user_can_see_video_list = self.list.is_anon_user_can_see_el(
                )
        return super(LoadVideoList, self).get(request, *args, **kwargs)
Пример #3
0
	def get(self,request,*args,**kwargs):
		from video.models import VideoList

		self.community,self.list = Community.objects.get(pk=self.kwargs["pk"]), VideoList.objects.get(uuid=self.kwargs["uuid"])
		if request.user.is_authenticated and request.user.is_staff_of_community(self.c.pk):
			self.is_user_can_see_video_section = True
			self.is_user_can_create_videos = True
			self.is_user_can_see_video_list = True
			self.template_name = get_template_community_list(self.list, "communities/video/list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		elif request.user.is_anonymous:
			self.template_name = get_template_anon_community_list(self.list, "communities/video/list/anon_list.html", request.user, request.META['HTTP_USER_AGENT'])
			self.is_user_can_see_video_section = self.c.is_anon_user_can_see_video()
			self.is_user_can_see_video_list = self.list.is_anon_user_can_see_el()
		else:
			self.is_user_can_see_video_section = self.c.is_user_can_see_video(request.user.pk)
			self.is_user_can_see_video_list = self.list.is_user_can_see_el(request.user.pk)
			self.is_user_can_create_videos = self.list.is_user_can_create_el(request.user.pk)
			self.template_name = get_template_community_list(self.list, "communities/video/list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		return super(CommunityVideoList,self).get(request,*args,**kwargs)
Пример #4
0
 def get(self, request, *args, **kwargs):
     if request.GET.get("user"):
         from users.models import User
         self.item = User.objects.get(pk=request.GET.get("user"))
         self.post_lists = PostsList.get_user_lists(self.item.pk)
         self.get_fixed_posts = self.item.get_fixed_posts()
         self.list = PostsList.objects.get(
             pk=self.item.get_selected_post_list_pk())
     elif request.GET.get("community"):
         from communities.models import Community
         self.item = Community.objects.get(pk=request.GET.get("community"))
         self.post_lists = PostsList.get_community_lists(self.item.pk)
         self.get_fixed_posts = self.item.get_fixed_posts()
         self.community = self.item
         self.list = PostsList.objects.get(
             pk=self.item.get_selected_post_list_pk())
     elif request.GET.get("list"):
         self.list = PostsList.objects.get(pk=request.GET.get("list"))
     if request.user.is_anonymous:
         self.is_user_can_see_post_list = self.list.is_anon_user_can_see_el(
         )
         if self.list.community:
             self.community = self.list.community
             self.template_name = get_template_anon_community_list(
                 self.list, "communities/lenta/anon_list.html",
                 request.user, request.META['HTTP_USER_AGENT'])
             self.is_user_can_see_post_section = self.community.is_anon_user_can_see_post(
             )
         else:
             self.template_name = get_template_anon_user_list(
                 self.list, "users/lenta/anon_list.html", request.user,
                 request.META['HTTP_USER_AGENT'])
             self.is_user_can_see_post_section = self.list.creator.is_anon_user_can_see_post(
             )
     else:
         self.is_user_can_see_post_list = self.list.is_user_can_see_el(
             request.user.pk)
         self.is_user_can_create_posts = self.list.is_user_can_create_el(
             request.user.pk)
         if self.list.community:
             self.community = self.list.community
             self.template_name = get_template_community_list(
                 self.list, "communities/lenta/", "list.html", request.user,
                 request.META['HTTP_USER_AGENT'])
             self.is_user_can_see_post_section = self.community.is_user_can_see_post(
                 request.user.pk)
         else:
             self.template_name = get_template_user_list(
                 self.list, "users/lenta/", "list.html", request.user,
                 request.META['HTTP_USER_AGENT'])
             self.is_user_can_see_post_section = self.list.creator.is_user_can_see_post(
                 request.user.pk)
     return super(LoadPostsList, self).get(request, *args, **kwargs)
Пример #5
0
	def get(self,request,*args,**kwargs):
		from docs.models import DocsList

		self.c, user = Community.objects.get(pk=self.kwargs["pk"]), request.user
		self.list = DocsList.objects.get(pk=self.c.get_selected_doc_list_pk())
		if user.is_authenticated and user.is_staff_of_community(self.c.pk):
			self.get_lists = DocsList.get_community_staff_lists(self.c.pk)
			self.is_user_can_see_doc_section = True
			self.is_user_can_create_docs = True
			self.is_user_can_see_doc_list = True
			self.template_name = get_template_community_list(self.list, "communities/docs/main_list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		elif request.user.is_anonymous:
			self.template_name = get_template_anon_community_list(self.list, "communities/docs/main_list/anon_list.html", request.user, request.META['HTTP_USER_AGENT'])
			self.is_user_can_see_doc_section = self.user.is_anon_user_can_see_doc()
			self.is_user_can_see_doc_list = self.list.is_anon_user_can_see_el()
			self.get_lists = DocsList.get_community_lists(self.c.pk)
		else:
			self.get_lists = DocsList.get_community_lists(self.c.pk)
			self.is_user_can_see_doc_section = self.c.is_user_can_see_doc(user.pk)
			self.is_user_can_see_doc_list = self.list.is_user_can_see_el(user.pk)
			self.is_user_can_create_docs = self.list.is_user_can_create_el(user.pk)
			self.template_name = get_template_community_list(self.list, "communities/docs/main_list/", "list.html", request.user, request.META['HTTP_USER_AGENT'])
		self.count_lists = DocsList.get_community_lists_count(self.c.pk)
		return super(CommunityDocs,self).get(request,*args,**kwargs)
Пример #6
0
    def get(self, request, *args, **kwargs):
        from gallery.models import PhotoList

        self.c, self.list = Community.objects.get(
            pk=self.kwargs["pk"]), PhotoList.objects.get(
                uuid=self.kwargs["uuid"])
        if request.user.is_administrator_of_community(self.c.pk):
            self.is_user_can_see_photo_section = True
        else:
            self.is_user_can_see_photo_section = self.c.is_user_can_see_photo()
        if request.user.is_anonymous:
            self.template_name = get_template_anon_community_list(
                self.list, "communities/photos/list/anon_list.html",
                request.user, request.META['HTTP_USER_AGENT'])
            self.is_user_can_see_photo_section = self.user.is_anon_user_can_see_photo(
            )
        else:
            self.template_name = get_template_community_list(
                self.list, "communities/photos/list/", "list.html",
                request.user, request.META['HTTP_USER_AGENT'])

        return super(CommunityPhotoList, self).get(request, *args, **kwargs)