Beispiel #1
0
class BusquedaForm(forms.Form):
    """ Formulario para la Búsqueda de Actividades de Supervisión
    """
    cuc = forms.CharField(label='CUC', max_length=25, required=False)
    fecha_ini = forms.DateField(required=False, input_formats=input_formats_busqueda,
                                widget=DateWidget(attrs={'id':"fecha_ini", 'class':'fecha'},
                                                  bootstrap_version=3, options=dateOptions)
                                )
    fecha_fin = forms.DateField(required=False, input_formats=input_formats_busqueda,
                                widget=DateWidget(attrs={'id':"fecha_fin", 'class':'fecha'},
                                                  bootstrap_version=3, options=dateOptions)
                                )
    administrado = forms.ModelChoiceField(queryset=Tadministrado.objects.all().order_by('razonsocial'),
                                          required=False)
    unidad = forms.ModelChoiceField(
        queryset=Tunidadoperativa.objects.all().only(
            'idunidadoperativa','txnombreunidad').order_by('txnombreunidad'),
        required=False)
        #queryset=Tsubunidadoperativa.objects.select_related(
        #    'idunidadoperativa__txnombreunidad').all().order_by('idunidadoperativa__txnombreunidad'),
        #required=False)

    tdr = forms.ModelChoiceField(queryset=Tterminoreferencia.objects.exclude(txcodigo="").order_by('txcodigo'),
                                 required=False, label="TDR")
    tipo_supervision = forms.ModelChoiceField(queryset=Ttipsup.objects.all().order_by('txtipsup'),
                                              required=False, label="Tipo Supervisión")
    sub_tipo_supervision = forms.ModelChoiceField(queryset=Tsubtipsup.objects.all().order_by('txsubtipsup'),
                                                  required=False, label="Sub Tipo Supervisión")
Beispiel #2
0
class ProyectoForm(forms.Form):
    nombrelargo = forms.CharField(max_length=50, label='NOMBRE')
    descripcion = forms.CharField(widget=forms.Textarea(), required=False, label='DESCRIPCIÓN')
    fecha_inicio = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=2),label='FECHA DE INICIO')
    fecha_fin = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=2),label='FECHA DE FIN')
    usuario_lider = forms.ModelChoiceField(queryset=User.objects.all(), label= 'USUARIO LIDER')
    # usuario_lider = forms.CharField(widget=forms.Select(choices=User.objects.all().values_list('id','username')))
    cantidad = forms.IntegerField(label='HORAS')
    #permisos = forms.ModelMultipleChoiceField(queryset = None, widget=forms.CheckboxSelectMultiple, required = False)
    estado = forms.CharField(max_length=1, widget=forms.Select(choices=PROJECT_STATUS_CHOICES), label = 'ESTADO')

    class Meta:
        model = Proyecto
        widgets = {
            'date': DateWidget(attrs={'id':"fecha_inicio"}, usel10n = True, bootstrap_version=2)
        }

    def clean_fecha_fin(self):
        if 'fecha_fin' in self.cleaned_data:
            fecha_fin = self.cleaned_data['fecha_fin']
            fecha_inicio = self.cleaned_data['fecha_inicio']
            if fecha_fin < fecha_inicio:
                raise forms.ValidationError('La fecha de fin es menor a la fecha de inicio.')
            return fecha_fin

    def clean_nombrelargo(self):
		if 'nombrelargo' in self.cleaned_data:
			proyectos = Proyecto.objects.all()
			nombrelargo = self.cleaned_data['nombrelargo']
			for proy in proyectos:
				if nombrelargo == proy.nombrelargo:
					raise forms.ValidationError('Ya existe ese nombre de proyecto. Elija otro')
			return nombrelargo
Beispiel #3
0
class CloudFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(
        name='name',
        label = 'Name',
        lookup_expr='exact',
        widget = forms.TextInput(attrs={'class':'TinputText'}))
    start_date = django_filters.DateFilter(
        name='created',
        lookup_expr='gte',
        label = "Start Date",
        widget = DateWidget(
            options ={'format': 'yyyy-mm-dd',},
            bootstrap_version=3),
    )
    end_date = django_filters.DateFilter(
        name='created',
        lookup_expr='lte',
        label = "End Date",
        widget = DateWidget(
            options ={'format': 'yyyy-mm-dd',},
            bootstrap_version=3),
    )

    class Meta:
        model = Clouds
        fields = ['name','start_date','end_date' ]
