예제 #1
0
class ContentSearchForm(forms.Form):
    """Form for searching through content."""
    id = forms.IntegerField(label="ID:", required=False)
    title = forms.CharField(label="Title:", required=False, max_length=100)
    after = forms.DateField(label="Created After:",
                            required=False,
                            widget=forms.TextInput(attrs={'type': 'date'}))
    before = forms.DateField(label="Created Before:",
                             required=False,
                             widget=forms.TextInput(attrs={'type': 'date'}))
    authors = forms.ModelMultipleChoiceField(
        label="Authors:",
        queryset=models.User.objects.all(),
        required=False,
        widget=autocomplete.ModelSelect2Multiple(
            url="staff:autocomplete:users"))
    # type = forms.ModelMultipleChoiceField(label=)

    tags = None  # STUB_TAG
예제 #2
0
class PostAdminForm(forms.ModelForm):
    desc = forms.CharField(widget=forms.Textarea, label='摘要', required=False)
    category = forms.ModelChoiceField(
        queryset=Category.objects.all(),
        widget=autocomplete.ModelSelect2(url='category-autocomplete'),
        label='分类',
    )
    tag = forms.ModelMultipleChoiceField(
        queryset=Tag.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(url='tag-autocomplete'),
        label='标签',
    )

    # content = forms.CharField(widget=CKEditorUploadingWidget(), label='正文', required=False)

    class Meta:
        model = Post
        fields = ('category', 'tag', 'title', 'desc',
                  'content', 'status')
예제 #3
0
    class Meta:
        model = DataAccess
        fields = ['name',
                  'storage_type',
                  'unique_id',
                  'shareable_link',
                  'filepaths',
                  'metadata',
                  'steward_email',
                  'access_instructions',
                  'public',
                  ]

        widgets = {'metadata': autocomplete.ModelSelect2Multiple(
                                url='datacatalog:autocomplete-dataset'
                                ),
                   'project': autocomplete.ModelSelect2(
                                url='datacatalog:autocomplete-project-byuser'
                                ),
        }
예제 #4
0
class SOP(GBEXModelBase):
	Summary = models.TextField(blank=True, null=True)
	Tags = models.ManyToManyField(SOPTag, blank=True)
	SOP_file = ResumableFileField(blank=True, null=True, upload_to=get_upload_path, max_length=500)

	menu_label = menu_label
	order = [*default_order, 'Summary', 'Tags', 'SOP_file']
	symbol = "SOP"
	col_display_func_dict = {
		'Tags': lambda item: ", ".join(ab.name for ab in item.Tags.all()) if item.Tags.all() else "",
		'SOP_file': lambda
			item: f"<a href='/downloads/{item.SOP_file}'>{str(item.SOP_file).split('/')[-1]}</a>",

	}
	widgets = {
		**default_widgets,
		'Tags': autocomplete.ModelSelect2Multiple(url=reverse_lazy('SOPTag-autocomplete')),
	}

	col_html_string = ['SOP_file',]
예제 #5
0
 class Meta:
     model = Troupe
     fields = [
         'contact',
         'name',
         'label',
         'membership',
         'homepage',
         'bio',
         'experience',
         'awards',
         'upload_img',
         'festivals',
     ]
     help_texts = persona_help_texts
     labels = troupe_labels
     widgets = {
         'membership':
         autocomplete.ModelSelect2Multiple(url='persona-autocomplete')
     }
예제 #6
0
파일: forms.py 프로젝트: oneirism/reverie
class CampaignEntryForm(forms.ModelForm):
    """ A reverie Campaign form. """
    description = MarkdownxFormField(
        widget=ReverieMarkdownWidget()
    )

    players = forms.ModelMultipleChoiceField(
        queryset=User.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(url='campaign:player_autocomplete', forward=['game_master']),
        required=False
    )

    class Meta:
        model = Campaign

        fields = ['name', 'image', 'cropping', 'description', 'players', 'public', 'tagline']

        widgets = {
            'image': ImageCropWidget,
        }
