Esempio n. 1
0
 def as_list_div (self):  # For category page / product list - blurb, image, name
   return tags.div (
       tags.a (
           tags.div (self.image_tag, class_="primary-image") +
           tags.h3 (self.name),
         href="%s" % self.url) +
       tags.div (self.blurb, class_="product-blurb") +  # clearfix
       #tags.div ('Starting at ' +
       #    tags.a ('$%.f' % self.baseprice, class_="product-price", href="%s" % self.url),
       #  class_='product-price-line'),
       tags.a ('Starting at ' +
           tags.span ('$%.f' % self.baseprice, class_="product-price"),
         class_='product-price-line btn btn-success', href="%s" % self.url),
     class_='clearfix product-summary'
   )
Esempio n. 2
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)

        if form.is_valid():

            email = request.POST.get('email', '')
            users = User.objects.filter(email=email)

            if users:
                user = users[
                    0]  # pick first one, although there shouldn't be more than 1
                result = 'Thank you for contacting us "%s"' % user.username
            else:
                user, password_entered = create_new_user(form, request)
                result = 'Thank you for contacting us and welcome to eRacks!  Your user is "%s", and your password has been sent to you.' % user.username

            subject = "%s user contact from %s about %s" % (
                settings.HOST_NAME, user, form.cleaned_data['topic'])
            message = contact_email_template.format(s=settings,
                                                    f=form.cleaned_data,
                                                    u=user)
            to = settings.CONTACT_EMAILS
            fm = user.email
            send_mail(subject, message, fm, to, fail_silently=False)

            return render(request, 'base.html',
                          {'content': mark_safe(tags.h3(result))})

        return render(request,
                      'contact.html', {'form': form},
                      context_instance=RequestContext(request))

    form = ContactForm()

    return render(
        request,
        'contact.html',
        dict(
            form=form,
            meta_title='Contact with eRacks - Contact Us',
            meta_keywords='Rack Mount Server, Open Source Systems',
            meta_description=
            'We are always interested in hearing from you, for all of your queries please stay in touch on [email protected] or you can call us on (408)455-0010',
        ),
        context_instance=RequestContext(request))
Esempio n. 3
0
def user_signup(request,template_name='userena/signup_form.html', success_url=None):
    if request.method == 'POST':
        form = SignupForm(request.POST)

        if form.is_valid():
            user,password_entered = create_new_user(form,request)

            if password_entered:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s"' % user.username
            else:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s", and your password has been sent to your email' % user.username

            return render (request, 'base.html', {'content': mark_safe(tags.h3(result))})
    else:
        form = SignupForm()

    return render (request, 'userena/signup_form.html', {'form': form })
Esempio n. 4
0
def user_signup(request,
                template_name='userena/signup_form.html',
                success_url=None):
    if request.method == 'POST':
        form = SignupForm(request.POST)

        if form.is_valid():
            user, password_entered = create_new_user(form, request)

            if password_entered:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s"' % user.username
            else:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s", and your password has been sent to your email' % user.username

            return render(request, 'base.html',
                          {'content': mark_safe(tags.h3(result))})
    else:
        form = SignupForm()

    return render(request, 'userena/signup_form.html', {'form': form})
Esempio n. 5
0
def user_signup(request,
                template_name='userena/signup_form.html',
                success_url=None):
    if request.method == 'POST':
        form = SignupForm(request.POST)

        if form.is_valid():
            user, password_entered = create_new_user(form, request)

            if password_entered:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s"' % user.username
            else:
                result = 'Thank you for signing up and welcome to eRacks - your username is "%s", and your password has been sent to your email' % user.username

            try:
                x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
                if x_forwarded_for:
                    ipaddress = x_forwarded_for.split(',')[-1].strip()
                else:
                    ipaddress = request.META.get('REMOTE_ADDR')

                if ipaddress:
                    activity_name = 'Sign-up'
                    customer_user = Customer.objects.get(user=user)
                    ip_add = IpAddress()
                    ip_add.customer = customer_user
                    ip_add.ip_address = ipaddress
                    ip_add.comments = "saved sign-up user %s IP-Address" % user.username
                    ip_add.activity = activity_name
                    ip_add.save()

            except:
                pass

            return render(request, 'base.html',
                          {'content': mark_safe(tags.h3(result))})
    else:
        form = SignupForm()

    return render(request, 'userena/signup_form.html', {'form': form})
