Пример #1
0
        class Meta:
            model = Course
            fields = [
                'id',
                'course_code',
                'name',
                'materials',
                'teachers',
                'updated_associations',
                'updated_teacher',
                'calendar_year',
                'coordinator',
                'period',
                *(['study_year'] if course_id is None else []),
            ]

            widgets = {
                'id':
                HiddenInput(),
                "materials":
                AddAnotherWidgetWrapper(
                    ModelSelect2MultipleWidget(
                        queryset=MSP.objects.all(),
                        search_fields=[
                            "mspline__materials__name__icontains",
                            "mspline__materials__book__ISBN__icontains",
                            "mspline__materials__book__author__icontains",
                            "mspline__materials__book__year_of_publishing__icontains",
                            "mspline__materials__scientificarticle__DOI__icontains",
                            "mspline__materials__scientificarticle__author__icontains",
                            "mspline__materials__scientificarticle__year_of_publishing__icontains",
                        ]),
                    reverse_lazy('boecie:msp.create',
                                 kwargs={'course': course_id}))
                if course_id else MultipleHiddenInput(),
                'teachers':
                AddAnotherWidgetWrapper(
                    ModelSelect2MultipleWidget(model=Teacher,
                                               search_fields=[
                                                   'titles__icontains',
                                                   'initials__icontains',
                                                   'first_name__icontains',
                                                   'surname_prefix__icontains',
                                                   'last_name__icontains',
                                                   'email__icontains'
                                               ]),
                    reverse_lazy('boecie:teacher.create')),
                'coordinator':
                AddAnotherWidgetWrapper(
                    ModelSelect2Widget(model=Teacher,
                                       search_fields=[
                                           'titles__icontains',
                                           'initials__icontains',
                                           'first_name__icontains',
                                           'surname_prefix__icontains',
                                           'last_name__icontains',
                                           'email__icontains'
                                       ]),
                    reverse_lazy('boecie:teacher.create')),
            }
Пример #2
0
        class Meta:
            model = CourseStudy
            fields = [
                'study_year',
            ] + (['course'] if has_course_field else ['study'])

            if has_course_field:
                widgets = {
                    'course':
                    AddAnotherWidgetWrapper(
                        ModelSelect2Widget(model=Course,
                                           search_fields=[
                                               'name__icontains',
                                               'course_code__icontains'
                                           ]), reverse_lazy('boecie:index')),
                    'study':
                    HiddenInput(),
                }
            else:
                widgets = {
                    'study':
                    AddAnotherWidgetWrapper(
                        ModelSelect2Widget(model=Study,
                                           search_fields=[
                                               'name__icontains',
                                               'slug__icontains'
                                           ]), reverse_lazy('boecie:index')),
                    'course':
                    HiddenInput(),
                }
Пример #3
0
 class Meta(AbstractDissertationForm.Meta):
     widgets = {
         'dissertation_institution':
         autocomplete.ModelSelect2(url='institution-autocomplete'),
         'dissertation_supervisors':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2Multiple(url='person-autocomplete'),
             reverse_lazy('person_create'),
         ),
         'dissertation_author':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(url='person-autocomplete'),
             reverse_lazy('person_create'),
         ),
         'dissertation_reviewers':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2Multiple(url='person-autocomplete'),
             reverse_lazy('person_create'),
         ),
         'dissertation_connected_events':
         autocomplete.ModelSelect2Multiple(url='event-autocomplete'),
         'dissertation_city':
         autocomplete.ModelSelect2(url='city-autocomplete'),
         'dissertation_disciplines':
         autocomplete.ModelSelect2Multiple(
             url='researchdiscipline-autocomplete'),
         'dissertation_type':
         autocomplete.Select2(attrs={'class': 'select2'}),
     }
     exclude = ('dissertation_title_text', 'dissertation_title_slug',
                'dissertation_date_add', 'dissertation_date_edit',
                'dissertation_added_by', 'dissertation_modified_by',
                'dissertation_authorizations', 'dissertation_is_promoted')