예제 #7
0
    class Meta:
        model = Category
        fields = forms.ALL_FIELDS
        widgets = {
            "f_bool": AdminSwitchInput,
            "f_tags1": AdminCheckboxSelectMultiple,
            "f_date2": forms.SelectDateWidget,
            "f_hidden1": forms.HiddenInput,
            "f_hidden2": forms.HiddenInput,
            "f_hidden3": forms.HiddenInput,
            "f_pass": forms.PasswordInput,
            "f_file": forms.FileInput,

            "dal_fk": autocomplete.ModelSelect2(
                url="app:ac-tag"
            ),
            "dal_m2m": autocomplete.ModelSelect2Multiple(
                url="app:ac-tag"
            ),
        }
예제 #8
0
    class Meta:
        model = Property
        fields = (
            'owner',
            'is_active',
            'authorized',
            'pending',
            'trees',
            'trees_location',
            'avg_nb_required_pickers',
            'public_access',
            'trees_accessibility',
            'neighbor_access',
            'compost_bin',
            'ladder_available',
            'ladder_available_for_outside_picks',
            'harvest_every_year',
            'number_of_trees',
            'approximative_maturity_date',
            'fruits_height',
            'street_number',
            'street',
            'complement',
            'postal_code',
            'publishable_location',
            'neighborhood',
            'city',
            'state',
            'country',
            # 'longitude',
            # 'latitude',
            # 'geom',
            'additional_info',
        )

        widgets = {
            'owner': autocomplete.ModelSelect2('actor-autocomplete'),
            'trees': autocomplete.ModelSelect2Multiple('tree-autocomplete'),
            'additional_info': forms.Textarea(),
            'avg_nb_required_pickers': forms.NumberInput()
        }
예제 #9
0
class TimelinegraphForm(forms.ModelForm):
    date_marked = forms.ModelChoiceField(queryset=Property.objects.all(), required=False,
                                         widget=autocomplete.ModelSelect2(url='property_datedmarked',
                                                                          forward=('repository_query',
                                                                                             'domain_subject')))
    faceted_search = forms.ModelMultipleChoiceField(queryset=Property.objects.all(), required=False,
                                                    widget=autocomplete.ModelSelect2Multiple(url='property_faceted',
                                                                                             forward=(
                                                                                             'repository_query',
                                                                                             'domain_subject')))

    def __init__(self, *args, **kwargs):
        super(TimelinegraphForm, self).__init__(*args, **kwargs)
        self.fields['date_marked'].help_text = 'Please select the option which is datetime type.'
        self.fields['faceted_search'].help_text = 'Please make a blank if you want to get all values of filter.'

    class Meta:
        model = Timelinegraph
        fields = ('__all__')
        ordering = ['property_path']
        extra_kwargs = {'faceted_search': {'allow_blank': True}}
예제 #10
0
 class Meta:
     model = Post
     fields = (
         'title',
         'author',
         'body',
         'publish',
         'tags',
     )
     widgets = {
         'tags':
         autocomplete.ModelSelect2Multiple(url='tags-autocomplete',
                                           attrs={
                                               'data-placeholder':
                                               _('Select Tags'),
                                               'data-multiple':
                                               'multiple',
                                               'style':
                                               'width: 625px',
                                           })
     }
예제 #11
0
 class Meta:
     model = Book
     fields = [
         'title', 'authors', 'pub_date', 'isbn', 'pages_num', 'cover',
         'language'
     ]
     widgets = {
         'pub_date':
         forms.DateInput(format=('%Y-%m-%d'),
                         attrs={
                             'type': 'date',
                             'max': date.today
                         }),
         'pages_num':
         forms.NumberInput(attrs={'max': 9999}),
         'authors':
         autocomplete.ModelSelect2Multiple(url='author-autocomplete',
                                           forward=('authors', )),
         'language':
         autocomplete.ModelSelect2(url='language-autocomplete'),
     }
