0
장고 모델 유형에 따라 분할을 형성장고 양식은 모델 유형에 따라 나누
models.py
TYPE = (
('general', 'General'),
('category2', 'Category2'),
)
class Test(models.Model):
type = models.CharField(max_length=765, choices=TYPE)
forms.py
class TestForm(ModelForm):
class Meta:
model = Test
이 모델의 유형에 따라, "유형"에 따라 양식을 나누어 2 개 개의 분리 형태를 만들 수 있나요
TestFormGeneral
TestFormCategory2
위의 모델 형태로 모든 항목을 꺼내
models.py
class TestImport(models.Model):
tests = models.ForeignKey(Test))
업데이트
는 유형에 따라이를 제한하고 싶습니다 전체 내용을 표시하는 것이 아닙니다.
그래도이 매우 불분명 확실하지. '양식 분할'이란 무엇입니까? 두 가지 형태는 무엇을할까요? 그들 사이의 차이점은 무엇입니까? –
내 게시물을 업데이트했습니다. – bobsr