Exemple #1
0
def contact_error(request):
    template = 'frontend/widgets/error.html'
    context = {}
    lang = get_lang(request)
    es_url = ''
    en_url = ''

    if str(lang) == 'es':
        pg_title = 'Error de contacto'
        context['url'] = en_url
    else:
        pg_title = 'Contact Error!'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    return render(request,template,context)
Exemple #2
0
def contact_thanks(request):
    template = 'frontend/widgets/thanks.html'
    context = {}
    lang = get_lang(request)
    es_url = ''
    en_url = ''

    if str(lang) == 'es':
        pg_title = 'Gracias por comunicarse'
        context['url'] = en_url
    else:
        pg_title = 'Thanks for contacting us'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    return render(request,template,context)
Exemple #3
0
def technology(request):
    template = 'frontend/pages/technologies.html'
    context = {}
    lang = get_lang(request)
    es_url = 'tecnologias'
    en_url = 'technologies'

    if str(lang) == 'es':
        pg_title = 'Trabajos'
        context['url'] = en_url
    else:
        pg_title = 'Works'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    context['title'] = en_url
    return render(request,template,context)
Exemple #4
0
def contact(request):
    template = 'frontend/pages/contact.html'
    context = {}
    lang = get_lang(request)
    es_url = 'contacto'
    en_url = 'contact'

    if str(lang) == 'es':
        pg_title = 'Contacto'
        context['url'] = en_url
    else:
        pg_title = 'Contact us'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    context['title'] = en_url
    return render(request,template,context)
Exemple #5
0
def service_detail(request,slug=''):
    context = {}
    template = 'frontend/pages/details/service.html'
    lang = get_lang(request)
    es_url = 'servicio-detalle'
    en_url = 'service-detail'

    if str(lang) == 'es':
        pg_title = 'Inicio'
        context['url'] = en_url
    else:
        pg_title = 'Home'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    context['title'] = "services"

    return render(request,template,context)
Exemple #6
0
def services(request):
    context = {}
    template = 'frontend/pages/services.html'
    lang = get_lang(request)
    es_url = 'servicios'
    en_url = 'services'

    if str(lang) == 'es':
        pg_title = 'Servicios'
        context['url'] = en_url
    else:
        pg_title = 'Services'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    context['title'] = en_url

    return render(request,template,context)
Exemple #7
0
def home(request):
    context = {}
    template = 'frontend/pages/home.html'
    lang = get_lang(request)
    es_url = ''
    en_url = ''

    if str(lang) == 'es':
        pg_title = 'Inicio'
        context['url'] = en_url
    else:
        pg_title = 'Home'
        context['url'] = es_url

    context['lang'] = lang
    context['pg_title'] = pg_title
    context['title'] = en_url
    print(request.LANGUAGE_CODE)
    return render(request,template,context)
Exemple #8
0
def quick_contact(request):
    context = {}
    lang = get_lang(request)
    es_url = 'gracias'
    en_url = 'thanks'
    es_error_url = 'error'
    en_error_url = 'error'

    if request.method == "POST":
        if 'name' in request.POST:
            nameForm = request.POST['name']
            print(nameForm)
        if 'phone' in request.POST:
            phoneForm = request.POST['phone']
            print(phoneForm)
        if 'lastname' in request.POST:
            lastnameForm = request.POST['lastname']
            print(lastnameForm)
        if 'email' in request.POST:
            emailForm = request.POST['email']
            print(emailForm)
        if 'message' in request.POST:
            messageForm = request.POST['message']
            print(messageForm)
        if 'action' in request.POST:
            actionForm = request.POST['action']
            print(actionForm)
        if 'business' in request.POST:
            businessForm = request.POST['business']
            print(businessForm)
        if 'country' in request.POST:
            countryForm = request.POST['country']
            print(countryForm)
        
        from_email_user = '******'
        from_email_main = emailForm
        subject_main = "Mensaje enviado de %s %s" % (nameForm, lastnameForm)
        message_user = '******' % (nameForm)
        message_main = """ %s ha querido comunicarse y dejó el siguiente mensaje 
            \n %s \nLe interesa %s 
            \n Su correo es %s
            \n Su número de telefono es %s
            \n --- Este mensaje se ha enviado desde la página web https://www.dev2tech.xyz/   ---""" % (nameForm, messageForm, countryForm, emailForm, phoneForm)

        try:
            # Send to user
            # send_mail(subject_user, message_user, from_email_user, [emailForm])
            # Send to us
            send_mail(subject_main, message_main, from_email_main, ['*****@*****.**'])
            # send_mail(subject_main, message_main, from_email_main, ['*****@*****.**'])
            if str(lang) == 'es':
                url = es_url
            else:
                url = en_url

        except BadHeaderError:
            if str(lang) == 'es':
                url = es_error_url
            else:
                url = en_error_url
            return HttpResponseRedirect(url)
        return HttpResponseRedirect(url)

    return redirect(url)