def validate_handle(self, field): if not (self.instance and self.instance.handle == field.data): try: MeetingType.select().get(handle=field.data) raise ValidationError('A meeting type with the same handle ' 'already exists') except MeetingType.DoesNotExist: pass
def meeting_types(): meeting_types = MeetingType.select().order_by('id') return { 'meeting_types': meeting_types, }
def value_labels(self): return {i.handle: i.name for i in MeetingType.select()}
def valid_values(self): return [i.handle for i in MeetingType.select()]