0
I have this model:
class template(models.Model):
nome = models.CharField(max_length=30)
is view:
def home(request):
dados = template.objects.all()
return render(request,'index.html', {'dados':dados})
template:
<!DOCTYPE html>
{% load static %}
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title> {{ template.nome }} </title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="" name="keywords">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <!-- Favicons -->
<link href="{% static 'img/favicon.png' %}" rel="icon">
<link href="{% static 'img/apple-touch-icon.png' %}" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Roboto:100,300,400,500,700|Philosopher:400,400i,700,700i" rel="stylesheet">
<!-- Bootstrap css -->
<!-- <link rel="stylesheet" href="css/bootstrap.css"> -->
<link href="{% static 'lib/bootstrap/css/bootstrap.min.css" rel="stylesheet' %}">
<!-- Libraries CSS Files -->
<link href="{% static 'lib/owlcarousel/assets/owl.carousel.min.css' %}" rel="stylesheet">
<link href="{% static 'lib/owlcarousel/assets/owl.theme.default.min.css' %}" rel="stylesheet">
<link href="{% static 'lib/font-awesome/css/font-awesome.min.css' %}" rel="stylesheet">
<link href="{% static 'lib/animate/animate.min.css' %}" rel="stylesheet">
<link href="{% static 'lib/modal-video/css/modal-video.min.css' %}" rel="stylesheet">
<!-- Main Stylesheet File -->
<link href="{% static 'css/style.css' %}" rel="stylesheet">
</head>
And I’m calling the template a: {{ template.name }}
My intention is to create a form so that the user can edit data in the template (eg: company name, contacts, slogan), I am using Django admin for the form but nothing appears in the template, can anyone point out the error? this is the right way to do it?
Da para vc colocar o codigo da sua template?
– Sidon
Ready put.
– Danilo Costa
Okay, but where are you showing the data in the template? I don’t understand what you want.
– Sidon