Пример #1
0
def index(request):
    featured = Post.objects.filter(featured=True)
    latest = Post.objects.order_by('-timestamp')[0:3]
    if request.method == 'POST':
        email = request.POST['email']
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()
    context = {'posts': featured, 'latest': latest}
    return render(request, 'index.html', context)
Пример #2
0
    def post(self, request, *args, **kwargs):
        email = request.POST.get('email')
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()

        messages.success(
            request,
            'You successfully registered for newsletter for our website')
        return redirect('blog-home')
def index(request):
    posts = Posts.objects.filter(featured=True)
    latest = Posts.objects.order_by('upload_date')[0:3]
    if request.method == "POST":
        email = request.POST.get("email")
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()
    contex = {"posts": posts, "latest": latest}
    return render(request, 'index.html', contex)
Пример #4
0
def index(request):
    featured = Post.objects.filter(featured=True)

    if request.method == 'POST':
        email = request.POST["email"]
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()
    context = {
        'object_list': featured,
    }
    return render(request, 'index.html', context)
Пример #5
0
def about(request):
    featured = Post.objects.filter(featured=True)
    latest = Post.objects.order_by('-timestamp')[0:3]

    if request.method == "POST":
        email = request.POST['email']
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()

    context = {'object_list': featured, 'latest': latest}
    return render(request, 'about.html', context)
Пример #6
0
def index(request):
    featured = Post.objects.filter(featured=True)
    latest = Post.objects.order_by('-timestamp')[0:3]
    form = EmailSignUpForm()
    if request.method == "POST":
        email = request.POST['email']
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()

    context = {'object_list': featured, 'latest': latest, 'form': form}
    return render(request, 'index.html', context)
Пример #7
0
def index(request):

    featured = Post.objects.filter(featured=True, status='published')[0:3]
    latest = Post.objects.filter(
        status='published').order_by('-timestamp')[0:3]

    if request.method == "POST":
        email = request.POST["email"]
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()

    context = {'object_list': featured, 'latest': latest}
    return render(request, 'index.html', context)
Пример #8
0
def index(request):
    # featured = Post.objects.filter(featured = True)
    latest = Post.objects.order_by('-timestamp')[0:3]

    if request.method == "POST":
        email = request.POST["email"]
        new_signup = SignUp()
        new_signup.email = email
        new_signup.save()

    context = {
        # 'object_list': featured,
        'latest': latest,
    }
    return render(request, "index.html", context)
Пример #9
0
def index(request):
	featured = BlogPost.objects.filter(featured = True)
	latest = BlogPost.objects.order_by('-timestamp')[0:3]

	if request.method == 'POST':
		Email = request.POST['email']
		sighup = SignUp()
		sighup.email = Email
		sighup.save()

	context = {
		'object_list' : featured,
		'latest':latest
	}
	return render(request, 'blogs/index.html', context)
Пример #10
0
 def post(self, request, *args, **kwargs):
     email = request.POST.get('email')
     new_signup = SignUp()
     new_signup.email = email
     new_signup.save()
     return redirect("index")