Beispiel #4
0
class HistoryForm(forms.Form):
    start_date = forms.DateField(widget=DateWidget(usel10n=True,
                                                   options={
                                                       'clearBtn': False,
                                                       'todayHighlight': True
                                                   }),
                                 initial=timezone.datetime.today() -
                                 timezone.timedelta(weeks=1))
    end_date = forms.DateField(
        widget=DateWidget(usel10n=True,
                          options={
                              'clearBtn': False,
                              'todayHighlight': True
                          }),
        initial=timezone.datetime.today())  # TODO auto min-max dates
    course = forms.ModelChoiceField(queryset=Course.objects.all(),
                                    required=False,
                                    label="Course (optional)")

    def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user', None)
        super().__init__(*args, **kwargs)
        self.fields['course'].queryset = Course.objects.filter(
            user=self.user).order_by('name')

    def clean(self):
        cleaned_data = super().clean()
        if cleaned_data.get("start_date") is not None and cleaned_data.get(
                "end_date") is not None:
            if not self.cleaned_data['end_date'] >= self.cleaned_data[
                    'start_date']:
                raise ValidationError(
                    'The end date must be on or after the start date.')
        return cleaned_data
Beispiel #5
0
class GraphForm(forms.Form):
    start_date = forms.DateField(
        widget=DateWidget(
            attrs={
                'id': "startTime",
                'width': '45%'},
            usel10n=False,
            bootstrap_version=3))
    end_date = forms.DateField(
        widget=DateWidget(
            attrs={
                'id': "endTime"},
            usel10n=False,
            bootstrap_version=3))

    def clean(self):
        cleaned_data = super(GraphForm, self).clean()
        start = cleaned_data.get("start_date")
        end = cleaned_data.get("end_date")
        if not start:
            self._errors['start_date'] = self.error_class(
                ["Please enter a start date"])
        if not end:
            self._errors['end_date'] = self.error_class(
                ["Please enter an end date"])
        if start and end and (end <= start):
            raise forms.ValidationError(
                "The end date is before the start date!")
        return cleaned_data
Beispiel #6
0
class DateFilterForm(forms.Form):
    """A form to display as filters on report page"""

    start_date = forms.DateTimeField(
        required=False,
        widget=DateWidget(
            attrs={
                'class': "filter-handle",
                'id': "start-date-filter"
            },
            usel10n=True,
            bootstrap_version=3,
            options={'endDate': '"' + str(datetime.now().date()) + '"'}))

    end_date = forms.DateTimeField(
        required=False,
        widget=DateWidget(
            attrs={
                'class': "filter-handle",
                'id': "end-date-filter"
            },
            usel10n=True,
            bootstrap_version=3,
            options={
                'endDate':
                '"' + str((datetime.now() + timedelta(days=1)).date()) + '"'
            }))
Beispiel #7
0
class DealFilter(django_filters.FilterSet):
    STATUS_CHOICES = [('Z', _('Все контракты'))]

    for STATUS in list(DealStatus.STATUS_CHOICES):
        STATUS_CHOICES.append(STATUS)
    STATUS_CHOICES = tuple(STATUS_CHOICES)

    label = _(DealStatus._meta.get_field('status').verbose_name.title())
    status = django_filters.ChoiceFilter(choices=STATUS_CHOICES,
                                         method='filter_deal',
                                         label=label)

    label = _(DealStatus._meta.get_field('deal_data').verbose_name.title())
    deal_data = django_filters.DateTimeFromToRangeFilter(
        label=label, widget=RangeWidget(attrs={'placeholder': 'YYYY-MM-DD'}))

    deal_data.widget.widgets[0] = DateWidget(attrs={'id': "yourdateid"},
                                             usel10n=True,
                                             bootstrap_version=3)
    deal_data.widget.widgets[1] = DateWidget(attrs={'id': "yourdateid"},
                                             usel10n=True,
                                             bootstrap_version=3)

    def filter_deal(self, queryset, name, value):
        if value != 'Z':
            queryset = queryset.filter(dealstatus__status__exact=value)

        return queryset

    class Meta:
        model = Deal
        fields = ['sales_person']
