Commit 917ae4bb authored by Anya Habana's avatar Anya Habana

Converted generic form to ModelForm

parent a71944a8
from django import forms from django.forms import ModelForm
from .models import Department from .models import WidgetUser
class WidgetUserForm(forms.Form): class WidgetUserForm(forms.Form):
first_name = forms.CharField(label='First Name', max_length=100) class Meta:
middle_name = forms.CharField(label='Middle Name', max_length=50) model = WidgetUser
last_name = forms.CharField(label='Last Name', max_length=50) fields = ["first_name", "middle_name", "last_name", "id_num", "email", "department"]
id_num = forms.CharField(label='ID Number', max_length=7, default="") \ No newline at end of file
email = forms.EmailField(label='Email Address', default="")
department = forms.ChoiceField(Department.objects)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment