Exemplo n.º 1
0
 class Meta:
     model = Result
     fields = [
         'variable',
         'unit',
         'processing_level',
         'sampled_medium',
     ]
     widgets = {
         'variable':
         Select2(select2attrs={
             'placeholder': 'Choose the variable',
             **select_2_default_options
         }),
         'unit':
         Select2(select2attrs={
             'placeholder': 'Choose the units',
             **select_2_default_options
         }),
         'processing_level':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the processing level',
                 **select_2_default_options
             }),
         'sampled_medium':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the sampled medium',
                 **select_2_default_options
             })
     }
Exemplo n.º 2
0
 class Meta:
     model = Equipment
     fields = '__all__'
     widgets = {
         'equipment_type':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the equipment type',
                 **select_2_default_options
             }),
         'equipment_model':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the equipment model',
                 **select_2_default_options
             }),
         'equipment_owner':
         Select2(select2attrs={
             'placeholder': 'Choose the owner',
             **select_2_default_options
         }),
         'equipment_vendor':
         Select2(select2attrs={
             'placeholder': 'Choose the vendor',
             **select_2_default_options
         }),
     }
Exemplo n.º 3
0
 class Meta:
     model = InstrumentOutputVariable
     fields = '__all__'
     widgets = {
         'model':
         Select2(select2attrs={
             'placeholder': 'Choose the model',
             **select_2_default_options
         }),
         'variable':
         Select2(select2attrs={
             'placeholder': 'Choose the variable',
             **select_2_default_options
         }),
         'instrument_method':
         Select2(select2attrs={
             'placeholder': 'Choose the method',
             **select_2_default_options
         }),
         'instrument_raw_output_unit':
         Select2(select2attrs={
             'placeholder': 'Choose the units',
             **select_2_default_options
         }),
     }
Exemplo n.º 4
0
 class Meta:
     model = Activity
     exclude = []
     widgets = {
         'comment': Textarea(attrs={'rows': 3}),
         'volunteer1': Select2(select2attrs=settings.SELECT2_ATTRS),
         'volunteer2': Select2(select2attrs=settings.SELECT2_ATTRS),
     }
Exemplo n.º 5
0
class ScorecardListViewSearchForm(forms.ModelForm):
    q = forms.CharField(label=_("Search Query"), required=False)
    year = forms.ChoiceField(label=_("Year"),
                             required=False,
                             widget=Select2(select2attrs={
                                 'width': '170',
                                 'placeholder': _('Year')
                             }),
                             choices=[(x, x) for x in range(2012, 3000)])
    approved = forms.ChoiceField(label=_("Approved"),
                                 required=False,
                                 choices=[(None, ""), (True, _("Yes")),
                                          (False, _("No"))],
                                 widget=Select2(select2attrs={
                                     'width': '170',
                                     'placeholder': _('Approved')
                                 }))
    user__userprofile__position__department = forms.ModelChoiceField(
        label=_("Department"),
        required=False,
        widget=Select2(select2attrs={
            'width': '170',
            'placeholder': _('Department')
        }),
        queryset=Department.objects.all())

    class Meta:
        model = Scorecard
        fields = ['year', 'approved']

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        super(ScorecardListViewSearchForm, self).__init__(*args, **kwargs)
        if self.request:
            self.fields[
                'user__userprofile__position__department'].queryset = Department.objects.filter(
                    customer=self.request.user.userprofile.customer)  # noqa
        self.helper = FormHelper()
        self.helper.form_tag = True
        self.helper.form_method = 'get'
        self.helper.render_required_fields = True
        self.helper.form_show_labels = False
        self.helper.html5_required = True
        self.helper.include_media = False
        self.helper.form_id = 'search-form'
        self.helper.form_class = 'form-inline'
        self.helper.field_template = 'bootstrap3/layout/inline_field.html'
        self.helper.layout = Layout(
            Field('user__userprofile__position__department',
                  css_class="input-sm"),
            Field('approved', css_class="input-sm"),
            Field('year', css_class="input-sm"),
            FieldWithButtons(
                Field('q', css_class="input-sm"),
                Submit('submitBtn', _('Filter'), css_class='btn-sm')),
        )
Exemplo n.º 6
0
 class Meta:
     model = Objective
     fields = [
         'name', 'description', 'strategic_theme', 'parent', 'customer',
         'active'
     ]
     widgets = {
         'strategic_theme': Select2({'width': "100%"}),
         'parent': Select2({'width': "100%"})
     }
Exemplo n.º 7
0
 class Meta:
     model = ReferenceMaterialValue
     exclude = ['citation']
     widgets = {
         'variable':
         Select2(select2attrs={
             'placeholder': 'Choose the variable',
             **select_2_default_options
         }),
         'unit':
         Select2(select2attrs={
             'placeholder': 'Choose the units',
             **select_2_default_options
         }),
     }
Exemplo n.º 8
0
class TextPhraseForm(forms.ModelForm):
    language = forms.ChoiceField(
        choices=TEXT_PHRASE_LANGUAGES(), widget=Select2())

    class Meta:
        model = TextPhrase
        fields = '__all__'
Exemplo n.º 9
0
 class Meta:
     model = Site
     fields = '__all__'
     widgets = {
         'site_type':
         Select2(select2attrs={
             'placeholder': 'Choose the site type',
             **select_2_default_options
         }),
         'spatial_reference':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the spatial reference',
                 **select_2_default_options
             })
     }
Exemplo n.º 10
0
 class Meta:
     model = SamplingFeature
     fields = '__all__'
     widgets = {
         'sampling_feature_geo_type':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the site\'s geo-type',
                 **select_2_default_options
             }),
         'elevation_datum':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the elevation datum',
                 **select_2_default_options
             }),
     }
Exemplo n.º 11
0
 class Meta:
     model = Department
     fields = [
         'name',
         'parent',
         'manager',
         'description',
         'customer',
         'active'
     ]
     field_classes = {
         'manager': UserModelChoiceField
     }
     widgets = {
         'manager': Select2({'width': "100%"}),
         'parent': Select2({'width': "100%"})
     }
Exemplo n.º 12
0
 class Meta:
     model = Method
     fields = '__all__'
     widgets = {
         'method_type':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the method type',
                 **select_2_default_options
             }),
         'organization':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the organization',
                 **select_2_default_options
             }),
     }
Exemplo n.º 13
0
 class Meta:
     model = Scorecard
     fields = ['approved', 'approved_by', 'approval_note']
     widgets = {
         'approval_note': MiniTextarea(),
         'approved_by': Select2({'width': "100%"})
     }
     field_classes = {'approved_by': UserModelChoiceField}
Exemplo n.º 14
0
 class Meta:
     model = Organization
     fields = '__all__'
     widgets = {
         'organization_type':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the organization type',
                 **select_2_default_options
             }),
         'parent_organization':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the parent organization',
                 **select_2_default_options
             }),
     }
Exemplo n.º 15
0
 class Meta:
     model = UserProfile
     fields = [
         'position',
         'role',
         'active'
     ]
     widgets = {
         'position': Select2({'width': "100%"})
     }
Exemplo n.º 16
0
 class Meta:
     model = Position
     fields = [
         'name',
         'parent',
         'department',
         'supervisor',
         'description',
         'customer',
         'active'
     ]
     field_classes = {
         'supervisor': UserModelChoiceField
     }
     widgets = {
         'department': Select2({'width': "100%"}),
         'supervisor': Select2({'width': "100%"}),
         'parent': Select2({'width': "100%"})
     }
Exemplo n.º 17
0
 class Meta:
     model = ReferenceMaterial
     exclude = [
         'reference_material_expiration_date', 'sampling_feature',
         'external_identifiers'
     ]
     widgets = {
         'reference_material_medium':
         Select2(select2attrs={
             'placeholder': 'Choose the medium',
             **select_2_default_options
         }),
         'reference_material_organization':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the organization ',
                 **select_2_default_options
             }),
     }