Beispiel #8
0
    class Meta:
        model = Post

        location = forms.ChoiceField(choices=LOCATIONS,
                                     label="",
                                     initial='',
                                     widget=forms.Select(),
                                     required=True)
        category = forms.ChoiceField(choices=CATEGORIES,
                                     label="",
                                     initial='',
                                     widget=forms.Select(),
                                     required=True)
        widgets = {
            'start_date': DateWidget(
                attrs={'id': "start_date"},
                usel10n=True,
            ),
            'end_date': DateWidget(
                attrs={'id': "end_date"},
                usel10n=True,
            )
        }
        fields = ('sale_title', 'sale_description', 'category', 'start_date',
                  'end_date', 'location', 'address', 'banner')
Beispiel #9
0
 class Meta:
     model = Project
     fields = [
         'short_name', 'description', 'planned_start_date',
         'planned_end_date', 'actual_start_date', 'actual_end_date',
         'planned_man_hours', 'type', 'group', 'priority'
     ]
     widgets = {
         # Use localization and bootstrap 3
         'planned_start_date':
         DateWidget(attrs={'id': "planned-start-date"},
                    usel10n=True,
                    bootstrap_version=3),
         'planned_end_date':
         DateWidget(attrs={'id': "planned-end-date"},
                    usel10n=True,
                    bootstrap_version=3),
         'actual_start_date':
         DateWidget(attrs={'id': "actual-start-date"},
                    usel10n=True,
                    bootstrap_version=3),
         'actual_end_date':
         DateWidget(attrs={'id': "actual-end-date"},
                    usel10n=True,
                    bootstrap_version=3)
     }
Beispiel #10
0
class reservaForm(forms.Form):
    motel = forms.CharField(label="Motel:",widget=forms.TextInput(attrs={'class' : 'form-control'}))
    pieza = forms.CharField(label="Pieza",widget=forms.TextInput(attrs={'class' : 'form-control'}))
    fecha1 = forms.DateField(label="Fecha de Inicio:",widget=DateWidget(usel10n=True, bootstrap_version=3))
    hora1 = forms.TimeField(label="Hora de Inicio:",widget=TimeWidget(usel10n=True, bootstrap_version=3))
    fecha2 = forms.DateField(label="Fecha de Término:",widget=DateWidget(usel10n=True, bootstrap_version=3))
    hora2 = forms.TimeField(label="Hora de Término:",widget=TimeWidget(usel10n=True, bootstrap_version=3))
Beispiel #11
0
class EditRegForm(forms.ModelForm):
    first_name = forms.CharField(
        widget=forms.TextInput(attrs={'class': 'form-control', 'name': 'firstname'}),
        max_length=30,
        required=True)
    last_name = forms.CharField(
        widget=forms.TextInput(attrs={'class': 'form-control', 'name': 'lastname'}),
        max_length=30,
        required=True)
    email = forms.CharField(
        widget=forms.EmailInput(attrs={'class': 'form-control', 'name': 'email'}),
        required=True,
        max_length=75)
    date_of_birth = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3,
                                                      attrs={'name': 'date_of_birth'}))
    end_date = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3,
                                                 attrs={'name': 'end_date'}))

    # Sets the permissions to be stored in the database
    class Meta:
        model = Member
        exclude = ['last_login', 'date_joined']
        fields = ['first_name', 'last_name', 'email', 'date_of_birth', 'end_date']

    # The constructor is set and gets called in to views.py
    def __init__(self, *args, **kwargs):
        super(EditRegForm, self).__init__(*args, **kwargs)
Beispiel #12
0
 class Meta:
     model = Participant
     exclude = ['address']
     widgets = {
         #Use localization and bootstrap 3
         'birth_date':
         DateWidget(attrs={'id': "birth_date"},
                    usel10n=True,
                    bootstrap_version=3),
         'main_insurant_birthdate':
         DateWidget(attrs={'id': "main_insurant_birthdate"},
                    usel10n=True,
                    bootstrap_version=3),
         'tetanus_immunization':
         DateWidget(attrs={'id': "tetanus_immunization"},
                    usel10n=True,
                    bootstrap_version=3),
         'partial_start':
         DateWidget(attrs={'id': "partial_start"},
                    usel10n=True,
                    bootstrap_version=3),
         'partial_end':
         DateWidget(attrs={'id': "partial_end"},
                    usel10n=True,
                    bootstrap_version=3),
         'arrival':
         DateTimeWidget(attrs={'id': "arrival"},
                        usel10n=True,
                        bootstrap_version=3),
         'departure':
         DateTimeWidget(attrs={'id': "departure"},
                        usel10n=True,
                        bootstrap_version=3)
     }