예제 #12
0
파일: forms.py 프로젝트: JakobGM/WikiLinks
class ExamsSearchForm(forms.Form):
    """Form used for searching for exam archive for specific course."""

    # Using ModelMultipleChoiceField here even though only one course is
    # intendede to be submitted at a time. The multiple choice styling looks
    # better in the frontend.
    course = forms.ModelMultipleChoiceField(
        label=_('F*g'),
        queryset=Course.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(
            url='examiner:course_autocomplete',
            attrs={
                'data-placeholder': _('Fagkode/fagnavn'),

                # Only trigger autocompletion after 1 character has been typed
                'data-minimum-input-length': 1,
            },
        ))

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_id = 'search-form'
        self.helper.form_method = 'post'

        # Post to same page
        self.helper.form_action = ''

        # Hide field labels
        self.helper.form_show_labels = False

        self.helper.layout = Layout(
            Fieldset(
                _('Tast inn f*g'),
                Field(
                    'course',
                    onchange='search();',
                    css_class='form-control-lg',
                ),
            ), )
예제 #13
0
파일: forms.py 프로젝트: acdh-oeaw/gtrans
 class Meta:
     model = SkosConcept
     fields = "__all__"
     widgets = {
         'other_label': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skoslabel-autocomplete'
         ),
         'skos_broader': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'skos_narrower': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'skos_related': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'skos_broadmatch': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'skos_exactmatch': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'skos_closematch': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconcept-autocomplete'),
         'scheme': autocomplete.ModelSelect2Multiple(
             url='vocabs-ac:skosconceptscheme-autocomplete'
         )
     }
예제 #14
0
    class Meta:
        model = Gallery
        fields = [
            'gid', 'token', 'title', 'title_jpn', 'tags', 'gallery_container', 'magazine',
            'category', 'uploader', 'comment', 'posted', 'filecount', 'filesize', 'expunged',
            'hidden', 'fjord', 'provider', 'reason', 'thumbnail_url', 'thumbnail'
        ]
        widgets = {
            'gid': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'provider': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'token': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'title': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'title_jpn': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'gallery_container': autocomplete.ModelSelect2(
                url='gallery-select-autocomplete',
                attrs={'size': 1, 'data-placeholder': 'Gallery', 'class': 'form-control', 'data-width': '100%'}),
            'magazine': autocomplete.ModelSelect2(
                url='gallery-select-autocomplete',
                attrs={'size': 1, 'data-placeholder': 'Gallery', 'class': 'form-control', 'data-width': '100%'}),
            'tags': autocomplete.ModelSelect2Multiple(
                url='tag-pk-autocomplete',
                attrs={'data-placeholder': 'Tag name', 'class': 'form-control'}
            ),
            'category': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'uploader': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'comment': forms.widgets.Textarea(attrs={'class': 'form-control'}),
            'posted': forms.DateInput(attrs={'class': 'form-control mr-sm-1', 'type': 'date', 'size': 9}),
            'filecount': forms.widgets.NumberInput(attrs={'class': 'form-control'}),
            'filesize': forms.widgets.NumberInput(attrs={'class': 'form-control'}),
            'expunged': forms.widgets.CheckboxInput(attrs={'class': 'form-control'}),
            'hidden': forms.widgets.CheckboxInput(attrs={'class': 'form-control'}),
            'fjord': forms.widgets.CheckboxInput(attrs={'class': 'form-control'}),
            'reason': forms.widgets.TextInput(attrs={'class': 'form-control'}),
            'thumbnail_url': forms.widgets.URLInput(attrs={'class': 'form-control'}),
            'thumbnail': forms.widgets.ClearableFileInput(attrs={'class': 'form-control'}),
        }

        help_texts = {
            'thumbnail': 'If this field is empty, the thumbnail will be fetched from the thumbnail URL',
        }