Пример #4
0
    class Meta:
        model = Score
        fields = ('notation', 'part', 'media_file')

        widgets = {
            'part' : AddAnotherWidgetWrapper(
                forms.Select(attrs={'class' : 'form-control'}),
                reverse_lazy('song-media:new_part')),
            'notation' : AddAnotherWidgetWrapper(
                forms.Select(attrs={'class' : 'form-control'}),
                reverse_lazy('song-media:new_notation')),
            'media_file' : ClearableFileInput(attrs={'class' : 'form-control', 'accept' : '.pdf'}),
        }
Пример #5
0
    class Meta:
        model = Book
        fields = ['title', 'author', 'summary', 'tag', 'genre', 'language', 'book_format', 'read_date']
        #labels = 
        widgets = {
            'author': AddAnotherWidgetWrapper(
                forms.Select,
                reverse_lazy('author_form'),),
            'tag': AddAnotherWidgetWrapper(
                forms.SelectMultiple,
                reverse_lazy('author_form'),),            

        }       
        permission_required = 'libraryapp.can_edit'
Пример #6
0
    class Meta:
        model = SiteUser
        fields = ["first_name", "last_name", "location", "avatar", "roles"]

        widgets = {
            "first_name":
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    "placeholder": "First name (maximum of 20 characters)"
                }),
            "last_name":
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    "placeholder": "Last name (maximum of 20 characters)"
                }),
            "location":
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    "placeholder": "Location (maximum of 50 characters)"
                }),
            "roles":
            AddAnotherWidgetWrapper(
                forms.SelectMultiple(attrs={'class': 'form-control'}),
                reverse_lazy('siteuser:role_create')),
            'avatar':
            ClearableFileInput(
                attrs={
                    'class': 'form-control',
                    'accept': '.png, .PNG, .jpg, .JPG, .jpeg, .JPG'
                }),
        }
Пример #7
0
 class Meta:
     model = MSPLine
     fields = [
         "type",
         "msp",
         "materials",
         "comment",
     ]
     widgets = {
         "msp": HiddenInput(),
         "type": HiddenInput(),
         "materials": AddAnotherWidgetWrapper(ModelSelect2MultipleWidget(
             queryset=StudyMaterialEdition.objects.all(),
             search_fields=[
                 "name__icontains",
                 "book__ISBN__icontains",
                 "book__author__icontains",
                 "book__year_of_publishing__icontains",
                 "scientificarticle__DOI__icontains",
                 "scientificarticle__author__icontains",
                 "scientificarticle__year_of_publishing__icontains",
             ]
         ), reverse_lazy('material_management:material.create')),
         # TODO: Convert this to a teacher:book.create view when it exists.
     }
Пример #8
0
 class Meta:
     model = CompetitionContentContribution
     widgets = {
         'person': AddAnotherWidgetWrapper(autocomplete.ModelSelect2(url='person-autocomplete'), reverse_lazy('person_create'),),
         'role': autocomplete.Select2(attrs={'class': 'select2'}),
         }
     exclude = ('competition',)
Пример #9
0
 class Meta:
     model = Check
     fields = ['dater', 'type', 'category', 'name', 'amount', 'cleared']
     widgets = {
         'dater': forms.TextInput(attrs={'class':'datepicker', 'autocomplete': 'off',}),
         'category': AddAnotherWidgetWrapper(
             forms.Select,
             reverse_lazy('category-cpu'),)
     }
Пример #10
0
 class Meta:
     model = User
     fields = ['username', 'groups']
     widgets = {
         'groups':
         AddAnotherWidgetWrapper(
             forms.SelectMultiple,
             reverse_lazy('add_group'),
         )
     }
Пример #11
0
 class Meta:
     model = ProjectParticipant
     widgets = {
         'person':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(url='person-autocomplete'),
             reverse_lazy('person_create'),
         ),
     }
     exclude = ('project', )
