This commit is contained in:
2024-12-13 08:31:39 +07:00
parent 1ead9da097
commit 5bdf96851e
3554 changed files with 400518 additions and 83328 deletions

View File

@@ -7,6 +7,9 @@ admin.site.register(sliderSection)
# Services Admin Register
admin.site.register(serviceSection)
# Products Admin Register
admin.site.register(productSection)
# About Admin Register
admin.site.register(aboutSection)

View File

@@ -49,6 +49,23 @@ class aboutSectionForm(forms.ModelForm):
for field in self.fields.values():
field.widget.attrs['class'] = 'form-control'
# Products Form
class productForm(forms.ModelForm):
class Meta:
model = productSection
fields = '__all__'
widgets = {
'slug' : forms.TextInput(attrs={'readonly':'readonly'}),
'fontawesome_icon_class' : forms.TextInput(attrs={'placeholder':'eg. fas fa-laptop-code'}),
'show_call_now_widget' : forms.CheckboxInput(attrs={'type' : 'checkbox'}),
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Add Bootstrap classes to form fields
for field in self.fields.values():
field.widget.attrs['class'] = 'form-control'
# Project Section and Project Category Form
class projectCategoryForm(forms.ModelForm):
class Meta:

View File

@@ -0,0 +1,31 @@
# Generated by Django 4.2.4 on 2023-08-31 06:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0017_alter_projectsection_category'),
]
operations = [
migrations.AlterModelOptions(
name='servicesection',
options={'verbose_name_plural': '4. Service Section'},
),
migrations.CreateModel(
name='productSection',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('short_description', models.CharField(max_length=500)),
('fontawesome_icon_class', models.CharField(max_length=100)),
('detail_page_image', models.ImageField(upload_to='Products/')),
('detail_page_description', models.TextField()),
],
options={
'verbose_name_plural': '3. Products Section',
},
),
]

View File

@@ -0,0 +1,61 @@
# Generated by Django 5.0.3 on 2024-12-12 08:41
import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0018_productsection'),
]
operations = [
migrations.AlterModelOptions(
name='aboutsection',
options={'verbose_name_plural': '4. About Section'},
),
migrations.AlterModelOptions(
name='productsection',
options={'verbose_name_plural': '3. Product Section'},
),
migrations.AlterModelOptions(
name='servicesection',
options={'verbose_name_plural': '2. Service Section'},
),
migrations.AddField(
model_name='productsection',
name='show_call_now_widget',
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name='productsection',
name='slug',
field=models.SlugField(blank=True, null=True),
),
migrations.AlterField(
model_name='productsection',
name='detail_page_description',
field=ckeditor.fields.RichTextField(blank=True, null=True),
),
migrations.AlterField(
model_name='productsection',
name='detail_page_image',
field=models.ImageField(blank=True, null=True, upload_to='Products/'),
),
migrations.AlterField(
model_name='productsection',
name='fontawesome_icon_class',
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name='productsection',
name='name',
field=models.CharField(blank=True, max_length=200, null=True),
),
migrations.AlterField(
model_name='productsection',
name='short_description',
field=models.CharField(blank=True, max_length=500, null=True),
),
]

View File

@@ -39,6 +39,26 @@ class serviceSection(models.Model):
class Meta:
verbose_name_plural = "2. Service Section"
# Products Model
class productSection(models.Model):
name = models.CharField(max_length=200, blank=True, null=True)
slug = models.SlugField(blank=True, null=True)
short_description = models.CharField(max_length=500, blank=True, null=True)
fontawesome_icon_class = models.CharField(max_length=100, blank=True, null=True)
detail_page_image = models.ImageField(upload_to='Products/', blank=True, null=True)
detail_page_description = RichTextField(blank=True, null=True)
show_call_now_widget = models.BooleanField(default=True)
def save(self, *args, **kwargs):
self.slug = slugify(self.name)
super().save(*args, **kwargs)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = "3. Product Section"
# About Section Model
class aboutSection(models.Model):
subtitle = models.CharField(max_length=200, blank=True, null=True)
@@ -57,7 +77,7 @@ class aboutSection(models.Model):
return self.title
class Meta:
verbose_name_plural = "3. About Section"
verbose_name_plural = "4. About Section"
# Project and Project category Section Model
class projectCategory(models.Model):

View File

@@ -7,6 +7,7 @@ def homePageFront(request):
meta = homePageSEO.objects.first()
sliders = sliderSection.objects.all()
services = serviceSection.objects.all()
products = productSection.objects.all()
about = aboutSection.objects.first()
project_categories= projectCategory.objects.all()
projects = projectSection.objects.all().order_by('?')
@@ -16,6 +17,7 @@ def homePageFront(request):
'meta' : meta,
'sliders' : sliders,
'services' : services,
'products' : products,
'about' : about,
'project_categories' : project_categories,
'projects': projects,