Made migrations. Modified the form tag in auction.html.

Made a floor price context for the auction page.
Co-authored-by: 's avatarpinkboheme <pinkboheme@users.noreply.github.com>
parent c266f6c8
......@@ -64,16 +64,18 @@ a{% extends 'boodlesite\templates\base.html' %}
</div>
<div class="modal-body">
<form>
<form action="auction/<int:pk>/" method="post">
<div class="form-group">
{% csrf_token %}
<label for="recipient-name" class="col-form-label">Enter Bid amount:</label>
<form id="form" method="post">
<input type="number" class="form-control" id="amount">
{% csrf_token %}
</form>
<!--add an if else statement here re. floor price-->
</div>
</form>
</div>
<div class="modal-footer">
......
# Generated by Django 4.0.3 on 2022-03-26 08:08
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.DecimalField(decimal_places=4, max_digits=15)),
('bidtime', models.DateTimeField(blank=True, null=True)),
],
options={
'db_table': 'auctionbid',
'managed': False,
},
),
migrations.CreateModel(
name='AuthGroup',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=150, unique=True)),
],
options={
'db_table': 'auth_group',
'managed': False,
},
),
migrations.CreateModel(
name='AuthGroupPermissions',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_group_permissions',
'managed': False,
},
),
migrations.CreateModel(
name='AuthPermission',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('codename', models.CharField(max_length=100)),
],
options={
'db_table': 'auth_permission',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128)),
('last_login', models.DateTimeField(blank=True, null=True)),
('is_superuser', models.BooleanField()),
('username', models.CharField(max_length=150, unique=True)),
('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()),
],
options={
'db_table': 'auth_user',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUserGroups',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_user_groups',
'managed': False,
},
),
migrations.CreateModel(
name='AuthUserUserPermissions',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'db_table': 'auth_user_user_permissions',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoAdminLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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()),
],
options={
'db_table': 'django_admin_log',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoContentType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('app_label', models.CharField(max_length=100)),
('model', models.CharField(max_length=100)),
],
options={
'db_table': 'django_content_type',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoMigrations',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('app', models.CharField(max_length=255)),
('name', models.CharField(max_length=255)),
('applied', models.DateTimeField()),
],
options={
'db_table': 'django_migrations',
'managed': False,
},
),
migrations.CreateModel(
name='DjangoSession',
fields=[
('session_key', models.CharField(max_length=40, primary_key=True, serialize=False)),
('session_data', models.TextField()),
('expire_date', models.DateTimeField()),
],
options={
'db_table': 'django_session',
'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.DecimalField(decimal_places=4, max_digits=15)),
('sellprice', models.DecimalField(blank=True, decimal_places=4, max_digits=15, null=True)),
],
options={
'db_table': 'item',
'managed': False,
},
),
]
......@@ -31,14 +31,16 @@ def homepage(request):
def auction(request, pk):
# Current auction ID
auction = Auction.objects.get(pk=pk)
auction_bid = AuctionBid.objects.get(auctionid = pk)
auction_bid = AuctionBid.objects.filter(auctionid=pk)
auction_item = auction.itemid
context = {
'item_name':auction_item.itemname,
'item_specs': auction_item.itemspecs,
'item_bid' : auction_bid.amount
'item_bid' : auction_bid.amount,
'item_floor_price': auction_item.floorprice
# need to make floor price object here
}
if auction.auctionend < datetime.now():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment