コード例 #1
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
    def ourworks(self, request, category_id=None, *args, **kwargs):
        user = request.user
        context = getContext(request=request)
        if user.has_perm(APP_NAME + '.add_blog'):
            context['add_blog_form'] = AddBlogForm()
            icons = list(IconsEnum)
            context['icons_s'] = json.dumps(icons)
        context['our_works_header_image'] = MainPicRepo(user=request.user).get(
            name=MainPicEnum.OUR_WORK_HEADER)
        context['our_works'] = OurWorkRepo(user=request.user).list()
        if category_id is None:
            context['pages_title'] = 'Our Projects'
            main_pic_repo = MainPicRepo()
            slider = main_pic_repo.get(name=MainPicEnum.OUR_WORK_HEADER)
            context['pages_header_image'] = slider
            context['our_works'] = OurWorkRepo(user=request.user).list()
        if category_id is not None:
            category = OurWorkRepo().get_category(category_id=category_id)
            context['pages_title'] = category.title
            slider = category
            context['pages_header_image'] = slider
            context['our_works'] = OurWorkRepo(
                user=request.user).list().filter(category_id=category_id)

        return render(request, TEMPLATE_ROOT + 'our_works.html', context)
コード例 #2
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
    def tag(self, request, tag_id, *args, **kwargs):
        user = request.user
        main_pic_repo = MainPicRepo(user=user)

        context = getContext(request=request)
        context['blog_header_image'] = main_pic_repo.get(
            name=MainPicEnum.BLOG_HEADER)

        context['pages_pre_title'] = f'برچسب '
        tag = TagRepo(user=user).get(tag_id=tag_id)
        context['pages_title'] = tag.title
        if tag.image_header:
            context['pages_header_image'] = tag
        else:
            context['pages_header_image'] = main_pic_repo.get(
                name=MainPicEnum.TAG_HEADER)

        context['pages'] = PageRepo(user=request.user).list_by_tag(
            tag_id=tag_id)
        return render(request, TEMPLATE_ROOT + 'pages.html', context)
コード例 #3
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
    def about(self, request, *args, **kwargs):
        user = request.user
        main_pic_repo = MainPicRepo(user=request.user)
        parameter_repo = ParameterRepo(user=request.user)
        context = getContext(request=request)
        context['our_teams'] = OurTeamRepo(user=request.user).list()
        context['our_services'] = OurServiceRepo(user=user).list()
        context['testimonials'] = TestimonialRepo(user=request.user).list()
        context['banners'] = BannerRepo(user=request.user).list()
        context['technologies'] = TechnologyRepo(user=request.user).list()
        context['about_us_short'] = parameter_repo.get(
            ParametersEnum.ABOUT_US_SHORT)

        about_header_image = main_pic_repo.get(MainPicEnum.ABOUT_HEADER)
        context['about_header_image'] = about_header_image
        about_pic = main_pic_repo.get(MainPicEnum.ABOUT)
        context['about_pic'] = about_pic
        context['about_us_title'] = parameter_repo.get(
            ParametersEnum.ABOUT_US_TITLE)
        context['about_us'] = ParameterRepo(user=request.user).get(
            ParametersEnum.ABOUT_US)
        return render(request, TEMPLATE_ROOT + 'about.html', context)
コード例 #4
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
    def blogs(self, request, page=1, *args, **kwargs):
        user = request.user
        main_pic_repo = MainPicRepo(user=user)

        context = getContext(request=request)
        context['blog_header_image'] = main_pic_repo.get(
            name=MainPicEnum.BLOG_HEADER)
        if user.has_perm(APP_NAME + '.add_blog'):
            context['add_blog_form'] = AddBlogForm()
            icons = list(IconsEnum)
            context['icons_s'] = json.dumps(icons)
        context['blogs'] = BlogRepo(user=request.user).list()
        return render(request, TEMPLATE_ROOT + 'blogs.html', context)
