模块中没有名称“类名”

时间:2019-08-18 15:24:00

标签: django-models

我在django models.py文件中设置了一个类名'Destination',并将其导入views.py中,但是遇到错误

  

模型中没有名称的“目的地”模块

这是针对django服务器的

在views.py文件中:

from django.shortcuts import render
from .models import Destination
# from django.http import HttpResponse

# Create your views here.
def index(request): 


     dest1 = Destination()


     dest1.id = 1
    dest1.price = 1000


     dest1.desc = 'City Of Lover'
        dest1.name = 'Lahore'
        return render(request, 'index.html', {'dest1': dest1})

在models.py文件中:-

from django.db import models

# Create your models here.
class Destination:



     id : int
    price : int
    name : str
    desc : str
    img : str

models.py中没有名称的“目的地”模块

0 个答案:

没有答案
相关问题