예제 #15
0
    class Meta:
        model = Student
        fields = ('cv_hard_skills', 'cv_soft_skills', 'cv_programming_languages',\
                  'cv_projects', 'cv_volunteering', 'cv_working', 'cv_summary',)
        labels = {
            'cv_hard_skills': _('Hard skills:'),
            'cv_soft_skills': _('Soft skills:'),
            'cv_programming_languages': _('Programming languages:'),
            'cv_summary': _('Summary:'),
            'cv_projects': _('Projects:'),
            'cv_volunteering': _('Volunteering experience:'),
            'cv_working': _('Working experience:'),
        }
        widgets = {
            'cv_hard_skills':
            autocomplete.ModelSelect2Multiple(url='cv-hard-autocomplete'),
            'cv_soft_skills':
            autocomplete.ModelSelect2Multiple(url='cv-soft-autocomplete'),
            'cv_programming_languages':
            autocomplete.ModelSelect2Multiple(url='cv-plang-autocomplete'),
            'cv_projects':
            autocomplete.ModelSelect2Multiple(url='projects-autocomplete'),
            'cv_volunteering':
            autocomplete.ModelSelect2Multiple(url='volunteer-autocomplete'),
            'cv_working':
            autocomplete.ModelSelect2Multiple(url='working-autocomplete'),
            'cv_summary':
            forms.Textarea(attrs={'rows': 3}),
        }

        def __init__(self, *args, **kwargs):
            super(CvForm, self).__init__(*args, **kwargs)
            self.fields[
                'cv_programming_languages'].queryset = Skill.objects.filter(
                    skill_type="programming")
            self.fields["cv_soft_skills"].queryset = Skill.objects.filter(
                skill_type="soft")
            self.fields["cv_hard_skills"].queryset = Skill.objects.filter(
                skill_type="hard")
            self.fields["cv_projects"].queryset = Project.objects.filter(
                collaborators=self.request.user)
            self.fields[
                "cv_volunteering"].queryset = VolunteerExperience.objects.filter(
                    user=self.request.user)
            self.fields[
                "cv_working"].queryset = WorkingExperience.objects.filter(
                    user=self.request.user)
예제 #16
0
class GearArticleForm(forms.ModelForm):
    name = forms.CharField(label="Article Title")
    file = forms.FileField(
        required=False,
        help_text=
        "You can optionally attach your article or supporting documents",
    )
    authors = forms.ModelMultipleChoiceField(
        queryset=User.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(url="users:autocomplete",
                                                 forward=(forward.Const(
                                                     "true", "chapter"), )),
    )

    class Meta:
        model = GearArticle
        fields = [
            "name",
            "authors",
            "article",
            "file",
        ]
예제 #17
0
파일: forms.py 프로젝트: MarZab/parladata
class MembershipForm(forms.ModelForm):
    """Form for debuging memberships."""

    post = forms.ModelChoiceField(
        queryset=Post.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(url='post-autocomplete'))

    class Meta:
        model = Membership
        fields = ('__all__')
        widgets = {
            'person': autocomplete.ModelSelect2(url='person-autocomplete'),
        }

    def __init__(self, *args, **kwargs):
        super(MembershipForm, self).__init__(*args, **kwargs)
        # add_related_field_wrapper(self, 'post')
        self.fields["post"].required = False

    def save(self, *args, **kwargs):
        instance = super(MembershipForm, self).save(commit=False)
        return instance
예제 #18
0
class CritereForm(forms.ModelForm):

    champs = forms.ModelMultipleChoiceField(
        queryset=Champ.objects.all(),
        widget=autocomplete.ModelSelect2Multiple())

    class Meta:
        model = Critere
        fields = ('libelle_critere', 'champs')
        widgets = {
            'libelle_critere': forms.TextInput(),
        }

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'post'
        self.helper.layout = Layout(
            Row(Column('libelle_critere',
                       css_class='form-group col-md-6 mb-0'),
                Column('champs', css_class='form-group col-md-6 mb-0'),
                css_class='form-row'), Submit('submit', 'Enregistrer'))
 class Meta:
     model = StudySample
     fields = (
         'study',
         'sample_name',
         'studyfactor',
         'organism',
         'organism_part',
         'sampletype',
     )
     widgets = {
         'study':
         autocomplete.ModelSelect2(url='study-autocomplete'),
         'organism':
         autocomplete.ModelSelect2(url='organism-autocomplete'),
         'organism_part':
         autocomplete.ModelSelect2(url='organismpart-autocomplete'),
         'studyfactor':
         autocomplete.ModelSelect2Multiple(url='studyfactor-autocomplete'),
         'sampletype':
         autocomplete.ModelSelect2(url='sampletype-autocomplete'),
     }
예제 #20
0
    class Meta:
        model = RetentionRequest
        fields = ['name',
                  'project',
                  'milestone',
                  'milestone_date',
                  'milestone_pointer',
                  'to_archive',
                  'methodfile',
                  'comments',
                  ]

        widgets = {
            'project':autocomplete.ModelSelect2(
                    url='datacatalog:autocomplete-project-byuser'
            ),
            'to_archive': autocomplete.ModelSelect2Multiple(
                    url='datacatalog:autocomplete-access-byproject',
                    forward=['project',],
            ),
            'milestone_date': DateInput(),
        }
예제 #21
0
class FileFilter(django_filters.FilterSet):
    filename = django_filters.CharFilter(label='Имя файла содержит',
                                         lookup_expr='icontains')
    project = django_filters.ModelChoiceFilter(
        queryset=Project.objects.all(),
        widget=autocomplete.ModelSelect2(
            url='auto_project',
            attrs={
                # Set some placeholder
                'data-placeholder': 'Наберите начало тега ...',
                # Only trigger autocompletion after 3 characters have been typed
                'title': 'Проект'
            },
        ),
    )
    file_type = django_filters.ModelChoiceFilter(
        queryset=FileType.objects.all(),
        widget=autocomplete.ModelSelect2(
            url='auto_types',
            attrs={
                # Set some placeholder
                'data-placeholder': 'Наберите начало тега ...',
                # Only trigger autocompletion after 3 characters have been typed
                'title': 'Типы файлов'
            },
        ),
    )
    tags = django_filters.ModelMultipleChoiceFilter(
        queryset=Tag.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(
            url='autocomlete_tags',
            attrs={
                # Set some placeholder
                'data-placeholder': 'Наберите начало тега ...',
                # Only trigger autocompletion after 3 characters have been typed
                'data-minimum-input-length': 3,
                'title': 'Теги'
            },
        ))
예제 #22
0
 class Meta:
     model = Eintrag
     fields = "__all__"
     widgets = {
         'band':
         autocomplete.ModelSelect2(url='entities:band-autocomplete'),
         'bearbeiter':
         autocomplete.ModelSelect2(url='entities:bearbeiter-autocomplete'),
         'klient_institution':
         autocomplete.ModelSelect2Multiple(
             url='entities:institution-autocomplete'),
         'einbringer_ort':
         autocomplete.ModelSelect2(url='entities:ort-autocomplete'),
         'einbringer_berufsgruppe':
         autocomplete.ModelSelect2(
             url='vocabs-ac:skosconcept-autocomplete'),
         'einbringer_geschlecht':
         autocomplete.ModelSelect2(
             url=
             '../../../vocabs-ac/skos-constraint-ac/?scheme=einbringer_geschlecht'
         ),
         'klient_person':
         autocomplete.ModelSelect2Multiple(
             url='entities:person-autocomplete'),
         'eingangsart':
         autocomplete.ModelSelect2(
             url='vocabs-ac:skosconcept-autocomplete'),
         'geschaeftsbereich':
         autocomplete.ModelSelect2(
             url='vocabs-ac:skosconcept-autocomplete'),
         'vorakten_erfasst':
         autocomplete.ModelSelect2Multiple(
             url='entries:eintrag-autocomplete'),
         'erledigungs_art':
         autocomplete.ModelSelect2(
             url='vocabs-ac:skosconcept-autocomplete'),
         'erledigende_institution':
         autocomplete.ModelSelect2Multiple(
             url='entities:institution-autocomplete'),
         'erledigende_person':
         autocomplete.ModelSelect2Multiple(
             url='entities:person-autocomplete'),
         'nachakten_erfasst':
         autocomplete.ModelSelect2Multiple(
             url='entries:eintrag-autocomplete'),
     }
예제 #23
0
class TowersDataVForm(forms.Form):
    tower = forms.ModelChoiceField(queryset=Tower.objects.all(),
                                   required=False,
                                   widget=autocomplete.ModelSelect2(
                                       url='tower-autocomplete',
                                       attrs={'style': 'width:100%'}))

    begin_date_search = forms.DateTimeField(input_formats=["%Y-%m-%d %H:%M"],
                                            widget=DatePickerInput(
                                                format="%Y-%m-%d %H:%M",
                                                attrs={'autocomplete': 'off'}))
    end_date_search = forms.DateTimeField(input_formats=["%Y-%m-%d %H:%M"],
                                          widget=DatePickerInput(
                                              format="%Y-%m-%d %H:%M",
                                              attrs={'autocomplete': 'off'}))

    begin_date = forms.DateTimeField(input_formats=["%Y-%m-%d %H:%M:%S"],
                                     widget=DatePickerInput(
                                         format="%Y-%m-%d %H:%M:%S",
                                         attrs={'autocomplete': 'off'}))
    end_date = forms.DateTimeField(input_formats=["%Y-%m-%d %H:%M:%S"],
                                   widget=DatePickerInput(
                                       format="%Y-%m-%d %H:%M:%S",
                                       attrs={'autocomplete': 'off'}))

    equipments = forms.ModelMultipleChoiceField(
        queryset=PeriodConfiguration.objects.all(),
        required=True,
        widget=autocomplete.ModelSelect2Multiple(
            url='tower-conf_periods-autocomplete',
            forward=['tower', 'begin_date', 'end_date'],
            attrs={'style': 'width:100%'}))

    status = forms.ModelChoiceField(queryset=Status.objects.all(),
                                    required=True,
                                    widget=autocomplete.ModelSelect2(
                                        url='status-autocomplete',
                                        attrs={'style': 'width:100%'}))
예제 #24
0
 def __init__(self, *args, **kwargs):
     assert 'activity' in kwargs, "Kwarg 'activity' is required."
     assert 'user' in kwargs, "Kwarg 'user' is required."
     self.activity = kwargs.pop("activity", None)
     self.user = kwargs.pop("user", None)
     super(OrderForm, self).__init__(*args, **kwargs)
     episodes = self.activity.episode_set.all()
     if episodes.count() == 1:
         initial = episodes.first().pk
     else:
         initial = None
     self.fields['episode'] = forms.ModelChoiceField(
         episodes,
         label=u"الموعد",
         empty_label=u"اختر موعدًا ",
         initial=initial)
     for category in Category.objects.all():
         self.fields["count_%s" % category.pk] = forms.IntegerField(
             label=category.ar_label,
             required=False,
             initial=0,
             min_value=0)
         if category.direct_entry:
             self.fields['students_%s' %
                         category.pk] = forms.ModelMultipleChoiceField(
                             widget=autocomplete.ModelSelect2Multiple(
                                 url='niqati:niqati-user-autocomplete',
                                 attrs={
                                     'data-placeholder': 'أَضف اسمًا',
                                     'data-html': 'true',
                                 }),
                             label=u"طلاب ال" + category.ar_label,
                             queryset=User.objects.all(),
                             required=False)
             self.fields["count_%s" % category.pk].widget.attrs = {
                 'data-direct-entry': 'true',
                 'data-category': category.pk
             }
예제 #25
0
    class Meta:
        model = Property
        fields = (
            'pending_contact_name',
            'pending_contact_phone',
            'pending_contact_email',
            'pending_recurring',
            'authorized',
            'trees',
            'number_of_trees',
            'approximative_maturity_date',
            'trees_location',
            'trees_accessibility',
#            'public_access',
            'neighbor_access',
            'compost_bin',
            'ladder_available',
            'ladder_available_for_outside_picks',
            'harvest_every_year',
            'avg_nb_required_pickers',
            'fruits_height',
            'street_number',
            'street',
            'complement',
            'postal_code',
            'neighborhood',
            'city',
            'state',
            'country',
            'additional_info',
            'pending_newsletter',
        )

        widgets = {
            'trees': autocomplete.ModelSelect2Multiple(
                'tree-autocomplete'
            )
        }
예제 #26
0
class SkillsForm(happyforms.ModelForm):
    skills = SkillCreateField(required=False,
                              queryset=Skill.objects.all(),
                              widget=autocomplete.ModelSelect2Multiple(
                                  url='groups:skills-autocomplete'))

    def __init__(self, *args, **kwargs):
        super(SkillsForm, self).__init__(*args, **kwargs)
        self.fields['skills'].help_text = (
            u'Start typing to add a skill (example: Python, '
            u'javascript, Graphic Design, User Research)')

    def save(self, *args, **kwargs):
        """Save the data to profile."""
        self.instance.set_membership(Skill, self.cleaned_data['skills'])
        super(SkillsForm, self).save(*args, **kwargs)

    class Meta:
        model = UserProfile
        fields = (
            'privacy_skills',
            'skills',
        )
예제 #27
0
class TeamDjangoAdminForm(forms.ModelForm):
    """ A form used for *superusers* to manage teams in the admin page. """
    team_admin = forms.ModelChoiceField(
        queryset=Player.objects.all(),
        widget=autocomplete.ModelSelect2(url='player-autocomplete'),
        label="Admin", required=False
    )

    player_autocomplete = forms.ModelMultipleChoiceField(
        queryset=Player.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(
            url='player-autocomplete'),
        label="Players", required=False
    )

    class Meta:
        model = Team
        fields = ('teamAlias', 'teamID', 'team_admin', 'player_autocomplete',
                  'is_active')
        widgets = {'team_admin': autocomplete.ModelSelect2(
                        url='player-autocomplete'),
                   'players': autocomplete.ModelSelect2Multiple(
                       url='player-autocomplete')}
예제 #28
0
 class Meta:
     model = Person
     fields = "__all__"
     widgets = {
         'belongs_to_institution': autocomplete.ModelSelect2(
             url='entities-ac:institution-autocomplete'),
         'place_of_birth': autocomplete.ModelSelect2(
             url='entities-ac:place-autocomplete'),
         'alt_names': autocomplete.ModelSelect2Multiple(
             url='entities-ac:altname-autocomplete'),
         'part_of_bomber': autocomplete.ModelSelect2(
             url='entities-ac:personpartofbomber-autocomplete'),
         'rank': autocomplete.ModelSelect2(
             url='entities-ac:personrank-autocomplete'),
         'destiny_stated': autocomplete.ModelSelect2(
             url='entities-ac:persondestinystated-autocomplete'),
         'destiny_checked': autocomplete.ModelSelect2(
             url='entities-ac:persondestinychecked-autocomplete'),
         'mia': autocomplete.ModelSelect2(
             url='entities-ac:personmia-autocomplete'),
         'nation': autocomplete.ModelSelect2(
             url='/vocabs-ac/specific-concept-ac/nationality'),
     }
예제 #29
0
 class Meta:
     model = FacebookGame
     fields = (
         'title',
         'body',
         'banner_image',
         'buzz',
         'age_categories',
         'publish',
         'tags',
     )
     widgets = {
         'tags':
         autocomplete.ModelSelect2Multiple(url='tags-autocomplete',
                                           attrs={
                                               'data-placeholder':
                                               _('Select Tags'),
                                               'data-multiple':
                                               'multiple',
                                               'style':
                                               'width: 625px',
                                           })
     }
예제 #30
0
파일: forms.py 프로젝트: codepanda64/MNOLMS
class StationForm(forms.ModelForm):
    class Meta:
        model = Station
        fields = (
            'network',
            'code',
            'en_name',
            'zh_name',
            'longitude',
            'latitude',
            'altitude',
            'status',
            'seismological_equipments',
            'describe',
            'location',
        )

    seismological_equipments = forms.ModelMultipleChoiceField(
        label='测震仪器列表',
        queryset=SeismologicalEquipmentEntity.objects.all(),
        required=False,
        widget=autocomplete.ModelSelect2Multiple(
            url=reverse_lazy('seis:seisentity-autocomplete')))