8

Getting the error in the title when I try to go on my listing_public page, can't figure out why.

views.py

def listing_public(request, pk):

    listing = get_object_or_404(BuyerListing, pk)

    return render (
        request,
        'listing_public.html',
        context={'listing':listing}
    )

urls.py

url(r'^listing/(?P<pk>\d+)/$', views.listing_public, name='listing_public'),

Template Tags

{% url 'listing_public' pk=listing.pk %}

This is the only other question on Stack Overflow I found regarding this error, but the sole answer didn't solve my problem. Here is the traceback.

Valachio
  • 1,025
  • 2
  • 18
  • 40

1 Answers1

13

See if specifying the argument changes anything

listing = get_object_or_404(BuyerListing, pk=pk)
NS0
  • 6,016
  • 1
  • 15
  • 14