On Sep 11, 2017 7:20 AM, "harsh sharma" <harshsharma199...@gmail.com> wrote:
why i m getting this error :-type object 'Story' has no attribute 'object' this is my views.py file: from django.shortcuts import render,render_to_response from django.http import HttpResponseRedirect from django.template import RequestContext from .models import * from django.http import HttpResponse,HttpRequest # Create your views here. def home(request): story = Story.object.all() return render_to_response('show.html',{'story':story}) The first line of your home() view should be this: story = Story.objects.all() The default model manager creates an 'objects' attribute that is plural. -James -- 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/CA%2Be%2BciXL4G7k6x71_hwZ5%3DfVMauu%3Dv3NNuSoxxgOatB-hvOyMw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.