Exemplo n.º 1
0
    def get(self, request, *args, **kwargs):
        """Redirect to user detail view if root page is a profile or if the user is logged in"""

        if settings.SOCIALHOME_HOME_VIEW:
            p, m = settings.SOCIALHOME_HOME_VIEW.rsplit('.', 1)
            return getattr(import_module(p), m).as_view()(request)

        if request.user.is_authenticated:
            landing_page = request.user.preferences.get(
                "generic__landing_page")
            if landing_page == "profile":
                return ProfileDetailView.as_view()(
                    request, guid=request.user.profile.guid)
            elif landing_page == "profile_all":
                return ProfileAllContentView.as_view()(
                    request, guid=request.user.profile.guid)
            elif landing_page == "followed":
                return FollowedStreamView.as_view()(request)
            elif landing_page == "public":
                return PublicStreamView.as_view()(request)
            else:
                # Fallback to profile view
                return ProfileDetailView.as_view()(
                    request, guid=request.user.profile.guid)
        if settings.SOCIALHOME_ROOT_PROFILE:
            profile = get_object_or_404(
                Profile, user__username=settings.SOCIALHOME_ROOT_PROFILE)
            return ProfileDetailView.as_view()(request, guid=profile.guid)
        return super(HomeView, self).get(request, *args, **kwargs)
Exemplo n.º 2
0
 def get(self, request, *args, **kwargs):
     """Redirect to user detail view if root page is a profile or if the user is logged in"""
     if request.user.is_authenticated:
         return ProfileDetailView.as_view()(request,
                                            guid=request.user.profile.guid)
     if settings.SOCIALHOME_ROOT_PROFILE:
         profile = get_object_or_404(
             Profile, user__username=settings.SOCIALHOME_ROOT_PROFILE)
         return ProfileDetailView.as_view()(request, guid=profile.guid)
     return super(HomeView, self).get(request, *args, **kwargs)
Exemplo n.º 3
0
    def get(self, request, *args, **kwargs):
        """Redirect to user detail view if root page is a profile or if the user is logged in"""

        if settings.SOCIALHOME_HOME_VIEW:
            p, m = settings.SOCIALHOME_HOME_VIEW.rsplit('.', 1)
            return getattr(import_module(p), m).as_view()(request)

        if request.user.is_authenticated:
            landing_page = request.user.preferences.get("generic__landing_page")
            if landing_page == "profile":
                return ProfileDetailView.as_view()(request, uuid=request.user.profile.uuid)
            elif landing_page == "profile_all":
                return ProfileAllContentView.as_view()(request, uuid=request.user.profile.uuid)
            elif landing_page == "followed":
                return FollowedStreamView.as_view()(request)
            elif landing_page == "public":
                return PublicStreamView.as_view()(request)
            else:
                # Fallback to profile view
                return ProfileDetailView.as_view()(request, uuid=request.user.profile.uuid)
        if settings.SOCIALHOME_ROOT_PROFILE:
            profile = get_object_or_404(Profile, user__username=settings.SOCIALHOME_ROOT_PROFILE)
            return ProfileDetailView.as_view()(request, uuid=profile.uuid)
        return super(HomeView, self).get(request, *args, **kwargs)