Auction/commerce/urls.py

42 lines
1.7 KiB
Python
Raw Permalink Normal View History

2021-01-14 05:54:01 -08:00
"""commerce URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
2021-01-15 01:05:47 -08:00
from django.conf import settings
from django.conf.urls.static import static
2021-01-14 05:54:01 -08:00
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("auctions.urls"))
2021-01-15 01:05:47 -08:00
]
if settings.DEBUG: # new
2021-01-15 08:56:14 -08:00
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#
# # alternate photo to display
# if photo_url == "":
# photo_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/No_image_available_600_x_450.svg/1280px-No_image_available_600_x_450.svg.png"
# category_value = request.POST["category"]
# listing_obj = AuctionListing(title = title, desc = desc, user = request.user,price = starting_bid, picture = photo_url,category=category_value)
# listing_obj.save()
# bid_obj = Bids(bid_value = starting_bid, listing = listing_obj, user = request.user)
# bid_obj.save()
# return render(request,"auctions/index.html",{
# "Listings" : AuctionListing.objects.all()
# })