0
我試圖更新Django中的窗體。我有以下幾點:Django窗體不更新
models.py
from django.db import models
from django.core.urlresolvers import reverse
class List(models.Model):
def get_absolute_url(self):
return reverse('view_list', args=[self.id])
# Create your models here.
class Item(models.Model):
text = models.TextField(default = '')
list = models.ForeignKey(List, default = None)
forms.py
from django import forms
from lists.models import Item
EMPTY_ITEM_ERROR = "You can't have an empty list item"
class ItemForm(forms.models.ModelForm):
class Meta:
model = Item
fields = ('text',)
widgets ={
'text' : forms.fields.TextInput(attrs={
'placeholder': 'Enter a to-do item',
'class': 'form-control input-lg',
}),
}
error_messages = {
'text' : { 'required': EMPTY_ITEM_ERROR }
}
我沒有看到在forms.py任何改變,現在它已經加載。我的意思是,該頁面顯示形式的發現,但如果我試圖改變,例如,佔位符值::
'placeholder': 'Enter a to-do item OR DON'T!',
輸入框不顯示一旦頁面加載任何更改。是否有需要運行的manage.py命令?或者其他一些遷移?