Exemplo n.º 18
0
    def __init__(self, *args, **kwargs):
        super(GistPluginAdminForm, self).__init__(*args, **kwargs)

        def get_choices():
            values = GistPluginModel.objects.values_list('gist_user', flat=True).distinct().order_by('gist_user')
            return [{'id': str(value), 'text': str(value)} for value in values]

        self.fields['gist_user'].widget = Select2(select2attrs={
            'data': get_choices()
        }, )
Exemplo n.º 19
0
 class Meta:
     model = EquipmentModel
     fields = '__all__'
     widgets = {
         'model_manufacturer':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the model manufacturer',
                 **select_2_default_options
             }),
     }
Exemplo n.º 20
0
 class Meta:
     model = CalibrationStandard
     fields = ['reference_material']
     widgets = {
         'reference_material':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the reference material',
                 **select_2_default_options
             }),
     }
Exemplo n.º 21
0
 class Meta:
     model = CalibrationReferenceEquipment
     fields = '__all__'
     widgets = {
         'equipment':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the reference equipment',
                 **select_2_default_options
             }),
     }
Exemplo n.º 22
0
 class Meta:
     model = Affiliation
     fields = '__all__'
     widgets = {
         'organization':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the affliated organization',
                 **select_2_default_options
             }),
     }
Exemplo n.º 23
0
 class Meta:
     model = EquipmentUsed
     fields = ['equipment']
     widgets = {
         'equipment':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the equipment used',
                 **select_2_default_options
             }),
     }
Exemplo n.º 24
0
 class Meta:
     model = CalibrationAction
     fields = '__all__'
     widgets = {
         'instrument_output_variable':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the instrument output variable',
                 **select_2_default_options
             }),
     }
Exemplo n.º 25
0
 class Meta:
     model = ActionBy
     fields = '__all__'
     widgets = {
         'affiliation':
         Select2(
             select2attrs={
                 'placeholder': 'Choose the affiliated person',
                 **select_2_default_options
             }),
     }
Exemplo n.º 26
0
class NonInstrumentEquipmentUsedForm(forms.ModelForm):
    equipment = forms.ModelChoiceField(
        queryset=Equipment.objects.non_instruments(),
        widget=Select2(select2attrs={
            'placeholder': 'Choose the equipment used',
            **select_2_default_options
        }))

    class Meta:
        model = EquipmentUsed
        fields = ['equipment']
Exemplo n.º 27
0
 class Meta:
     model = Scorecard
     fields = [
         'name',
         'year',
         'description',
         'user',
         'customer',
         'active',
     ]
     widgets = {'name': MiniTextarea(), 'user': Select2({'width': "100%"})}
     field_classes = {'user': UserModelChoiceField}
Exemplo n.º 28
0
class RelatedDeploymentRetrievalForm(forms.ModelForm):
    related_action = forms.ModelChoiceField(
        queryset=Action.objects.deployments(),
        widget=Select2(select2attrs={
            'placeholder': 'Choose the deployment',
            **select_2_default_options
        }),
        label='Deployment')

    class Meta:
        model = RetrievalRelatedAction
        exclude = ['relationship_type']
Exemplo n.º 29
0
class SiteVisitFeatureActionForm(forms.ModelForm):
    sampling_feature = forms.ModelChoiceField(
        queryset=SamplingFeature.objects.all(),
        required=False,
        widget=Select2(select2attrs={
            'placeholder': 'Choose the site',
            **select_2_default_options
        }))

    class Meta:
        model = FeatureAction
        fields = ['sampling_feature']
Exemplo n.º 30
0
class ProductForm(forms.ModelForm):
    language = forms.ChoiceField(
        choices=ALL_LANGUAGES,
        widget=Select2(),
        label=_('Language'),
    )

    class Meta:
        model = Product
        fields = '__all__'
        labels = {
            'tags': _('Tags'),
        }