Skip to content

Commit

Permalink
changes in idk
Browse files Browse the repository at this point in the history
  • Loading branch information
dinesh committed Apr 24, 2024
1 parent 43d6bdc commit e330715
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 14 deletions.
Binary file modified db.sqlite3
Binary file not shown.
Empty file removed main/__init__.py
Empty file.
Binary file removed main/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file modified main/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file modified main/__pycache__/views.cpython-312.pyc
Binary file not shown.
Empty file removed main/migrations/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ def __str__(self) -> str:
class Product_images(models.Model):
product_id = models.ForeignKey(Product,on_delete=models.CASCADE)
product_images = models.ImageField(upload_to='product_images/')
def __str__(self) -> str:
return self.product_id.product_id

class bidding(models.Model):
product_id = models.ForeignKey(Product,on_delete=models.CASCADE)
user_name = models.ForeignKey(users,on_delete=models.CASCADE)
for_price = models.IntegerField()
def __str__(self) -> str:
return f'{self.user_name.user_name} bidded for {self.product_id.product_id}'

class user_activity(models.Model):
user_name = models.ForeignKey(users,on_delete=models.CASCADE)
Expand Down
4 changes: 2 additions & 2 deletions main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.http import HttpResponse
from . import models
from django.conf import settings
from django.http import JsonResponse
# Create your views here.
def index(request):
logged_in = True if settings.LOGGED_IN else False
Expand All @@ -16,7 +17,6 @@ def index(request):
'login' : logged_in,
'data' : data,
}
print(data)
if logged_in:
user_name = settings.USER_NAME
user = models.users.objects.get(user_name=user_name)
Expand Down Expand Up @@ -102,7 +102,7 @@ def auctions(request):
def auction(request,auction_name):
data = models.Product.objects.get(product_id=auction_name)
image = models.Product_images.objects.filter(product_id=auction_name).first()
bidding = models.bidding.objects.filter(product_id=auction_name).all()
bidding = models.bidding.objects.filter(product_id=auction_name).all()[::-1]

template = loader.get_template('auction.html')
context = {
Expand Down
Binary file added media/product_images/obito_QKZJBCE.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/js/description.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function myFunction() {
alert("Hello iam desciption");
}
11 changes: 6 additions & 5 deletions static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,16 @@ button:hover {
text-align: center;
border-radius: 10px;
}
.new_bid input[type="text"] {
height: 15px;
.new_bid input[type="number"] {
height: 28px;
width: 120px;
margin-top: 15px;
margin-left: 10px;
margin-right: 10px;
margin-top: 18px;
margin-left: 2px;
margin-right: 2px;
border: 1px solid #000;
font-size: 20px;
color: #000;
border-radius: 5px;
}

.bid_button {
Expand Down
7 changes: 3 additions & 4 deletions templates/auction.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3>{{data.product_id}}</h3>
<h1>User_name</h1>
<a href="#"><h3>{{data.user_name}}</h3></a>
</div>
<button type="button" class="info_button" id="description">Description</button>
<button class="info_button" id="description" onclick="myFunction()">Description</button>
</div>
<div class="bid_box">
<div class="current_bid_details">
Expand All @@ -32,17 +32,16 @@ <h4>{{data.current_bid}}</h4>
</div>
</div>
<div class="new_bid">
<h2 id="baseprice">{{data.current_bid}}+</h2><input type="text" id="enter_amount" name="amount" placeholder="Your Bid"><h2 id="new_amount">={{data.current_bid}}</h2><button type="button" class="bid_button">Bid</button>
<h2 id="baseprice">{{data.current_bid}} +</h2><input type="number" id="enter_amount" name="amount" placeholder="Your Bid"><h2 id="new_amount"> = {{data.current_bid}}</h2><button type="button" class="bid_button">Bid</button>
</div>
</div>
<div class="auction_activity">
<h1>Activity</h1>
{% for data in activity %}
<div class="user_bid_activity">
<a href="#"><h3>{{data.user_name}}</h3></a>
<a href="/user/{{data.user_name}}"><h3>{{data.user_name}}</h3></a>
<h4>{{data.for_price}}</h4>
</div>
{% endfor %}
</div>
{% endblock content %}
<script src={% static "js/description.js" %}>
9 changes: 6 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
</title>
<link rel="icon" href={% static "logo/icon.jpg" %}>
<link rel="stylesheet" href={% static "styles.css" %}>
<script src={% static "js/description.js" %}></script>
</head>
<body>
<header>
<div class="logo">
<img src= {% static "logo/logo.png" %} alt="Auction Logo">
</div>
<a href="/">
<div class="logo">
<img src= {% static "logo/logo.png" %} alt="Auction Logo">
</div>
</a>
{%block user %}

{% endblock user %}
Expand Down

0 comments on commit e330715

Please sign in to comment.