Пример #12
0
    class Meta:
        model = Reply
        fields = ("request", "song")

        widgets = {
            "request":
            forms.Select(attrs={"class": "form-control"}),
            "song":
            AddAnotherWidgetWrapper(
                forms.Select(attrs={'class': 'form-control'}),
                reverse_lazy('song:new'))
        }
Пример #13
0
 class Meta:
     model = Player
     fields = ['name', 'current_team', 'future_team', 'previous_teams']
     widgets = {
         'current_team':
         AddAnotherWidgetWrapper(
             forms.Select(),
             reverse_lazy('add_team'),
         ),
         'future_team':
         AddAnotherEditSelectedWidgetWrapper(
             forms.Select,
             reverse_lazy('add_team'),
             reverse_lazy('edit_team', args=['__fk__']),
         ),
         'previous_teams':
         AddAnotherWidgetWrapper(
             forms.SelectMultiple,
             reverse_lazy('add_team'),
         )
     }
Пример #14
0
 def get_form_class(self):
     form = forms.modelform_factory(
         model=Robject,
         fields="__all__",
         exclude=["create_by", "create_date", "modify_by"],
         widgets={
             "names":
             AddAnotherWidgetWrapper(
                 widget=forms.SelectMultiple,
                 add_related_url=reverse(
                     "projects:robjects:names_create",
                     kwargs={"project_name": self.kwargs["project_name"]})),
             "tags":
             AddAnotherWidgetWrapper(
                 widget=forms.SelectMultiple,
                 add_related_url=reverse(
                     "projects:robjects:tags_create",
                     kwargs={"project_name": self.kwargs["project_name"]})),
             'project':
             forms.HiddenInput()
         })
     return form
Пример #15
0
    class Meta:
        model = Midi
        fields = ('part', 'description', 'media_file')

        widgets = {
            'part' : AddAnotherWidgetWrapper(
                forms.Select(attrs={'class' : 'form-control'}),
                reverse_lazy('song-media:new_part')),

            'media_file' : ClearableFileInput(attrs={'class' : 'form-control', 'accept' : '.mp3, .mid, .midi'}),

            'description' : forms.TextInput(attrs={'class' : 'form-control', 'placeholder' : 'Enter a short description (optional)'}),
        }
Пример #16
0
 class Meta:
     model = models.Node
     fields = '__all__'
     widgets = {
         'synonym_of':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(url='policies:node_autocomplete',
                                       forward=['type']),
             reverse_lazy('policies:node_add'),
         ),
         'parent':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(
                 url='policies:publisher_autocomplete'),
             reverse_lazy('policies:node_add'),
         ),
         'source':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(url='policies:source_autocomplete'),
             # forms.Select,
             reverse_lazy('policies:source_add'),
         ),
     }
Пример #17
0
 class Meta:
     exclude = ['node']
     widgets = {
         'source':
         AddAnotherWidgetWrapper(
             autocomplete.ModelSelect2(url='policies:source_autocomplete'),
             # forms.Select,
             reverse_lazy('policies:source_add'),
         ),
         'vetted_date':
         forms.DateInput(
             attrs={'type': 'date'}  # https://stackoverflow.com/a/41942774
         ),
         'last_checked':
         forms.DateInput(
             attrs={'type': 'date'}  # https://stackoverflow.com/a/41942774
         ),
         'superseded_date':
         forms.DateInput(
             attrs={'type': 'date'}  # https://stackoverflow.com/a/41942774
         ),
         'default_licence':
         AddAnotherWidgetWrapper(  # Gold policy field
             forms.Select,
             reverse_lazy('policies:licence_add'),
         ),
         'version_green_licence':
         AddAnotherWidgetWrapper(  # Green policy field
             forms.Select,
             reverse_lazy('policies:licence_add'),
         ),
         'outlet':
         forms.SelectMultiple(attrs={'size': 8}),
         'version':
         forms.SelectMultiple(attrs={'size': 5}),
     }