Beispiel #13
0
 class Meta:
     model = BusinessTripEmployee
     exclude = ('employee', 'business_trip', 'status')
     widgets = {
         'begin_date': DateWidget(options=dateOptions),
         'end_date': DateWidget(options=dateOptions),
         'description': forms.Textarea,
     }
Beispiel #14
0
 class Meta:
     model = Ad
     widgets = {
         'start': DateWidget(usel10n=True, bootstrap_version=3),
         'end': DateWidget(usel10n=True, bootstrap_version=3),
         'image': ImageWidget()
     }
     exclude = ['id']
Beispiel #15
0
    class Meta:
        model = Fund
        exclude = [  # pylint: disable=modelform-uses-exclude
            'claimant',
            'mandatory',
            'additional_info',
            'extra_sponsored',
            'can_be_included_in_calendar',
            'can_be_advertise_before',
            'can_be_advertise_after',
            "status",
            "ad_status",
            "budget_approved",
            "required_blog_posts",
            "grant_heading",
            "grant",
            "notes_from_admin",
            "added",
            "approved",
            "updated",
            "approval_chain",
        ]

        labels = {
            'mandatory': 'Is this related with Fellows face to face selection meeting, Fellows inaugural meeting or Collaborations Workshop?',
            'title': 'Event title',
            'url': 'Event webpage link',
            'country': 'Country in which event is taking place',
            'city': 'City in which the event is taking place',
            'start_date': 'Start date of event',
            'end_date': 'End date of event',
            'budget_request_travel': "Travel costs (e.g. airfare or ground transportation)",
            'budget_request_attendance_fees': "Attendance fees (e.g. workshop / event registration costs)",
            'budget_request_subsistence_cost': "Subsistence costs (e.g. accommodation and meals)",
            'budget_request_venue_hire': "Venue hire",
            'budget_request_catering': "Catering",
            'budget_request_others': "Other costs",
            'success_targeted': "Successful outputs and outcomes",
            'can_be_included_in_calendar': "Can we include your participation in this event into the private Fellows calendar?",
            'can_be_advertise_before': "Can we public promote your involvement in this event before it takes place?",
            'can_be_advertise_after': "Can we public promote your involvement in this event after it takes place?"
        }

        widgets = {
            'claimant': Select(attrs={"class": "select-single-item"}),
            'category': Select(attrs={"class": "select-single-item"}),
            'focus': Select(attrs={"class": "select-single-item"}),
            'country': Select(attrs={"class": "select-single-item"}),
            'start_date': DateWidget(
                usel10n=True,
                bootstrap_version=3
            ),
            'end_date': DateWidget(
                usel10n=True,
                bootstrap_version=3
            ),
        }
Beispiel #16
0
class DateFilterForm(forms.Form):
    """
    Very simple form responsible for specifying what dates to filter the system stats by.
    """
    start_date = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3))
    end_date = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3))

    class Meta:
        fields = ('start_date', 'end_date')
Beispiel #17
0
    class Meta:
        model = Sprint
        fields = ['plandate']

        widgets = {
            'startdate': DateWidget(attrs={'id': "startdate"}, usel10n=True, bootstrap_version=3),
            'enddate': DateWidget(attrs={'id': "enddate"}, usel10n=True, bootstrap_version=3),
            'plandate': DateWidget(attrs={'id': "plandate"}, usel10n=True, bootstrap_version=3),

        }
Beispiel #18
0
 class Meta:
     model = models.TransactionSeries
     fields = [
         'name', 'startDate', 'endDate', 'repeatFormula', 'scenarios',
         'comment'
     ]
     widgets = {
         'startDate': DateWidget(options=dateOptions, bootstrap_version=3),
         'endDate': DateWidget(options=dateOptions, bootstrap_version=3),
     }
