77 lines
2.3 KiB
Python
77 lines
2.3 KiB
Python
from django import forms
|
|
from django.utils.translation import ugettext_lazy as _
|
|
from registration.forms import RegistrationForm
|
|
|
|
from django.db import models
|
|
from django.contrib.auth.models import User
|
|
from models import *
|
|
|
|
attrs_dict = { 'class': 'required' }
|
|
|
|
class AuthenticRegistrationForm(RegistrationForm):
|
|
username = forms.RegexField(regex=r'^\w+$',
|
|
max_length=30,
|
|
widget=forms.TextInput(attrs=attrs_dict),
|
|
label=_(u'username'),
|
|
error_messages = {'invalid': _(u'your username must contain only letters, numbers and no spaces')})
|
|
|
|
class AskDecisionForm(forms.Form):
|
|
who = forms.ChoiceField(
|
|
choices = (('User','User'), ('Role','Role')),
|
|
widget = forms.RadioSelect(),
|
|
)
|
|
who_user = forms.ModelChoiceField(
|
|
queryset = User.objects.all(),
|
|
required=False,
|
|
)
|
|
who_role = forms.ModelChoiceField(
|
|
queryset = Role.objects.all(),
|
|
required=False,
|
|
)
|
|
what = forms.ChoiceField(
|
|
choices = (
|
|
('AcsObject','Object'), ('View','View'),
|
|
('User','User'), ('Role','Role'),
|
|
('Action','Action'), ('Activity','Activity'),
|
|
),
|
|
widget = forms.RadioSelect(),
|
|
)
|
|
what_acs_object = forms.ModelChoiceField(
|
|
queryset = AcsObject.objects.all(),
|
|
required=False,
|
|
)
|
|
what_view = forms.ModelChoiceField(
|
|
queryset = View.objects.all(),
|
|
required=False,
|
|
)
|
|
what_user = forms.ModelChoiceField(
|
|
queryset = User.objects.all(),
|
|
required=False,
|
|
)
|
|
what_role = forms.ModelChoiceField(
|
|
queryset = Role.objects.all(),
|
|
required=False,
|
|
)
|
|
what_action = forms.ModelChoiceField(
|
|
queryset = Action.objects.all(),
|
|
required=False,
|
|
)
|
|
what_activity = forms.ModelChoiceField(
|
|
queryset = Activity.objects.all(),
|
|
required=False,
|
|
)
|
|
how = forms.ChoiceField(
|
|
choices = (('Action','Action'), ('Activity','Activity')),
|
|
widget = forms.RadioSelect(),
|
|
)
|
|
how_action = forms.ModelChoiceField(
|
|
queryset = Action.objects.all(),
|
|
required=False,
|
|
)
|
|
how_activity = forms.ModelChoiceField(
|
|
queryset = Activity.objects.all(),
|
|
required=False,
|
|
)
|
|
|
|
|