from django import forms

from .models import (
    Contact,
    Note,
    Ticket,
)


class ContactForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(ContactForm, self).__init__(*args, **kwargs)
        for name in ('name', 'address', 'mail', 'url', 'industry'):
            self.fields[name].widget.attrs.update(
                {'class': 'pure-input-2-3'}
            )

    class Meta:
        model = Contact
        fields = (
            "name",
            "address",
            "slug",
            "url",
            "phone",
            "mail",
            "industry",
            "hourly_rate",
        )


class NoteForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(NoteForm, self).__init__(*args, **kwargs)
        for name in ('title', 'description'):
            self.fields[name].widget.attrs.update(
                {'class': 'pure-input-2-3'}
            )

    class Meta:
        model = Note
        fields = (
            "title",
            "description",
        )


class TicketForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(TicketForm, self).__init__(*args, **kwargs)
        for name in ('title', 'description'):
            self.fields[name].widget.attrs.update(
                {'class': 'pure-input-2-3'}
            )

    class Meta:
        model = Ticket
        fields = (
            "title",
            "description",
            "priority",
            "due",
        )

@@ -2,28 +2,57 @@
 rom 
-django import forms%0A
+base.form_utils import (%0A    RequiredFieldForm,%0A)
 %0Afro
@@ -123,35 +123,37 @@
 ContactForm(
-forms.Mod
+RequiredFi
 el
+d
 Form):%0A%0A    
@@ -682,35 +682,37 @@
 ss NoteForm(
-forms.Mod
+RequiredFi
 el
+d
 Form):%0A%0A    
@@ -1097,19 +1097,21 @@
 orm(
-forms.Mod
+RequiredFi
 el
+d
 Form
@@ -1419,32 +1419,56 @@
      fields = (%0A
+            %22priority%22,%0A
             %22tit
@@ -1503,32 +1503,8 @@
 n%22,%0A
-            %22priority%22,%0A
     

Use 'RequiredFieldForm'