Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Boodle
Project
Project
Details
Activity
Releases
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
Martina Therese R. Reyes
Boodle
Commits
d351f132
Commit
d351f132
authored
Mar 17, 2022
by
Felizia Tiburcio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create AuctionBid and Item models
parent
c3eac7fd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
79 deletions
+150
-79
auction.html
boodlesite/templates/auction.html
+13
-14
0002_auctionbid_item.py
main/migrations/0002_auctionbid_item.py
+0
-39
models.py
main/models.py
+128
-14
views.py
main/views.py
+9
-12
No files found.
boodlesite/templates/auction.html
View file @
d351f132
...
@@ -43,16 +43,15 @@
...
@@ -43,16 +43,15 @@
product info div
product info div
<div
class=
"product-info"
style=
"border: 2px dotted black;"
>
<div
class=
"product-info"
style=
"border: 2px dotted black;"
>
{% for item in items %}
<h2>
{{ item.itemname }}
</h2>
<h4>
{{ item.itemspecs }}
</h4>
<h2>
Product Name
</h2>
<h4>
Product Specifications
</h4>
<p>
description description description
<p>
description description description
description description description
description description description
description description description
description description description
description description description
description description description
description description description
</p>
description description description
</p>
{% endfor %}
</div>
</div>
<button
class=
"btn-place-bid"
>
Place Bid
</button>
<button
class=
"btn-place-bid"
>
Place Bid
</button>
...
...
main/migrations/0002_auctionbid_item.py
deleted
100644 → 0
View file @
c3eac7fd
# Generated by Django 4.0.3 on 2022-03-16 14:34
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'main'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'AuctionBid'
,
fields
=
[
(
'bidno'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'amount'
,
models
.
FloatField
()),
(
'bidtime'
,
models
.
DateTimeField
()),
],
options
=
{
'db_table'
:
'auction_bid'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Item'
,
fields
=
[
(
'itemid'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'itemname'
,
models
.
CharField
(
max_length
=
255
)),
(
'itemspecs'
,
models
.
CharField
(
max_length
=
700
)),
(
'floorprice'
,
models
.
FloatField
()),
(
'sellprice'
,
models
.
FloatField
()),
],
options
=
{
'db_table'
:
'item'
,
'managed'
:
False
,
},
),
]
main/models.py
View file @
d351f132
...
@@ -7,15 +7,6 @@
...
@@ -7,15 +7,6 @@
# Feel free to rename the models, but don't rename db_table values or field names.
# Feel free to rename the models, but don't rename db_table values or field names.
from
django.db
import
models
from
django.db
import
models
class
Item
(
models
.
Model
):
itemid
=
models
.
AutoField
(
primary_key
=
True
)
itemname
=
models
.
CharField
(
max_length
=
255
)
itemspecs
=
models
.
CharField
(
max_length
=
700
)
floorprice
=
models
.
FloatField
()
sellprice
=
models
.
FloatField
()
class
Meta
:
managed
=
False
db_table
=
'item'
class
Auction
(
models
.
Model
):
class
Auction
(
models
.
Model
):
auctionid
=
models
.
AutoField
(
primary_key
=
True
)
auctionid
=
models
.
AutoField
(
primary_key
=
True
)
...
@@ -23,7 +14,7 @@ class Auction(models.Model):
...
@@ -23,7 +14,7 @@ class Auction(models.Model):
info
=
models
.
CharField
(
max_length
=
255
)
info
=
models
.
CharField
(
max_length
=
255
)
auctionstart
=
models
.
DateTimeField
()
auctionstart
=
models
.
DateTimeField
()
auctionend
=
models
.
DateTimeField
()
auctionend
=
models
.
DateTimeField
()
item
=
models
.
ForeignKey
(
Item
,
on_delete
=
models
.
CASCADE
)
item
id
=
models
.
ForeignKey
(
'Item'
,
models
.
DO_NOTHING
,
db_column
=
'itemid'
,
blank
=
True
,
null
=
True
)
class
Meta
:
class
Meta
:
managed
=
False
managed
=
False
...
@@ -32,9 +23,132 @@ class Auction(models.Model):
...
@@ -32,9 +23,132 @@ class Auction(models.Model):
class
AuctionBid
(
models
.
Model
):
class
AuctionBid
(
models
.
Model
):
bidno
=
models
.
AutoField
(
primary_key
=
True
)
bidno
=
models
.
AutoField
(
primary_key
=
True
)
amount
=
models
.
FloatField
()
amount
=
models
.
DecimalField
(
max_digits
=
15
,
decimal_places
=
4
)
bidtime
=
models
.
DateTimeField
()
bidtime
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
)
auction
=
models
.
ForeignKey
(
Auction
,
on_delete
=
models
.
CASCADE
)
auctionid
=
models
.
ForeignKey
(
Auction
,
models
.
DO_NOTHING
,
db_column
=
'auctionid'
)
class
Meta
:
managed
=
False
db_table
=
'auctionbid'
class
AuthGroup
(
models
.
Model
):
name
=
models
.
CharField
(
unique
=
True
,
max_length
=
150
)
class
Meta
:
managed
=
False
db_table
=
'auth_group'
class
AuthGroupPermissions
(
models
.
Model
):
group
=
models
.
ForeignKey
(
AuthGroup
,
models
.
DO_NOTHING
)
permission
=
models
.
ForeignKey
(
'AuthPermission'
,
models
.
DO_NOTHING
)
class
Meta
:
managed
=
False
db_table
=
'auth_group_permissions'
unique_together
=
((
'group'
,
'permission'
),)
class
AuthPermission
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
content_type
=
models
.
ForeignKey
(
'DjangoContentType'
,
models
.
DO_NOTHING
)
codename
=
models
.
CharField
(
max_length
=
100
)
class
Meta
:
managed
=
False
db_table
=
'auth_permission'
unique_together
=
((
'content_type'
,
'codename'
),)
class
AuthUser
(
models
.
Model
):
password
=
models
.
CharField
(
max_length
=
128
)
last_login
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
)
is_superuser
=
models
.
BooleanField
()
username
=
models
.
CharField
(
unique
=
True
,
max_length
=
150
)
first_name
=
models
.
CharField
(
max_length
=
150
)
last_name
=
models
.
CharField
(
max_length
=
150
)
email
=
models
.
CharField
(
max_length
=
254
)
is_staff
=
models
.
BooleanField
()
is_active
=
models
.
BooleanField
()
date_joined
=
models
.
DateTimeField
()
class
Meta
:
managed
=
False
db_table
=
'auth_user'
class
AuthUserGroups
(
models
.
Model
):
user
=
models
.
ForeignKey
(
AuthUser
,
models
.
DO_NOTHING
)
group
=
models
.
ForeignKey
(
AuthGroup
,
models
.
DO_NOTHING
)
class
Meta
:
managed
=
False
db_table
=
'auth_user_groups'
unique_together
=
((
'user'
,
'group'
),)
class
AuthUserUserPermissions
(
models
.
Model
):
user
=
models
.
ForeignKey
(
AuthUser
,
models
.
DO_NOTHING
)
permission
=
models
.
ForeignKey
(
AuthPermission
,
models
.
DO_NOTHING
)
class
Meta
:
managed
=
False
db_table
=
'auth_user_user_permissions'
unique_together
=
((
'user'
,
'permission'
),)
class
DjangoAdminLog
(
models
.
Model
):
action_time
=
models
.
DateTimeField
()
object_id
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
object_repr
=
models
.
CharField
(
max_length
=
200
)
action_flag
=
models
.
SmallIntegerField
()
change_message
=
models
.
TextField
()
content_type
=
models
.
ForeignKey
(
'DjangoContentType'
,
models
.
DO_NOTHING
,
blank
=
True
,
null
=
True
)
user
=
models
.
ForeignKey
(
AuthUser
,
models
.
DO_NOTHING
)
class
Meta
:
managed
=
False
db_table
=
'django_admin_log'
class
DjangoContentType
(
models
.
Model
):
app_label
=
models
.
CharField
(
max_length
=
100
)
model
=
models
.
CharField
(
max_length
=
100
)
class
Meta
:
managed
=
False
db_table
=
'django_content_type'
unique_together
=
((
'app_label'
,
'model'
),)
class
DjangoMigrations
(
models
.
Model
):
app
=
models
.
CharField
(
max_length
=
255
)
name
=
models
.
CharField
(
max_length
=
255
)
applied
=
models
.
DateTimeField
()
class
Meta
:
class
Meta
:
managed
=
False
managed
=
False
db_table
=
'auction_bid'
db_table
=
'django_migrations'
\ No newline at end of file
class
DjangoSession
(
models
.
Model
):
session_key
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
40
)
session_data
=
models
.
TextField
()
expire_date
=
models
.
DateTimeField
()
class
Meta
:
managed
=
False
db_table
=
'django_session'
class
Item
(
models
.
Model
):
itemid
=
models
.
AutoField
(
primary_key
=
True
)
itemname
=
models
.
CharField
(
max_length
=
255
)
itemspecs
=
models
.
CharField
(
max_length
=
700
)
floorprice
=
models
.
DecimalField
(
max_digits
=
15
,
decimal_places
=
4
)
sellprice
=
models
.
DecimalField
(
max_digits
=
15
,
decimal_places
=
4
,
blank
=
True
,
null
=
True
)
class
Meta
:
managed
=
False
db_table
=
'item'
main/views.py
View file @
d351f132
...
@@ -31,22 +31,19 @@ def auction(request, pk):
...
@@ -31,22 +31,19 @@ def auction(request, pk):
# Current auction ID
# Current auction ID
auction
=
Auction
.
objects
.
get
(
pk
=
pk
)
auction
=
Auction
.
objects
.
get
(
pk
=
pk
)
# to display item name, information
items
=
Item
.
objects
.
all
()
#items = Item.objects.values_list('itemname', 'itemspecs')
for
item
in
items
:
print
(
item
)
# print('auction', pk, auction)
# print('auction', pk, auction)
# print(auction.title,auction.info)
# print(auction.title,auction.info)
context
=
{
'items'
:
items
}
if
auction
.
auctionend
<
datetime
.
now
():
if
auction
.
auctionend
<
datetime
.
now
():
return
HttpResponse
(
"This auction has already passed."
)
return
HttpResponse
(
"This auction has already passed."
)
elif
auction
.
auctionstart
>
datetime
.
now
():
elif
auction
.
auctionstart
>
datetime
.
now
():
return
HttpResponse
(
"This auction has not yet started."
)
return
HttpResponse
(
"This auction has not yet started."
)
else
:
else
:
return
render
(
request
,
"boodlesite/templates/auction.html"
,
context
)
return
render
(
request
,
"boodlesite/templates/auction.html"
)
\ No newline at end of file
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