Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
KawowyDzienniczek
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafal
KawowyDzienniczek
Commits
742f7a9a
Commit
742f7a9a
authored
Jul 05, 2016
by
lizonr1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sample products
parent
8cb82fea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
init_products.py
...niczek/App/loyaltyMe/management/commands/init_products.py
+21
-0
photo_1.jpg
KawowyDzienniczek/static/media/img/photo_1.jpg
+0
-0
No files found.
KawowyDzienniczek/App/loyaltyMe/management/commands/init_products.py
0 → 100644
View file @
742f7a9a
from
App.loyaltyMe.models
import
Product
__author__
=
'Rafal'
from
django.core.management.base
import
BaseCommand
,
CommandError
class
Command
(
BaseCommand
):
help
=
'Closes the specified poll for voting'
def
handle
(
self
,
*
args
,
**
options
):
products
=
[
#['name', 'description', 'price', 'img' ],
[
'Kawa Latte'
,
'Z nutą czekolady'
,
'7 zł'
,
'/static/media/img/photo_1.jpg'
],
[
'Herbata'
,
'Z nutą czekolady'
,
'4 zł'
,
'/static/media/img/photo_1.jpg'
],
[
'Ciasto'
,
'Z nutą czekolady'
,
'5 zł'
,
'/static/media/img/photo_1.jpg'
],
[
'Espresso'
,
'Mała czarna'
,
'5 zł'
,
'/static/media/img/photo_1.jpg'
],
]
print
(
"Creating Products"
)
for
product
in
products
:
print
(
'Create {0}'
.
format
(
product
[
0
]))
new_product
=
Product
.
objects
.
create
(
name
=
product
[
0
],
description
=
product
[
1
],
price
=
product
[
2
],
img
=
product
[
3
])
new_product
.
save
()
\ No newline at end of file
KawowyDzienniczek/static/media/img/photo_1.jpg
0 → 100644
View file @
742f7a9a
58.9 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment