remove other option before saving

This commit is contained in:
Oliver Zander 2025-10-20 14:40:25 +02:00
parent 2c79732200
commit 1dbd38dc4a
1 changed files with 8 additions and 0 deletions

View File

@ -203,6 +203,14 @@ class ProjectCategoryField(models.ManyToManyField):
return super().formfield(**kwargs) return super().formfield(**kwargs)
def save_form_data(self, instance, data):
data = list(data)
with suppress(ValueError):
data.remove(self.remote_field.model.other)
return super().save_form_data(instance, data)
class Project(Volunteer): class Project(Volunteer):
end_mail_send = models.BooleanField(default=False, verbose_name='Keine Projektabschlussmail schicken') end_mail_send = models.BooleanField(default=False, verbose_name='Keine Projektabschlussmail schicken')