yes all things are working fine like post list are working fine

from django.shortcuts import render, get_object_or_404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.generic import ListView
from .models import Post

def post_list(request):
    object_list = Post.published.all()
    paginator = Paginator(object_list, 3) # 3 posts in each page
    page = request.GET.get('page')
    try:
        posts = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer deliver the first page
        posts = paginator.page(1)
    except EmptyPage:
        # If page is out of range deliver last page of results
        posts = paginator.page(paginator.num_pages)
    return render(request,
                  'blog/post/list.html',
                  {'page': page,
                   'posts': posts})

# Create your views here.
def post_detail(request, year, month, day, post):
    post = get_object_or_404(Post, slug=post,
                             status='published',
                             publish__year=year,
                             publish__month=month,
                             publish__day=day)

    return render(request,
                  'blog/post/details.html',
                  {'post': post})

class PostListView(ListView):
    queryset = Post.published.all()
    context_object_name = 'posts'
    paginate_by = 3
    template_name = 'blog/post/list.html'

def test_test(request):
    return render(request,'blog/post/test.html')


On Tue, Jan 15, 2019 at 12:24 AM Alex Kimeu <kimeuale...@gmail.com> wrote:

> Have you configured MySQL correctly?
>
> On Mon, Jan 14, 2019 at 9:07 PM tribhuvan kishor <
> tribhuvankishor...@gmail.com> wrote:
>
>> this view is retrieving data with SQlite but not fetching data in
>> MySQL saying no data found.
>>
>>
>> def post_detail(request, year, month, day, post):
>>     post = get_object_or_404(Post, slug=post,
>>                              status='published',
>>                              publish__year=year,
>>                              publish__month=month,
>>                              publish__day=day)
>>
>>     return render(request,
>>                   'blog/post/details.html',
>>                   {'post': post})
>>
>> --
>> regards
>> Tribhuvan Kishor Bhaskar
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
>
> *"It's when nothing happens that anything can happen."*
> *https://kodenaut.github.io/ <https://kodenaut.github.io/>**+
> <https://kodenaut.github.io/>254 723494571*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACYP3VGYe96j6vYWYC8-7GCzODUfu8b5xc1qo2Lh6KhHevKgYQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACYP3VGYe96j6vYWYC8-7GCzODUfu8b5xc1qo2Lh6KhHevKgYQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
regards
Tribhuvan Kishor Bhaskar

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACiphSUvx06-PwJpxxMWyaKce_CTRagh4JDmkm3Mm-4j5UR-4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to