Beispiel #19
0
class ClientStatementForm(forms.Form):
    client = forms.ModelChoiceField(models.Client.objects.all(),
                                    label="Client")
    statementDate = forms.DateField(required=True,
                                    widget=DateWidget(options=dateOptions,
                                                      bootstrap_version=3))
    startDate = forms.DateField(
        help_text="Date from which to show transactions",
        required=True,
        widget=DateWidget(options=dateOptions, bootstrap_version=3))
Beispiel #20
0
class new_project_form(ModelForm):
    project_name = forms.CharField(widget=forms.TextInput(
        attrs={
            'class': 'form-control',
            'placeholder': 'Agency - Project Name'
        }))
    project_type = forms.ModelChoiceField(
        queryset=Project_Type.objects.all(),
        widget=forms.Select(attrs={
            'class': 'form-control',
            'placeholder': 'Please Select'
        }))
    start_date = forms.DateField(
        widget=DateWidget(attrs={
            'class': 'form-control',
            'id': "yourdatetimeid",
            'name': "start_date",
            'placeholder': 'MM/DD/YYY'
        },
                          options={"format": "mm/dd/yyyy"}))
    end_date = forms.DateField(
        widget=DateWidget(attrs={
            'class': 'form-control',
            'id': "yourdatetimeid",
            'name': "end_date",
            'placeholder': 'MM/DD/YYY'
        },
                          options={"format": "mm/dd/yyyy"}))
    pm_scope = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'class': 'form-control',
            'placeholder': '####'
        }))
    dev_scope = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'class': 'form-control',
            'placeholder': '####'
        }))
    design_scope = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'class': 'form-control',
            'placeholder': '####'
        }))
    testing_scope = forms.IntegerField(widget=forms.NumberInput(
        attrs={'class': 'form-control'}))

    class Meta:
        model = Project
        exclude = [
            'created_date',
        ]
        fields = [
            'project_name', 'project_type', 'start_date', 'end_date',
            'pm_scope', 'dev_scope', 'design_scope', 'testing_scope'
        ]
Beispiel #21
0
class DataAveragesForm(forms.Form):
    week_day = forms.MultipleChoiceField(choices=weekDays, required=False)
    start_date = forms.DateField(
        widget=DateWidget(usel10n=True, bootstrap_version=3))
    end_date = forms.DateField(
        widget=DateWidget(usel10n=True, bootstrap_version=3))
    start_time = forms.TimeField(
        widget=TimeWidget(usel10n=True, bootstrap_version=3))
    end_time = forms.TimeField(
        widget=TimeWidget(usel10n=True, bootstrap_version=3))
    geo_type = forms.ChoiceField(required=True)
Beispiel #22
0
class CompanySearchForm(SearchForm):
    id = forms.CharField(label='ID', required=False, widget=forms.HiddenInput)
    name = forms.CharField(label='nom', required=False)
    creation_date_less = forms.DateTimeField(
        label='ajouté avant le',
        widget=DateWidget(usel10n=True, bootstrap_version=3),
        required=False,
    )
    creation_date_more = forms.DateTimeField(
        label='ajouté après le',
        widget=DateWidget(usel10n=True, bootstrap_version=3),
        required=False,
    )

    update_date_less = forms.DateTimeField(
        label='modifié avant le',
        widget=DateWidget(usel10n=True, bootstrap_version=3),
        required=False,
    )
    update_date_more = forms.DateTimeField(
        label='modifié après le',
        widget=DateWidget(usel10n=True, bootstrap_version=3),
        required=False,
    )
    type = forms.ModelChoiceField(
        label='type',
        queryset=ContactType.objects.all(),
        required=False,
        to_field_name='name',
    )

    class Meta:
        mappings = {
            'id': {
                'target': ['==pk'],
                'split': True,
                'operator': 'or',
                'split_char': ','
            },
        }

    def __init__(self, *args, **kwargs):
        if 'request' in kwargs:
            self.request = kwargs.pop('request')
            self.base_fields['type'].queryset = \
                ContactType.get_queryset(self.request.user)

            self.properties = Properties.get_queryset(self.request.user)\
                .filter(type='contact')
            for prop in self.properties:
                self.base_fields['properties__{}'.format(prop.name)] = \
                    forms.CharField(required=False, label=prop.name.title())
        super().__init__(*args, **kwargs)