Пример #18
0
 class Meta:
     model = MSPLine
     fields = ['comment', 'materials']
     widgets = {
         'comment':
         forms.Textarea(),
         'materials':
         AddAnotherWidgetWrapper(
             ModelSelect2MultipleWidget(
                 queryset=StudyMaterialEdition.objects.all(),
                 search_fields=[
                     "name__icontains",
                     "book__ISBN__icontains",
                     "book__author__icontains",
                     "book__year_of_publishing__icontains",
                     "scientificarticle__DOI__icontains",
                     "scientificarticle__author__icontains",
                     "scientificarticle__year_of_publishing__icontains",
                 ]), reverse_lazy('material_management:material.create')),
     }
Пример #19
0
 class Meta:
     model = StudentCourse
     exclude = ["student"]
     widgets = {
         "course": AddAnotherWidgetWrapper(
             forms.Select(
                 attrs={
                     "class": "selectpicker",
                     "data-live-search": "true",
                     "data-size": "5",
                 },
             ),
             reverse_lazy("course-create"),
         ),
         "exam_date": DateTimePickerInput(format="%Y-%m-%d %H:%M"),
         "category": forms.Select(
             attrs={"class": "selectpicker", "data-live-search": "true",}
         ),
         "semester": forms.Select(
             attrs={"class": "selectpicker", "data-live-search": "true",}
         ),
     }
Пример #20
0
    class Meta:
        model = Song
        fields = [
            "publish",
            "title",
            "ocassion",
            "genre",
            "year",
            "lyrics",
            "scripture_reference",
            "language",
            "tempo",
            "bpm",
            "divisions",
            "voicing",
            "authors",
            "seasons",
            "mass_parts",
        ]

        widgets = {
            "title":
            forms.TextInput(attrs={
                'class': 'form-control',
                'placeholder': "Song title"
            }),
            "genre":
            forms.Select(choices=GENRE_CHOICES,
                         attrs={'class': 'form-control'}),
            "ocassion":
            forms.Select(choices=OCASSION_CHOICES,
                         attrs={'class': 'form-control'}),
            "year":
            forms.DateInput(
                attrs={
                    'class': 'form-control',
                    'placeholder':
                    "Composition year in <YYYY> format (Optional)"
                }),
            "lyrics":
            forms.Textarea(
                attrs={
                    'rows': 5,
                    'columns': 10,
                    'class': 'form-control',
                    'placeholder':
                    "Lyrics (optional). Supports markdown syntax"
                }),
            "scripture_reference":
            forms.TextInput(
                attrs={
                    'class': 'form-control',
                    'placeholder': "Scripture reference (optional)"
                }),
            "seasons":
            forms.SelectMultiple(attrs={'class': 'form-control'}),
            "mass_parts":
            forms.SelectMultiple(attrs={'class': 'form-control'}),
            "tempo":
            forms.NumberInput(attrs={
                'class': 'form-control',
                'placeholder': "Tempo (optional)"
            }),
            "bpm":
            forms.NumberInput(
                attrs={
                    'class': 'form-control',
                    'placeholder': "Beats per minute (optional)"
                }),
            "divisions":
            forms.NumberInput(attrs={
                'class': 'form-control',
                'placeholder': "Divisions (optional)"
            }),
            "authors":
            AddAnotherWidgetWrapper(
                forms.SelectMultiple(attrs={'class': 'form-control'}),
                reverse_lazy('author:new')),
            "voicing":
            AddAnotherWidgetWrapper(
                forms.Select(attrs={'class': 'form-control'}),
                reverse_lazy('song:new_voicing')),
            "language":
            AddAnotherWidgetWrapper(
                forms.Select(attrs={'class': 'form-control'}),
                reverse_lazy('song:new_language'))
        }