31 lines
848 B
Python
31 lines
848 B
Python
from django import forms
|
|
from django.forms import ModelForm
|
|
from django.forms.widgets import TextInput
|
|
from .models import Areas
|
|
from django.contrib.auth.models import User
|
|
from django import forms
|
|
|
|
class AreaAddAreaForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
model = Areas
|
|
labels = {
|
|
"name" : "Bereichsname",
|
|
"color" : "Farbe",
|
|
"desc" : "Beschreibung",
|
|
"visible": "Im Organigramm sichtbar"
|
|
|
|
}
|
|
fields = ['name', 'color', 'desc']
|
|
|
|
#def __init__(self, user=None, *args, **kwargs):
|
|
# super().__init__(*args, **kwargs)
|
|
# if(user != None):
|
|
# users_of_agency = User.objects.filter(profile__agency__pk=user.profile.agency.pk)
|
|
# self.fields['usersfield'].queryset = users_of_agency
|
|
|
|
class AjaxForm(forms.ModelForm):
|
|
field = forms.CharField(max_length=200)
|
|
class Meta:
|
|
model = Areas
|
|
fields = ['name', 'color', 'desc'] |