'Sets allowed values'

def __init__(self, user, queue, agent, *args, **kwargs):

    super(TicketForm, self).__init__(*args, **kwargs)
    self.fields['reference'].required = False
    self.fields['reference'].label = _('Reference')
    self.fields['caller'].queryset = Object.filter_permitted(user, Contact.objects)
    self.fields['caller'].widget.attrs.update({'class': 'autocomplete', 'callback': reverse('identities_ajax_contact_lookup')})
    self.fields['caller'].widget.attrs.update({'popuplink': reverse('identities_contact_add')})
    self.fields['caller'].label = _('Caller')
    self.fields['assigned'].queryset = Object.filter_permitted(user, ServiceAgent.objects, mode='x')
    self.fields['assigned'].label = _('Assigned    to')
    self.fields['assigned'].help_text = ''
    self.fields['assigned'].widget.attrs.update({'class': 'multicomplete', 'callback': reverse('services_ajax_agent_lookup')})
    self.fields['assigned'].widget.attrs.update({'popuplink': reverse('services_agent_add')})
    self.fields['status'].queryset = Object.filter_permitted(user, TicketStatus.objects, mode='x')
    self.fields['status'].label = _('Status')
    self.fields['service'].queryset = Object.filter_permitted(user, Service.objects, mode='x')
    self.fields['service'].label = _('Service')
    self.fields['queue'].queryset = Object.filter_permitted(user, TicketQueue.objects, mode='x')
    self.fields['queue'].label = _('Queue')
    self.fields['sla'].queryset = Object.filter_permitted(user, ServiceLevelAgreement.objects, mode='x')
    self.fields['sla'].label = _('Service    Level    Agreement')
    self.fields['resolution'].label = _('Resolution')
    if ('instance' not in kwargs):
        try:
            self.fields['caller'].initial = user.get_contact().id
        except Exception:
            pass
        if queue:
            self.fields['queue'].initial = queue.id
            if (queue.default_ticket_status and (queue.default_ticket_status in self.fields['status'].queryset)):
                self.fields['status'].initial = queue.default_ticket_status_id
            else:
                try:
                    conf = ModuleSetting.get_for_module('treeio.services', 'default_ticket_status')[0]
                    self.fields['status'].initial = long(conf.value)
                except:
                    pass
            if queue.default_ticket_priority:
                self.fields['priority'].initial = queue.default_ticket_priority
            if queue.default_service:
                self.fields['service'].initial = queue.default_service_id
                try:
                    default_sla = ServiceLevelAgreement.objects.get(service=queue.default_service, default=True)
                    if default_sla:
                        self.fields['sla'].initial = default_sla.id
                except:
                    pass
        else:
            try:
                conf = ModuleSetting.get_for_module('treeio.services', 'default_ticket_status')[0]
                self.fields['status'].initial = long(conf.value)
            except:
                pass
            try:
                conf = ModuleSetting.get_for_module('treeio.services', 'default_ticket_queue')[0]
                self.fields['queue'].initial = long(conf.value)
            except:
                pass
    self.fields['name'].label = _('Name')
    self.fields['name'].widget.attrs.update({'class': 'duplicates', 'callback': reverse('services_ajax_ticket_lookup')})
    self.fields['priority'].label = _('Priority')
    self.fields['priority'].choices = ((5, _('Highest')), (4, _('High')), (3, _('Normal')), (2, _('Low')), (1, _('Lowest')))
    self.fields['urgency'].label = _('Urgency')
    self.fields['urgency'].choices = ((5, _('Highest')), (4, _('High')), (3, _('Normal')), (2, _('Low')), (1, _('Lowest')))
    self.fields['details'].label = _('Details')
    if (not agent):
        del self.fields['caller']
        del self.fields['reference']
        del self.fields['priority']
        del self.fields['status']
        del self.fields['queue']
        del self.fields['sla']
        del self.fields['assigned']
        del self.fields['resolution']
