我想创建一个页脚信息模型,并在静态文件夹中使用base.html,为什么它不工作?
models.py
class FooterContactInfo(models.Model):
phoneumber1=models.CharField(max_length=15)
phoneumber2=models.CharField(max_length=15)
email_help =models.EmailField()
address=models.CharField(max_length=100)
views.py
def FooterContactInfo_view(request):
footer = FooterContactInfo.objects.all().last()
return render(request, 'base.html',context={'footer':footer})
base.html
<li>
<a href="#0"><i class="fas fa-phone-alt"></i>{{footer.phoneumber1}}</a>
</li>
<li>
class FooterInfo:
def __init__(self, copyright_year: int, company_name: str):
self.copyright_year = copyright_year
self.company_name = company_name
def get_copyright_notice(self) -> str:
return f"Copyright {self.copyright_year} {self.company_name}"