[Fixed]-Is a ModelChoiceField always required?

32👍

If you are going to override the form you need to set the field as not required in the ArticleAdminForm.

class ArticleAdminForm(forms.ModelForm):
    .
    .
    parent_article = forms.ModelChoiceField(
        queryset=AyurvedicArticle.objects.filter(parent_article=None),
        required=False,
        help_text="Select the parent article (if any)"
    )

    class Meta:
        Article

Leave a comment