0
我想呈現下面的表單,但Django拋出一個錯誤,我不明白爲什麼。提前致謝。NameError:name'Name'沒有以django的形式定義
forms.py:
from django import forms
from .models import equipment
class neweqForm(forms.ModelForm):
class Meta:
model = equipment
name = forms.CharField(label=Name, max_lenght=100)
fabricator = forms.CharField(label=Hersteller, max_lenght=100)
storeplace = forms.IntegerField(label=Regal)
labour = forms.ChoiceField(label=Gewerk)
models.py:
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class equipment(models.Model):
name = models.CharField(max_length=30)
fabricator = models.CharField(max_length=30)
storeplace = models.IntegerField()
labor_choices = (
('L', 'Licht'),
('T', 'Ton'),
('R', 'rigging'),
)
labor = models.CharField(max_length=1, choices=labor_choices)
錯誤:
NameError: name 'Name' is not defined
多麼愚蠢的錯誤!謝謝你的幫助。 – nictec