コード例 #5
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
 def get(self, request, *args, **kwargs):
     user = request.user
     context = getContext(request=request)
     parameter_repo = ParameterRepo()
     main_pic_repo = MainPicRepo(user=request.user)
     context['contact_header_image'] = main_pic_repo.get(
         name=MainPicEnum.CONTACT_HEADER)
     context['email'] = parameter_repo.get(ParametersEnum.EMAIL)
     context['address'] = parameter_repo.get(ParametersEnum.ADDRESS)
     context['tel'] = parameter_repo.get(ParametersEnum.TEL)
     context['mobile'] = parameter_repo.get(ParametersEnum.MOBILE)
     context['fax'] = parameter_repo.get(ParametersEnum.FAX)
     context['location'] = parameter_repo.get(ParametersEnum.LOCATION)
     context['contact_us'] = parameter_repo.get(ParametersEnum.CONTACT_US)
     context['contact_form'] = ContactMessageForm()
     return render(request, TEMPLATE_ROOT + 'contact.html', context)
コード例 #6
0
ファイル: views.py プロジェクト: leonolan2020/phoenix
def getContext(request):
    user = request.user
    context = {}
    context['TEMPLATE_ROOT'] = TEMPLATE_ROOT
    context['CURRENCY'] = CURRENCY

    context['links'] = LinkRepo(user=user).list_for_home()
    context['social_links'] = SocialLinkRepo().list_for_home()
    if user.is_authenticated:
        profile = ProfileRepo(user=user).me
        context['profile'] = profile
        context['notifications_s'] = json.dumps(
            NotificationSerializer(
                NotificationRepo(user=request.user).list_unseen(),
                many=True).data)
        context['notifications_count'] = NotificationRepo(user=user).count
        profiles = ProfileRepo(user=user).list_by_user(user=user)
        if profile is not None:
            context['profiles'] = profiles.exclude(pk=profile.pk)
        if PUSHER_IS_ENABLE:
            my_channel_events = PusherChannelEventRepo(
                user=user).my_channel_events()
            my_channel_events_s = PusherChannelEventSerializer(
                my_channel_events, many=True).data
            context['my_channel_events_s'] = json.dumps(my_channel_events_s)
    else:
        context['profile'] = None
        context['profiles'] = None
        context['my_channel_events_s'] = '[]'
        context['notifications_s'] = '[]'
    main_pic_repo = MainPicRepo()
    link_repo = LinkRepo()
    parameter_repo = ParameterRepo(user=user)
    context['theme_color'] = parameter_repo.get(
        ParametersEnum.THEME_COLOR).value
    context['PUSHER_IS_ENABLE'] = PUSHER_IS_ENABLE
    context['app'] = {
        'nav_items':
        link_repo.get_nav_items(),
        'about_us_short':
        parameter_repo.get(ParametersEnum.ABOUT_US_SHORT),
        'GOOGLE_SEARCH_CONSOLE_TAG':
        parameter_repo.get(ParametersEnum.GOOGLE_SEARCH_CONSOLE_TAG),
        'NAV_TEXT_COLOR':
        parameter_repo.get(ParametersEnum.NAV_TEXT_COLOR),
        'slogan':
        parameter_repo.get(ParametersEnum.SLOGAN),
        'logo':
        main_pic_repo.get(name=MainPicEnum.LOGO),
        'favicon':
        main_pic_repo.get(name=MainPicEnum.FAVICON),
        'loading':
        main_pic_repo.get(name=MainPicEnum.LOADING),
        'pretitle':
        parameter_repo.get(ParametersEnum.PRE_TILTE),
        'title':
        parameter_repo.get(ParametersEnum.TITLE),
        'address':
        parameter_repo.get(ParametersEnum.ADDRESS),
        'mobile':
        parameter_repo.get(ParametersEnum.MOBILE),
        'email':
        parameter_repo.get(ParametersEnum.EMAIL),
        'tel':
        parameter_repo.get(ParametersEnum.TEL),
        'url':
        parameter_repo.get(ParametersEnum.URL),
        'meta_data_items':
        MetaDataRepo().list_for_home(),
        'our_team_title':
        OurTeamRepo(user=user).get_title(),
        'our_team_link':
        OurTeamRepo(user=user).get_link(),
    }
    context['SITE_URL'] = settings.SITE_URL
    context['MEDIA_URL'] = settings.MEDIA_URL
    context['ADMIN_URL'] = settings.ADMIN_URL
    context['DEBUG'] = settings.DEBUG
    context['APP_NAME'] = APP_NAME

    # context['current_profile']=ProfileRepo.get_by_user()

    context['add_tag_form'] = AddTagForm()
    #leoData
    context['search_form'] = SearchForm()
    return context