1
models.py的Django的forms.py沒有得到新的值從DB
class Test(models.Model):
name = models.CharField(max_length=256)
slug_name = models.CharField(max_length=256)
template = models.BooleanField("Is Template",default=False)
@staticmethod
def template_as_tuple():
return Test.objects.filter(template=True).values_list('id','name')
forms.py
class Test2(forms.ModelForm):
templates = forms.ChoiceField(choices=Catalogue.predefined_settings_as_tuple(), required=False)
path = orms.FileField()
問題是,當我在它不是所示的模型添加模板更新forms.py。我需要重新啓動網絡服務器才能顯示更新