You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django provides Form fields that can be used directly in Form objects.
Does django-enumfields provide an EnumField that can be used directly in a form like:
from django import forms
import enumfields
class MyForm(forms.Form):
my_enum = enumfields. # ... ?
I can get it to work if I put an enumfields.EnumIntegerField into a Model and then use a ModelForm, but if I just want to create a Form without a Model I couldn't figure out how to do this.
I'm happy to submit a PR with an example if someone could teach me how to do this. :)
The text was updated successfully, but these errors were encountered:
@akx Thanks! If I submitted a PR with a small example on how to use enumfields directly in a Form, would you accept? I think this is something that could help others in the future.
Of course! There's no such thing as too much documentation!
(Provided the documentation is correct -- documentation-wise, can't think of a worse thing than docs that outright lie, but that usually happens due to rot, so not the point here. :-) )
Django provides Form fields that can be used directly in
Form
objects.Does
django-enumfields
provide anEnumField
that can be used directly in a form like:I can get it to work if I put an
enumfields.EnumIntegerField
into aModel
and then use aModelForm
, but if I just want to create aForm
without aModel
I couldn't figure out how to do this.I'm happy to submit a PR with an example if someone could teach me how to do this. :)
The text was updated successfully, but these errors were encountered: