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)
def get(self, request, *args, **kwargs): from video.models import VideoList self.user = User.objects.get(pk=self.kwargs["pk"]) self.list = VideoList.objects.get( pk=self.user.get_selected_video_list_pk()) if request.user.pk == self.user.pk: self.get_lists = VideoList.get_user_staff_lists(self.user.pk) self.is_user_can_see_video_section = True self.is_user_can_create_videos = True self.is_user_can_see_video_list = True elif request.user.is_authenticated: self.is_user_can_see_video_section = self.user.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.get_lists = VideoList.get_user_lists(self.user.pk) self.count_lists = VideoList.get_user_lists_count(self.user.pk) if request.user.is_anonymous: self.template_name = get_template_anon_user_list( self.list, "users/video/main_list/anon_list.html", request.user, request.META['HTTP_USER_AGENT']) self.is_user_can_see_video_section = self.user.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_user_lists(self.user.pk) else: self.template_name = get_template_user_list( self.list, "users/video/main_list/", "list.html", request.user, request.META['HTTP_USER_AGENT']) return super(UserVideo, self).get(request, *args, **kwargs)
def get(self,request,*args,**kwargs): from gallery.models import PhotoList self.user, self.list = User.objects.get(pk=self.kwargs["pk"]), PhotoList.objects.get(uuid=self.kwargs["uuid"]) if self.user.pk == request.user.pk: if request.user.pk == self.list.creator.pk: self.is_user_can_see_photo_section = True self.is_user_can_see_photo_list = True self.is_user_can_create_photos = True else: self.is_user_can_see_photo_section = True 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) else: self.is_user_can_see_photo_section = self.user.is_user_can_see_photo(request.user.pk) 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 request.user.is_anonymous: self.template_name = get_template_anon_user_list(self.list, "users/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() self.is_user_can_see_photo_list = self.list.is_anon_user_can_see_el() else: self.template_name = get_template_user_list(self.list, "users/photos/list/", "list.html", request.user, request.META['HTTP_USER_AGENT']) return super(UserPhotoList,self).get(request,*args,**kwargs)
def get(self,request,*args,**kwargs): from music.models import MusicList self.user = User.objects.get(pk=self.kwargs["pk"]) self.list = MusicList.objects.get(uuid=self.kwargs["uuid"]) if self.user.pk == request.user.pk: if request.user.pk == self.list.creator.pk: self.is_user_can_see_music_section = True self.is_user_can_see_music_list = True self.is_user_can_create_tracks = True else: self.is_user_can_see_music_section = True self.is_user_can_see_music_list = self.list.is_user_can_see_el(request.user.pk) self.is_user_can_create_tracks = self.list.is_user_can_create_el(request.user.pk) else: self.is_user_can_see_music_section = self.user.is_user_can_see_music(request.user.pk) self.is_user_can_see_music_list = self.list.is_user_can_see_el(request.user.pk) self.is_user_can_create_tracks = self.list.is_user_can_create_el(request.user.pk) if request.user.is_anonymous: self.template_name = get_template_anon_user_list(self.list, "users/music/list/anon_list.html", request.user, request.META['HTTP_USER_AGENT']) self.is_user_can_see_music_section = self.user.is_anon_user_can_see_music() self.is_user_can_see_music_list = self.list.is_anon_user_can_see_el() else: self.template_name = get_template_user_list(self.list, "users/music/list/", "list.html", request.user, request.META['HTTP_USER_AGENT']) return super(UserMusicList,self).get(request,*args,**kwargs)
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)
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)