Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Kaffeekasse 2000XT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informatik 4 (Systemsoftware)
PASST
Projekte
Kaffeekasse 2000XT
Commits
79b3e4f1
Commit
79b3e4f1
authored
5 years ago
by
Lukas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
Update views to pass data with the new data model to the buy template
parent
6844642f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
store/views.py
+4
-3
4 additions, 3 deletions
store/views.py
with
4 additions
and
3 deletions
store/views.py
+
4
−
3
View file @
79b3e4f1
from
django.shortcuts
import
render
,
reverse
from
.models
import
User
,
Product
,
UserIdentifierTypes
from
.models
import
User
,
Product
,
UserIdentifierTypes
,
ProductIdentifierTypes
from
django.views.decorators.http
import
require_http_methods
from
django.views.decorators.csrf
import
csrf_protect
from
django.contrib.auth.decorators
import
login_required
...
...
@@ -35,9 +35,10 @@ def buy(request):
return
render
(
request
,
"
buy.html
"
,
{
"
most_bought
"
:
ProductLogic
.
getMostBoughtProductsList
(),
"
recently_bought
"
:
ProductLogic
.
getLastBoughtProductsList
(
request
.
user
.
id
),
"
drinks
"
:
Product
.
objects
.
filter
(
category
=
"
drink
"
).
order_by
(
'
name
'
),
"
candies
"
:
Product
.
objects
.
filter
(
category
=
"
candy
"
).
order_by
(
'
name
'
),
"
drinks
"
:
Product
Logic
.
getDrinks
(
),
"
candies
"
:
Product
Logic
.
getCandies
(
),
"
products
"
:
Product
.
objects
.
all
(),
"
ident_types
"
:
ProductIdentifierTypes
.
to_dict
(),
})
elif
request
.
method
==
'
POST
'
:
# Perform a purchase
user_id
=
request
.
user
.
id
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment