python - Django generic view is not accepting arguments -
i new django , trying pass arguments django generic base view , not showing in terminal printing arguments passed.
views.py
from django.views.generic import view class cartview(view): def get(self, request, *args, **kwargs): item = request.get.get('item') qty = request.get.get('qty') print item, qty return httpresponseredirect('/')
urls.py:
urlpatterns = [ url(r'^home/$', 'newsletter.views.home', name='home'), url(r'^contact/$', 'newsletter.views.contact', name='contact'), url(r'^about/$', 'dressika.views.about', name='about'), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.default.urls')), url(r'^', include('products.urls')), url(r'^categories/', include('products.urls_categories')), url(r'^cart/', cartview.as_view(), name='cart'),
when add data in browser "localhost:8000/cart/?item=2&qty=5"
not showing arguments in terminal according above code. typing "localhost:8000/cart/"
redirects me homepage. arguments shows 404.
it sounds may have fix entry in urls.py routing view. post urls.py well?
Comments
Post a Comment