mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-10 19:57:15 +03:00
c049ab7470
* merge master into v3 * fix order_by snake casing by checking if value is None, switch executor to execution_context_class since schema.execute no longer supports executor * fix linting by removing duplicate defintion and test of convert_form_field_to_string_list
17 lines
349 B
Python
17 lines
349 B
Python
from django import forms
|
|
from django.core.exceptions import ValidationError
|
|
|
|
from .models import Pet
|
|
|
|
|
|
class PetForm(forms.ModelForm):
|
|
class Meta:
|
|
model = Pet
|
|
fields = "__all__"
|
|
|
|
def clean_age(self):
|
|
age = self.cleaned_data["age"]
|
|
if age >= 99:
|
|
raise ValidationError("Too old")
|
|
return age
|