Beispiel #23
0
 class Meta:
     model = Event
     fields = [
         'title', 'url', 'start_date', 'end_date', 'time', 'organization',
         'location', 'categories'
     ]
     labels = event_field_labels
     widgets = {
         'start_date': DateWidget(usel10n=True, bootstrap_version=3),
         'end_date': DateWidget(usel10n=True, bootstrap_version=3)
     }
     help_texts = event_help_texts
Beispiel #24
0
    def __init__(self,*args,**kwargs):

        # El parametro extra obtenido en la vista es un queryset con todos los procesos
        procesos = kwargs.pop('extra')
        # Si hemos pasado un Seguimiento de Actividad lo asignamos a una variable
        if 'segact' in kwargs:
            segact = kwargs.pop('segact')
        else:
            segact = None

        super(RegistroForm, self).__init__(*args, **kwargs)

        #Si se abre el formulario para edición de un seguimiento ya existente
        if segact:
            # Creamos y llenamos los campos del formulario en base a los procesos y a su tipo de dato
            for proceso in procesos:
                if proceso.tipo_dato == DATE:
                    # Obtenemos el valor del campo
                    valor = SimuesProcesoSegActividadDET.objects.get(idsegactividad=segact,
                                                                idproceso=proceso).fecha
                    self.fields[str(proceso.id)] = forms.DateField(label=proceso.nombre, required=False,
                                                              input_formats=input_formats_registro,
                                                              initial=valor,
                                                              localize=True,
                                                              widget=DateWidget(attrs={'id':str(proceso.id)},
                                                              bootstrap_version=3, options=dateOptions))
                elif proceso.tipo_dato == INTEGER:
                    valor = SimuesProcesoSegActividadDET.objects.get(idsegactividad=segact,
                                                                idproceso=proceso).num
                    self.fields[str(proceso.id)] = forms.IntegerField(label=proceso.nombre,
                                                                           required=False, min_value=0,
                                                                           initial=valor)
                elif proceso.tipo_dato == BOOL:
                    valor = SimuesProcesoSegActividadDET.objects.get(idsegactividad=segact,
                                                                idproceso=proceso).sino
                    self.fields[str(proceso.id)] = forms.BooleanField(label=proceso.nombre,
                                                                      required=False,
                                                                       initial=valor)
        else:
            # Creamos los campos del formulario en base a los procesos y a su tipo de dato
            for proceso in procesos:
                if proceso.tipo_dato == DATE:
                    self.fields[str(proceso.id)] = forms.DateField(label=proceso.nombre, required=False,
                                                              input_formats=input_formats_registro,
                                                              localize=True,
                                                              widget=DateWidget(attrs={'id':str(proceso.id)},
                                                              bootstrap_version=3, options=dateOptions))
                elif proceso.tipo_dato == INTEGER:
                    self.fields[str(proceso.id)] = forms.IntegerField(label=proceso.nombre,
                                                                           required=False, min_value=0)
                elif proceso.tipo_dato == BOOL:
                    self.fields[ str(proceso.id)] = forms.BooleanField(label=proceso.nombre, required=False)
class TripForm(forms.ModelForm):
    events = forms.ModelMultipleChoiceField(
        queryset = Event.objects.all(),
        widget=autocomplete.ModelSelect2Multiple(url='event-autocomplete')
    )
    start_date = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3))
    end_date = forms.DateField(widget=DateWidget(usel10n=True, bootstrap_version=3))
    class Meta:
        model = Trip
        fields = ('principal', 'start_date', 'end_date', 'events', 'no_of_travelers', 'no_of_travelers_note')
        help_texts = {
            'events': 'CTRL + click to select multiple events for this trip. (&#8984; + Click if using Mac OS)',
        }
