Skip to content

Instantly share code, notes, and snippets.

@maxwellcc
Last active September 6, 2022 12:40
Show Gist options
  • Select an option

  • Save maxwellcc/0d3aadf44997c0208043395db270bdf3 to your computer and use it in GitHub Desktop.

Select an option

Save maxwellcc/0d3aadf44997c0208043395db270bdf3 to your computer and use it in GitHub Desktop.

Revisions

  1. maxwellcc revised this gist May 27, 2020. No changes.
  2. maxwellcc created this gist May 27, 2020.
    21 changes: 21 additions & 0 deletions model.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    class ArticleForm(forms.ModelForm):
    brief_summary = forms.CharField(
    widget=TinyMCE(
    attrs={
    'cols': 80,
    'rows': 50
    }
    )
    )

    class Meta:
    model = Article
    fields = ()

    def clean(self):
    data = self.cleaned_data
    highlighted_article = data.get('highlighted_article')
    image = data.get('image')

    if highlighted_article and not image:
    raise forms.ValidationError(_('Provide an image for highlighted article.'))