Exemple #1
0
def csrf_failure(request, reason=""):
    context = getContext(request=request)
    context['message'] = ParameterRepo(user=request.user).get(
        ParametersEnum.CSRF_FAILURE_MESSAGE).value
    context['login_form'] = LoginForm()
    context['register_form'] = RegisterForm()
    return render(request, TEMPLATE_ROOT + 'login.html', context)
Exemple #2
0
 def share_mail(self):
     obj = {
         'title': self.name + ' در فروشگاه ' + ParameterRepo().title(),
         'url': self.get_absolute_url(),
         'text': self.name,
         'text_to_view': 'share'
     }
     return obj
Exemple #3
0
 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)
Exemple #4
0
    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)
Exemple #5
0
    def home(self, request):
        user = request.user
        parameter_repo = ParameterRepo(user=user)
        context = getContext(request=request)
        context['home_sliders'] = HomeSliderRepo(user=user).list()
        context['our_services'] = OurServiceRepo(user=user).list_for_home()
        context['about_us_title'] = parameter_repo.get(
            ParametersEnum.ABOUT_US_TITLE)
        context['about_us_short'] = parameter_repo.get(
            ParametersEnum.ABOUT_US_SHORT)

        context['our_work_categories'] = OurWorkRepo(
            user=request.user).get_categories()
        context['blogs'] = BlogRepo(user=request.user).list_for_home()
        context['our_works'] = OurWorkRepo(user=request.user).list_for_home()
        context['testimonials'] = TestimonialRepo(
            user=request.user).list_for_home()
        context['banners'] = BannerRepo(user=request.user).list_for_home()
        about_pic = MainPicRepo(user=request.user).get(MainPicEnum.ABOUT)
        if about_pic is not None:
            context['about_pic'] = about_pic
        return render(request, TEMPLATE_ROOT + 'index.html', context)
Exemple #6
0
 def terms(self, request):
     context = getContext(request=request)
     context['terms'] = ParameterRepo(user=request.user).get(
         ParametersEnum.TERMS)
     return render(request, TEMPLATE_ROOT_DASHBOARD + 'terms.html', context)
Exemple #7
0
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