Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
warpinfra
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian
warpinfra
Commits
6b65f555
Commit
6b65f555
authored
8 years ago
by
Christian Dresen
Browse files
Options
Downloads
Patches
Plain Diff
[WarpPay] Added Position to Category and to Products
parent
24efef4c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
www/web/warppay/models.py
+6
-4
6 additions, 4 deletions
www/web/warppay/models.py
with
6 additions
and
4 deletions
www/web/warppay/models.py
+
6
−
4
View file @
6b65f555
...
@@ -6,21 +6,23 @@ from warpauth.models import LdapUser
...
@@ -6,21 +6,23 @@ from warpauth.models import LdapUser
class
ProductCategory
(
models
.
Model
):
class
ProductCategory
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
)
position
=
models
.
FloatField
(
null
=
True
,
blank
=
True
,
default
=
0
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
class
ProductCategorySerializer
(
serializers
.
ModelSerializer
):
class
ProductCategorySerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
model
=
ProductCategory
model
=
ProductCategory
fields
=
[
'
id
'
,
'
name
'
]
fields
=
[
'
id
'
,
'
name
'
,
'
position
'
]
class
Product
(
models
.
Model
):
class
Product
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
name
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
price_ek
=
models
.
FloatField
()
price_ek
=
models
.
FloatField
()
price_vk
=
models
.
FloatField
()
price_vk
=
models
.
FloatField
()
category
=
models
.
ForeignKey
(
ProductCategory
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
category
=
models
.
ForeignKey
(
ProductCategory
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
stock_count
=
models
.
IntegerField
()
stock_count
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
default
=
0
)
barcode
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
barcode
=
models
.
CharField
(
max_length
=
100
,
null
=
True
,
blank
=
True
)
position
=
models
.
FloatField
(
null
=
True
,
blank
=
True
,
default
=
0
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
...
@@ -30,7 +32,7 @@ class ProductSerializer(serializers.ModelSerializer):
...
@@ -30,7 +32,7 @@ class ProductSerializer(serializers.ModelSerializer):
category
=
serializers
.
StringRelatedField
()
category
=
serializers
.
StringRelatedField
()
class
Meta
:
class
Meta
:
model
=
Product
model
=
Product
fields
=
[
'
id
'
,
'
name
'
,
'
price_vk
'
,
'
category
'
,
'
barcode
'
,
'
stock_count
'
]
fields
=
[
'
id
'
,
'
name
'
,
'
price_vk
'
,
'
category
'
,
'
barcode
'
,
'
stock_count
'
,
'
position
'
]
class
Transaction
(
models
.
Model
):
class
Transaction
(
models
.
Model
):
...
...
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