eevelweezel / rogers_park_free_store Goto Github PK
View Code? Open in Web Editor NEWWebsite for the Rogers Park Free Store
Website for the Rogers Park Free Store
Right now, we have this URL to display products by category:
path('search/<slug:category_slug>/', views.category_list, name='category_list'),
Instead of making categories a separate page, let's add a dynamic list of categories to the home page template (below the "about us" section, and any photos/logos we decide to add), that will link to /products/?category=cat-food
The root URL is currently pointed at a route named "all_products." This view is querying products, but it's just serving the home page template. Let's leave the homepage at root, and add a separate /products/ url that shows a list of available products.
We'll want this to have the ability to filter by category (and eventually a search feature)... so, we'll need make /products/ take a "categories" param (i.e., '/products/?category=cat-food'). For UI, we'll want this page to show titles & pictures, and link to the product detail for each.
I'd like products to use a class-based view, so we can use methods and define behavior by verb (GET, POST, PUT, etc.). For example:
...
from django.template.response import TemplateResponse
from django.views.generic.base import View
class ProjectView(View):
def get(self, request, *args, **kwargs):
# there's a couple way to parse args... this isn't necessarily the best.
cat = request.GET.get('category')
data = Products.objects.filter(status='active', category=cat)
context = {'products': data}
return TemplateResponse(
request,
'template.html',
context=context,
status=200)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.