Esempio n. 6
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)

        if form.is_valid():

            email = request.POST.get('email', '')
            users = User.objects.filter(email=email)

            if users:
                user = users [0]  # pick first one, although there shouldn't be more than 1
                result = 'Thank you for contacting us "%s"' % user.username
            else:
                user, password_entered = create_new_user(form,request)
                result = 'Thank you for contacting us and welcome to eRacks!  Your user is "%s", and your password has been sent to you.' % user.username

            subject = "%s user contact from %s about %s" % (settings.HOST_NAME, user, form.cleaned_data['topic'])
            message = contact_email_template.format (s = settings, f = form.cleaned_data, u = user)
            to = settings.CONTACT_EMAILS
            fm = user.email
            send_mail (subject, message, fm, to, fail_silently=False)

            return render (request, 'base.html', {'content': mark_safe (tags.h3(result))})

        return render (request, 'contact.html', {'form': form}, context_instance = RequestContext(request))

    form = ContactForm()

    return  render (request, 'contact.html',
        dict (
            form=form,
            meta_title='Contact with eRacks - Contact Us',
            meta_keywords='Rack Mount Server, Open Source Systems',
            meta_description='We are always interested in hearing from you, for all of your queries please stay in touch on [email protected] or you can call us on (408)455-0010',
        ),
        context_instance = RequestContext(request))
Esempio n. 7
0
 def msg (s):
     return render (request, 'base.html', { 'content': mark_safe (tags.h3 (s)) })
Esempio n. 8
0
def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)

        if form.is_valid():

            email = request.POST.get('email', '')
            users = User.objects.filter(email=email)

            if users:
                user = users[
                    0]  # pick first one, although there shouldn't be more than 1
                result = 'Thank you for contacting us "%s"' % user.username
            else:
                user, password_entered = create_new_user(form, request)
                result = 'Thank you for contacting us and welcome to eRacks!  Your user is "%s", and your password has been sent to you.' % user.username

            try:
                x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
                if x_forwarded_for:
                    ipaddress = x_forwarded_for.split(',')[-1].strip()
                else:
                    ipaddress = request.META.get('REMOTE_ADDR')

                if ipaddress:
                    activity_name = 'Contact-us'
                    customer_user = Customer.objects.get(user=user)
                    ip_add = IpAddress()
                    ip_add.customer = customer_user
                    ip_add.ip_address = ipaddress
                    ip_add.comments = "saved Contact-us user %s IP-Address" % user.username
                    ip_add.activity = activity_name
                    ip_add.save()

            except:
                pass

            subject = "%s user contact from %s about %s" % (
                settings.HOST_NAME, user, form.cleaned_data['topic'])
            message = contact_email_template.format(s=settings,
                                                    f=form.cleaned_data,
                                                    u=user)
            to = settings.CONTACT_EMAILS
            fm = user.email
            send_mail(subject, message, fm, to, fail_silently=False)

            return render(request, 'base.html',
                          {'content': mark_safe(tags.h3(result))})

        return render(request,
                      'contact.html', {'form': form},
                      context_instance=RequestContext(request))

    form = ContactForm()

    return render(
        request,
        'contact.html',
        dict(
            form=form,
            meta_title='Contact with eRacks - Contact Us',
            meta_keywords='Rack Mount Server, Open Source Systems',
            meta_description=
            'We are always interested in hearing from you, for all of your queries please stay in touch on [email protected] or you can call us on (408)455-0010',
        ),
        context_instance=RequestContext(request))