Beispiel #26
0
class BookingForm(forms.Form):
    TodayDate = datetime.datetime.now().date()
    DateOptions = {
        'format': 'yyyy-mm-dd',
        'startDate': TodayDate.strftime("%Y-%m-%d"),
        'todayHighlight': True,
        'pickerPosition': "bottom-left"
    }
    EndDateOptions = {
        'format': 'yyyy-mm-dd',
        'startDate': TodayDate.strftime("%Y-%m-%d")
    }
    TimeOptions = {
        'format': 'HH:ii P',
        'startDate': '9999-12-31 07:00',
        'showMeridian': True,
        'minuteStep': 10
    }
    prefer_date = forms.DateField(widget=DateWidget(bootstrap_version=3,
                                                    options=DateOptions),
                                  initial=datetime.date.today())
    end_date = forms.DateField(
        widget=DateWidget(bootstrap_version=3, options=EndDateOptions))
    start_time = forms.TimeField(
        widget=TimeWidget(bootstrap_version=3, options=TimeOptions))
    end_time = forms.TimeField(
        widget=TimeWidget(bootstrap_version=3, options=TimeOptions))
    title = forms.CharField(widget=forms.TextInput(
        attrs={'class': 'form-control'}))
    choice_list = range(1, 41)
    choice_list = ["---------"] + choice_list
    no_of_attendees = forms.ChoiceField(
        choices=[(i, i) for i in choice_list],
        widget=forms.Select(attrs={'class': 'form-control'}))
    #attendees = forms.CharField(widget=forms.Textarea(attrs={'class':'form-control','rows': "1"}),required=False)
    attendees = forms.CharField(widget=autocomplete.Select2Multiple(
        url='user-autocomplete', forward=['attendees']),
                                required=False)
    involves = forms.ChoiceField(widget=forms.RadioSelect(),
                                 choices=[('Internal', 'Internal Only'),
                                          ('External', 'External')])
    equipments = forms.MultipleChoiceField(widget=CheckboxSelectMultiple(),
                                           choices=[
                                               ('Video', 'Video Conference'),
                                               ('Computer', 'Computer Usage'),
                                               ('Phone', 'Phone Conference')
                                           ],
                                           required=False)
    highly_confidential = forms.ChoiceField(
        choices=[('No', 'No'), ('Yes', 'Yes')],
        widget=forms.Select(attrs={'class': 'form-control'}))
Beispiel #27
0
class DateRangeFilter(forms.Form):
    begin = forms.DateField(required=False,
                            widget=DateWidget(options=dateOptions,
                                              bootstrap_version=3))
    end = forms.DateField(required=False,
                          widget=DateWidget(options=dateOptions,
                                            bootstrap_version=3))

    def get_range(self):
        if self.is_valid():
            return self.cleaned_data.get('begin', None), self.cleaned_data.get(
                'end', None)
        else:
            return None, None
Beispiel #28
0
 class Meta:
     model = Event
     fields = [
         'title', 'url', 'start_date', 'end_date', 'time', 'organization',
         'location', 'categories', 'approved', 'include_in_newsletter',
         'pub_date'
     ]
     labels = event_field_labels
     widgets = {
         'start_date': DateWidget(usel10n=True, bootstrap_version=3),
         'end_date': DateWidget(usel10n=True, bootstrap_version=3),
         'pub_date': DateTimeWidget(usel10n=True, bootstrap_version=3)
     }
     help_texts = event_help_texts
Beispiel #29
0
class FiltroFechasHorariosForm(forms.Form):
    hoy = datetime.now().date()
    hoy_mas_7_dias = hoy + timedelta(days=7)

    fecha_inicio = forms.DateField(initial=hoy,
                                   widget=DateWidget(
                                       usel10n=True,
                                       bootstrap_version=3,
                                       attrs={'class': 'datepicker'}))
    fecha_fin = forms.DateField(initial=hoy_mas_7_dias,
                                widget=DateWidget(
                                    usel10n=True,
                                    bootstrap_version=3,
                                    attrs={'class': 'datepicker'}))
Beispiel #30
0
class ReportFilter(django_filters.FilterSet):
    label = DealStatus._meta.get_field('deal_data').verbose_name.title()
    deal_data = django_filters.DateTimeFromToRangeFilter(
        label=label, widget=RangeWidget(attrs={'placeholder': 'YYYY-MM-DD'}))

    deal_data.widget.widgets[0] = DateWidget(attrs={'id': "yourdateid"},
                                             usel10n=True,
                                             bootstrap_version=3)
    deal_data.widget.widgets[1] = DateWidget(attrs={'id': "yourdateid"},
                                             usel10n=True,
                                             bootstrap_version=3)

    class Meta:
        model = Deal
        fields = ['sales_person']
Beispiel #31
0
def datewidget_tag(widget_name, widget_value=""):
    from datetimewidget.widgets import DateWidget

    widget = DateWidget(options={"clearBtn": False})
    return widget.media.render() + widget.render(widget_name, widget_value)