I am getting this error: TypeError at /order_details/17/ 'str' object is not callable
urls.py (r'^order_details/(?P<order_id>[-\w]+)/$', 'order_details', {'template_name': 'registration/order_details.html'}, 'order_details'), template <a href="{{ order.get_absolute_url }}">Order #{{ order.id }} - {{ order.date|date }} (view)</a><br /> views.py def order_details(request, order_id, template_name="registration/order_details.html"): """ displays the details of a past customer order; order details can only be loaded by the same user to whom the order instance belongs. """ order = get_object_or_404(Order, id=order_id, user=request.user) page_title = 'Order Details for Order #' + order_id order_items = OrderItem.objects.filter(order=order) return render_to_response(template_name, locals(), context_instance=RequestContext(request)) On Thursday, January 31, 2013 2:17:24 PM UTC-5, yati sagade wrote: > > Hi > You usually define get_absolute_urls() on a model to let Django know how > to derive a URL for that object. The docs for get_absolute_url can be > found > here<https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#get-absolute-url>. > > I advise you to understand how URL routing works in Django thoroughly, > especially how not to hardcode stuff into your models. In the linked page, > you'll also see how you can use `reverse` to reference formatted URLs from > the urlconf in question. > > Regards > > > On Thu, Jan 31, 2013 at 11:26 PM, frocco <far...@gmail.com > <javascript:>>wrote: > >> I am following the "Beginning Django e-commerce" book and he uses the >> get_absolute_url method in his models. >> The book is dated (2009) and being new, I am not sure what applies. >> He also creates urls.py in each module directory, but when I run it, it >> never finds it. >> it defaults to the main urls.py that was created when I created the >> project. >> >> >> On Thursday, January 31, 2013 11:54:37 AM UTC-5, Mike Doroshenko II wrote: >> >>> You mean mappings urls to views(pages?). Because if get_absolue_url is >>> like request.get_full_path() then you would use that in the view itself >>> and use urls.py to map urls to pages/views. And templates are are called >>> from in views. >>> >>> frocco wrote: >>> >>> Hi All, >>> >>> I am trouble understanding how to use urls. >>> I see tutorials that have get_absolue_url, url mysite, ect. >>> >>> I need to do: >>> >>> 1. load a page with no parameters >>> 2. load a page with 1 parameter >>> 3. load a page with more than 1 parameter >>> >>> What should my templates look like? >>> >>> Thank you >>> >>> >>> >>> -- >>> 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 post to this group, send email to django...@googlegroups.com. >>> >>> Visit this group at >>> http://groups.google.com/**group/django-users?hl=en<http://groups.google.com/group/django-users?hl=en> >>> . >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> -- >>> Mike Doroshenko, Junior Sys Admin >>> TecKnoQuest Inc. >>> mi...@tecknoquest.comwww.tecknoquest.com >>> >>> -- >> 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 <javascript:>. >> To post to this group, send email to django...@googlegroups.com<javascript:> >> . >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Yati Sagade > > Software Engineer at mquotient <http://www.mquotient.net/> > <http://twitter.com/yati_itay> > > Twitter: @yati_itay <http://twitter.com/yati_itay> | Github: > yati-sagade<https://github.com/yati-sagade> > > Organizing member of TEDx EasternMetropolitanBypass > http://www.ted.com/tedx/events/4933 > > https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869 > > -- 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 http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.