Skip to content

Commit a095cd5

Browse files
Working On The User Location Database
1 parent 6d31bd1 commit a095cd5

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ local_settings.py
6161
db.sqlite3
6262
db.sqlite3-journal
6363

64+
#Geo-Database
65+
*.mmdb
66+
6467
# Flask stuff:
6568
instance/
6669
.webassets-cache

Home/views.py

+11
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,22 @@
55
from cart.cart import Cart
66
from django.contrib.auth.decorators import login_required
77
from Shop.models import Product
8+
import geoip2.database
9+
import socket
810

911

1012
def index(request):
1113
# products = Product.objects.all()[:3]
1214
# main_products = {'products': products}
15+
16+
# Getting The Ip Address
17+
hostname = socket.gethostname()
18+
ip_address = socket.gethostbyname(hostname)
19+
20+
# Fetching The Country
21+
# reader = geoip2.database.Reader('./GeoLite2-Country.mmdb')
22+
# response = reader.country(ip_address=ip_address)
23+
# print(response)
1324
return render(request, 'home/index.html')
1425

1526

templates/home/index.html

+7-8
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,8 @@
284284

285285
<!--Ends Here-->
286286

287-
<<<<<<< HEAD
288-
<div class="main__body__section">
289-
290-
<!--Fisrt Row-->
291-
<div class="home__row" style="margin-top: -140px;">
292-
=======
293287
<!--Last Row-->
294288
<div class="home__row" style="margin-top: -50px;">
295-
>>>>>>> dc0cb827c498aa61d30e8534ba798965df72679c
296289
<div class="product">
297290
<h2 class="card-heading">Shop By Category</h2>
298291

@@ -378,7 +371,7 @@ <h2 class="card-heading">Sign in for the best experience</h2>
378371
height: auto;
379372
">
380373
</div>
381-
374+
</div>
382375
</div>
383376
<!--Ends Here-->
384377

@@ -462,6 +455,12 @@ <h2 class="x__product__title">
462455
<li class="x__items">
463456
<img src="https://m.media-amazon.com/images/I/41V4eXt+eXL._AC_SY200_.jpg" alt="Charger" class="x__items__lists">
464457
</li>
458+
<li class="x__items">
459+
<img src="https://m.media-amazon.com/images/I/41V4eXt+eXL._AC_SY200_.jpg" alt="Charger" class="x__items__lists">
460+
</li>
461+
<li class="x__items">
462+
<img src="https://m.media-amazon.com/images/I/41V4eXt+eXL._AC_SY200_.jpg" alt="Charger" class="x__items__lists">
463+
</li>
465464
</div>
466465
</div>
467466
</div>

0 commit comments

Comments
 (0)