首页 > 解决方案 > how to get access to the django class object

问题描述

I have created a model class in django

class metaTag(models.Model):
    page_choice=[
        ('index','index'),
        ('about','about'),
        ('carrer','carrer'),
        ('base','base'),
        ('checkup','checkup'),
        ('contact','contact'),
        ('faq','faq'),
        ('checkup','checkup'),
        ('app','app'),
        ('googleads','googleads'),
        ('graphics','graphics'),
        ('seo','seo'),
        ('socialmedia','socialmedia'),
        ('web','web'),
    ]
    page=models.CharField(max_length=15,choices=page_choice,default='index')
    title=models.CharField(max_length=50,default="AdsOptimiser")
    description=models.CharField(max_length=160,default="AdsOptimiser")
    keywords=models.CharField(max_length=200,default="AdsOptimiser")

    def __str__(self):
        return self.page

what I want to achive by this I want my client have an option to change the title keywords and description meta tags from its admin panel to achive this I created this class so the client can fill the data now i am confused how to plug in the data and what will be the optimal way to do it.

标签: djangoclass

解决方案


推荐阅读