initial
This commit is contained in:
commit
45e3c1f698
3462 files changed
+617437
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,4 @@
|
||||
from django.contrib import admin
|
||||
from service.models import *
|
||||
|
||||
admin.site.register(servicePageSEO)
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ServiceConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'service'
|
||||
@@ -0,0 +1,13 @@
|
||||
from django import forms
|
||||
from service.models import *
|
||||
|
||||
# Service Page SEO Form
|
||||
class servicePageSEOForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = servicePageSEO
|
||||
fields = '__all__'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
for field in self.fields.values():
|
||||
field.widget.attrs['class'] = 'form-control'
|
||||
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 4.2.4 on 2023-09-16 15:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='servicePageSEO',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('meta_title', models.CharField(blank=True, max_length=500, null=True)),
|
||||
('meta_description', models.CharField(blank=True, max_length=1000, null=True)),
|
||||
],
|
||||
),
|
||||
]
|
||||
Whitespace-only changes.
@@ -0,0 +1,5 @@
|
||||
from django.db import models
|
||||
|
||||
class servicePageSEO(models.Model):
|
||||
meta_title = models.CharField(max_length=500, blank=True, null=True)
|
||||
meta_description = models.CharField(max_length=1000, blank=True, null=True)
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.urls import path
|
||||
from service.views import *
|
||||
|
||||
urlpatterns = [
|
||||
path('services/', serviceFrontPage, name='serviceFrontPage'),
|
||||
path('service/details/<str:slug>/', serviceDetail, name='serviceDetail'),
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from service.models import servicePageSEO
|
||||
from home.models import serviceSection
|
||||
|
||||
def serviceFrontPage(request):
|
||||
seo = servicePageSEO.objects.first()
|
||||
services = serviceSection.objects.all()
|
||||
|
||||
context ={
|
||||
'seo' : seo,
|
||||
'services' : services,
|
||||
|
||||
}
|
||||
return render(request, 'front/main/service.html', context)
|
||||
|
||||
def serviceDetail(request, slug):
|
||||
service = get_object_or_404(serviceSection, slug=slug)
|
||||
services = serviceSection.objects.all()
|
||||
|
||||
context = {
|
||||
'service' : service,
|
||||
'services' : services,
|
||||
}
|
||||
return render(request, 'front/main/partial/service-details.html', context)
|
||||
|
||||
|
||||
def error_404(request, exception):
|
||||
return render(request, 'error/404.html', status=404)
|
||||
Reference in new issue
Block a user