codescraftman / landing / models.py
models.py
Raw
# landing/models.py

from django.db import models

class LandingPageContent(models.Model):
    SECTION_CHOICES = [
        ('hero', 'Hero Section'),
        ('about', 'About Section'),
        ('features', 'Features Section'),
        ('services', 'Services Section'),
        ('contact', 'Contact Section'),
    ]

    section = models.CharField(max_length=20, choices=SECTION_CHOICES)
    title = models.CharField(max_length=200)
    subtitle = models.CharField(max_length=300, blank=True)
    description = models.TextField()
    featured_image = models.ImageField(upload_to='landing/', blank=True, null=True)
    button_text = models.CharField(max_length=50, blank=True)
    button_link = models.URLField(max_length=200, blank=True, null=True)
    is_active = models.BooleanField(default=True)

    def __str__(self):
        return f"{self.get_section_display()} - {self.title}"