Skip to content

Instantly share code, notes, and snippets.

@UnknownPlatypus
Last active November 9, 2021 10:17
Show Gist options
  • Save UnknownPlatypus/882cb78b0e03a0d26292e842733fd27b to your computer and use it in GitHub Desktop.
Save UnknownPlatypus/882cb78b0e03a0d26292e842733fd27b to your computer and use it in GitHub Desktop.
from django import forms
from django.db import models
from django.utils.translation import gettext_lazy as _
class RenovationConfirmationContent(models.Model):
faq_title = models.CharField(max_length=191)
faqCategory = models.ForeignKey("content.faq")
def clean(self):
if self.faqCategory and not self.faq_title:
raise forms.ValidationError({
"faq_title": "Si une faq est affichée, il est obligatoire de lui donner un titre"
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment