Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db12ef6ded |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,5 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import Business, Product
|
||||||
|
|
||||||
# Register your models here.
|
admin.site.register(Business)
|
||||||
|
admin.site.register(Product)
|
||||||
@ -1,3 +1,20 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
# Create your models here.
|
class Business(models.Model):
|
||||||
|
owner = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
description = models.TextField()
|
||||||
|
logo = models.ImageField(upload_to='business_logos/', null=True, blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Product(models.Model):
|
||||||
|
business = models.ForeignKey(Business, on_delete=models.CASCADE)
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
description = models.TextField()
|
||||||
|
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
@ -1,25 +1,40 @@
|
|||||||
import os
|
|
||||||
import platform
|
|
||||||
|
|
||||||
from django import get_version as django_version
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
|
|
||||||
def home(request):
|
|
||||||
"""Render the landing screen with loader and environment details."""
|
|
||||||
host_name = request.get_host().lower()
|
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
|
||||||
now = timezone.now()
|
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
# Dummy data for businesses
|
||||||
|
dummy_businesses = [
|
||||||
|
{
|
||||||
|
'name': 'BizOne',
|
||||||
|
'description': 'The first of many amazing businesses on this platform.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Shoply',
|
||||||
|
'description': 'Your one-stop shop for all things great and small.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Artisan Goods',
|
||||||
|
'description': 'Hand-crafted items made with love and care.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Tech Innovate',
|
||||||
|
'description': 'Cutting-edge solutions for a modern world.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Gourmet Bites',
|
||||||
|
'description': 'Delicious treats that will make your day.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Fashion Forward',
|
||||||
|
'description': 'The latest trends, delivered to your door.',
|
||||||
|
'logo_url': 'https://via.placeholder.com/150'
|
||||||
|
}
|
||||||
|
]
|
||||||
context = {
|
context = {
|
||||||
"project_name": "New Style",
|
'businesses': dummy_businesses
|
||||||
"agent_brand": agent_brand,
|
|
||||||
"django_version": django_version(),
|
|
||||||
"python_version": platform.python_version(),
|
|
||||||
"current_time": now,
|
|
||||||
"host_name": host_name,
|
|
||||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
|
||||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
|
||||||
}
|
}
|
||||||
return render(request, "core/index.html", context)
|
return render(request, "core/index.html", context)
|
||||||
Loading…
x
Reference in New Issue
Block a user