I am Started Django Please help me

32 views
Skip to first unread message

Moaaz Afzal

unread,
Dec 30, 2019, 10:49:58 AM12/30/19
to Django users
https://stackoverflow.com/questions/59510325/is-there-is-any-way-to-convert-this-fbv-to-cbv-in-polls-tutorial-of-djangotutori/59510529#59510529
actually I am trying this from Polls App in Django Doc. 
I am trying to do convert FBV to CBV Please help me.

Peter juliano

unread,
Dec 30, 2019, 10:59:24 AM12/30/19
to django...@googlegroups.com
Hi. 
 What is your specific problem ?.
In the stackoverflow Q, there is already a code view based on CBV.


--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/afdd2331-1877-42e8-9b20-d4fc5ada0a6d%40googlegroups.com.

Moaaz Afzal

unread,
Dec 30, 2019, 11:10:36 AM12/30/19
to Django users
Thankyou for replying actually I want to change FBV to CBV in Django Official Documentation Tutorial.

https://docs.djangoproject.com/en/3.0/intro/tutorial05/

this one vote Function into CBV

Peter juliano

unread,
Dec 30, 2019, 4:00:05 PM12/30/19
to django...@googlegroups.com
What view in specific ?.
If you refering to the "get_queryset" view if simple as.

from django.views.generic import View

Class get_queryset(View):
   def get(self, request):
        """
    Return the last five published questions (not including those set to be
    published in the future).
    """
    return Question.objects.filter(
        pub_date__lte=timezone.now()
    ).order_by('-pub_date')[:5]

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages