Wednesday, January 2, 2019

Re: Error

Hmm, I suspect your issue is with queryset there since it says Matching Query Doesn't exist. This error always tend to say you that your django orm query is not proper, it has certain fields or style that you can not perform in the way you have written. First of all, please check if your variables values on your queryset 
place = Chapter.objects.get(course__course_name=course_name, slug=slug)
you can't make the query with None values as you have defaulted on your method def chapter(request, course_name=None, slug=None): 
Thus, my guess would be because of these variable values you are getting that error. You should have some values there instead of None or else it will always have that error.

And another thing I was wondering, why are you not using django 2.0 :D ? 

On Wednesday, 2 January 2019 12:48:18 UTC+5:45, Suresh wrote:
def chapter(request, course_name=None, slug=None):
    place = Chapter.objects.get(course__course_name=course_name, slug=slug)

    add_link_form = AddLinkForm(request.POST or None)
    add_txt_form = AddTxtForm(request.POST or None)
    file_upload_form = FileUploadForm(request.POST or None, request.FILES or None)

    queryset_txt_block = TextBlock.objects.filter(text_block_fk__id=place.id)
    queryset_yt_link = YTLink.objects.filter(yt_link_fk__id=place.id)
    queryset_files = FileUpload.objects.filter(file_fk__id=place.id)

    context = {
        "title": place.chapter_name,
        "course_name": course_name,
        "slug": slug,
        "add_link_form": add_link_form,
        "add_txt_form": add_txt_form,
        "queryset_yt_link": queryset_yt_link,
        "queryset_txt_block": queryset_txt_block,
        "queryset_files": queryset_files,
        "path": "Profile",
        "redirect_path": "profile",
        "file_upload_form": file_upload_form,
    }

--
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+unsubscribe@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/78fa3c92-5caa-495b-b2c4-e2563ec8cfcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment