コード例 #1
0
ファイル: forms.py プロジェクト: GonzaloSN/Sistema_prestamos
    class Meta:
        model = Laboratorio
        exclude = []

        fields = [
           'usuario',
            'title',
            'start',
            'end',
           # 'observacion',
        ]

        labels = {
            'usuario' : 'Usuario',
            'title' : 'Nombre',
            'start': 'Fecha de Inicio',
            'end': 'Fecha de Termino',
           #'observacion' : 'Observaciones',
        }

        widgets = {
            'usuario': forms.Select(attrs={'class': 'form-control', 'id': 'usuario'}),
            'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'ingrese nombre evento'}),
            'start': DateTimeWidget(attrs={'id': "start"}, usel10n=True, bootstrap_version=3),
            'end': DateTimeWidget(attrs={'id': "end"}, usel10n=True, bootstrap_version=3)
           # 'observacion': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'ingrese observacion'}),
        }
コード例 #2
0
class TravelRoutesForm(ModelForm):
    class Meta:
        model = TravelRoutes
        fields = '__all__'

    depart = fields.DateTimeField(label='Depart',
                                  widget=DateTimeWidget(bootstrap_version=3),
                                  input_formats=['%d/%m/%Y %H:%M'])
    arrive = fields.DateTimeField(label='Arrive',
                                  widget=DateTimeWidget(bootstrap_version=3),
                                  input_formats=['%d/%m/%Y %H:%M'])

    def clean(self):
        cleaned_data = super(TravelRoutesForm, self).clean()
        depart = cleaned_data.get('depart')
        arrive = cleaned_data.get('arrive')

        if arrive and depart:
            if arrive < depart:
                raise ValidationError('Arrival must be greater than departure')

            if self.instance and self.instance.trip_id is not None:
                from_date = datetime.strptime(self.data.get('from_date'),
                                              '%Y-%m-%d').date()
                to_date = datetime.strptime(self.data.get('to_date'),
                                            '%Y-%m-%d').date()
                depart = depart.date()
                arrive = arrive.date()

                # check if itinerary dates are outside the entire trip date range
                if to_date < depart or depart < from_date or to_date < arrive or arrive < from_date:
                    raise ValidationError(
                        'Travel dates must be within overall trip dates')
        return cleaned_data
コード例 #3
0
ファイル: forms.py プロジェクト: jjbgf/eventbooking
 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)
     }
コード例 #4
0
    class Meta:
        model = LocalEvent
        exclude = [
            'created_by',
            'approved',
            'fartlyfe_official',
            'image',
        ]
        dateTimeOptions = {
            'format': 'dd/mm/yyyy HH:ii P',
            'autoclose': 'true',
            'showMeridian': 'true'
        }

        widgets = {
            #Use localization
            'start':
            DateTimeWidget(
                options=dateTimeOptions,
                attrs={'id': "id_start_widget"},
            ),
            'end':
            DateTimeWidget(
                options=dateTimeOptions,
                attrs={'id': "id_end"},
            ),
        }
コード例 #5
0
ファイル: views.py プロジェクト: blueshark0811/Issue-Tracking
 def __init__(self, *args, **kwargs):
     super(CreateIssueInitForm, self).__init__(*args, **kwargs)
     self.fields['summary'].widget = CKEditorWidget()
     self.fields['due_date'].widget = DateTimeWidget(
         attrs={'id': "id_due_date"}, usel10n=True)
     self.fields['end_date'].widget = DateTimeWidget(
         attrs={'id': "id_end_date"}, usel10n=True)
コード例 #6
0
ファイル: forms.py プロジェクト: cash2one/bestgames
class NewsForm(EntityForm):
    sync_timestamp1 = forms.DateTimeField(
        label=u"微博同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))
    sync_timestamp3 = forms.DateTimeField(
        label=u"网站同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))

    class Meta:
        model = News
        fields = ('title', 'screenshot_path_1', 'screenshot_path_2',
                  'screenshot_path_3', 'screenshot_path_4', 'video_url',
                  'sync_timestamp1', 'sync_timestamp3', 'presenter',
                  'brief_comment', 'recommended_reason')
        widgets = {
            'screenshot_path_1': AjaxClearableFileInput(),
            'screenshot_path_2': AjaxClearableFileInput(),
            'screenshot_path_3': AjaxClearableFileInput(),
            'screenshot_path_4': AjaxClearableFileInput()
        }
コード例 #7
0
ファイル: forms.py プロジェクト: cash2one/bestgames
class RedierForm(EntityForm):
    image_url = forms.ImageField(label=u"图片",
                                 help_text=u"建议图片宽度大于400像素",
                                 widget=AjaxClearableFileInput())
    sync_timestamp1 = forms.DateTimeField(
        label=u"微博同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))
    sync_timestamp3 = forms.DateTimeField(
        label=u"网站同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))

    class Meta:
        model = Redier
        fields = ('game_name', 'title', 'image_url', 'video_url', 'tags',
                  'sync_timestamp1', 'sync_timestamp3', 'presenter',
                  'brief_comment', 'recommended_reason')
コード例 #8
0
 class Meta:
     model = Inspection
     fields = ['start_date', 'end_date', 'in_type', 'equipment']
     widget = {
         'start_date': DateTimeWidget(attrs={'id':"start_date"}, usel10n = True, bootstrap_version=3),
         'end_date': DateTimeWidget(attrs={'id':"end_date"}, usel10n = True, bootstrap_version=3),
     }
コード例 #9
0
ファイル: forms.py プロジェクト: cash2one/bestgames
class CollectionForm(EntityForm):
    cover = forms.ImageField(label=u"封面图片",
                             help_text=u"建议使用640x320大小的图片",
                             widget=AjaxClearableFileInput())
    games = GameChoices(label=u"游戏")
    sync_timestamp1 = forms.DateTimeField(
        label=u"微博同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))
    sync_timestamp3 = forms.DateTimeField(
        label=u"网站同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))

    class Meta:
        model = Collection
        fields = ('title', 'cover', 'video_url', 'games', 'tags',
                  'sync_timestamp1', 'sync_timestamp3', 'presenter',
                  'brief_comment', 'recommended_reason')
コード例 #10
0
ファイル: forms.py プロジェクト: cash2one/bestgames
class EvaluationForm(EntityForm):
    title = forms.CharField(label=u"标题", max_length=100)
    content = forms.CharField(label=u"内容", widget=CKEditorWidget())
    sync_timestamp1 = forms.DateTimeField(
        label=u"微博同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))
    sync_timestamp3 = forms.DateTimeField(
        label=u"网站同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))

    class Meta:
        model = Evaluation
        fields = ('title', 'icon', 'content', 'rating', 'android_download_url',
                  'iOS_download_url', 'sync_timestamp1', 'sync_timestamp3',
                  'presenter', 'brief_comment', 'recommended_reason')
        widgets = {
            'icon': AjaxClearableFileInput(),
            'content': CKEditorWidget()
        }
コード例 #11
0
ファイル: forms.py プロジェクト: macross93/huddle
    class Meta:
        model = event
        fields = ('name', 'details', 'address', 'city', 'postcode', 'start',
                  'end', 'charity', 'image')

        widgets = {
            'end':
            DateTimeWidget(attrs={
                'id': 'id_dateTimeField',
                'placeholder': 'End Time and Date'
            },
                           bootstrap_version=3,
                           usel10n=True),
            'start':
            DateTimeWidget(attrs={
                'id': 'id_dateTimeField2',
                'placeholder': 'Start Time and Date'
            },
                           bootstrap_version=3,
                           usel10n=True),
            'name':
            forms.TextInput(attrs={'placeholder': 'Event Name'}),
            'details':
            forms.Textarea(attrs={'placeholder': 'Tell us about your event'}),
            'address':
            forms.TextInput(attrs={'placeholder': 'Address'}),
            'city':
            forms.TextInput(attrs={'placeholder': 'City'}),
            'postcode':
            forms.TextInput(attrs={'placeholder': 'Postcode'}),
            'charity':
            forms.Select(attrs={'placeholder': 'Charity'}),
            'image':
            forms.FileInput(attrs={'placeholder': 'Image'}),
        }
コード例 #12
0
 class Meta:
     model = Event
     fields = ["name", "price", "game", "url", "start", "stop"]
     widgets = {
                 'start': DateTimeWidget(usel10n=True, bootstrap_version=3),
                 'stop': DateTimeWidget(usel10n=True, bootstrap_version=3)
                 }
コード例 #13
0
 class Meta:
     model = BusinessTripRoute
     exclude = ('settlement', )
     widgets = {
         'begin_time': DateTimeWidget(options=dateTimeOptions),
         'end_time': DateTimeWidget(options=dateTimeOptions),
     }
コード例 #14
0
    class Meta:
        model = Prestamos
        exclude = ['fecha_actual', 'estado_entrega', 'observaciones_devolucion']

        fields = [
            'id_usuario',
            'id_producto',
            'estado',
            'fecha_prestamo',
            'fecha_devolucion',
            'observaciones',
        ]
        labels = {
            'id_usuario': 'Usuario',
            'id_producto': 'Producto',
            'estado': 'Estado',
            'fecha_prestamo': 'Fecha Prestamo',
            'fecha_devolucion': 'Fecha Devolucion',
            'observaciones': 'Observaciones',
        }

        widgets = {
            'id_usuario': forms.Select(attrs={'class': 'form-control', 'id': 'usuario'}),
            'id_producto': forms.Select(attrs={'class': 'form-control', 'id': 'productos'}),
            'estado': forms.Select(attrs={'class': 'form-control', 'id': 'estadoPrestamo'}),
            'fecha_prestamo': DateTimeWidget(attrs={'id': "fecha_prestamo"}, usel10n=True, bootstrap_version=3),
            'fecha_devolucion': DateTimeWidget(attrs={'id': "fecha_devolucion"}, usel10n=True, bootstrap_version=3),
            'observaciones': forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Ingrese Observacion', 'rows': 3}),
        }
コード例 #15
0
ファイル: forms.py プロジェクト: datrix/infs3605
    class Meta:  #information about the class
        model = CalendarEvent
        exclude = ['url']

        dateTimeOptions = {
            'daysOfWeekDisabled': [0, 6],
            'format': 'dd/mm/yyyy HH:ii P',
            'hoursDisabled': [0, 9],
        }

        CHOICES = [(' ', 'Normal'), ('event-warning', 'Warning')]

        widgets = {
            'start':
            DateTimeWidget(attrs={'id': "yourdatetimeid"},
                           usel10n=True,
                           bootstrap_version=3,
                           options=dateTimeOptions),
            'end':
            DateTimeWidget(attrs={'id': "endtime"},
                           usel10n=True,
                           bootstrap_version=3,
                           options=dateTimeOptions),
            'notes':
            forms.Textarea(attrs={'rows': 5})
        }
コード例 #16
0
ファイル: forms.py プロジェクト: cash2one/bestgames
class PuzzleForm(EntityForm):
    image_url = forms.ImageField(label=u'题目图片',
                                 widget=AjaxClearableFileInput(),
                                 required=False)
    sync_timestamp1 = forms.DateTimeField(
        label=u"微博同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))
    sync_timestamp3 = forms.DateTimeField(
        label=u"网站同步时间",
        required=False,
        widget=DateTimeWidget(
            options={
                'autoclose': 'true',
                'showMeridian': 'true',
                'startDate': datetime.today().strftime('%Y-%m-%d %H:%M:%S')
            }))

    class Meta:
        model = Puzzle
        fields = ("title", 'image_url', 'sync_timestamp1', 'sync_timestamp3',
                  'presenter', 'description', 'option1', 'option2', 'option3',
                  'option4', 'right')
コード例 #17
0
 class Meta:
     model = Actividad
     widgets = {
         'fechaInicio': DateTimeWidget(attrs={'id': "id_fechaInicio"}, usel10n=True, bootstrap_version=3),
         'fechaFin': DateTimeWidget(attrs={'id': "id_fechaInicio"}, usel10n=True, bootstrap_version=3),
         'fechaActivacion': DateTimeWidget(attrs={'id': "id_fechaInicio"}, usel10n=True, bootstrap_version=3),
     }
コード例 #18
0
ファイル: forms.py プロジェクト: strikerlg/tournament
    class Meta:
        model = Tournament
        fields = ('name', 'start', 'end', 'description',)

        widgets = {
            'start': DateTimeWidget(attrs={'id': "id_start"}, usel10n=True, bootstrap_version=3),
            'end': DateTimeWidget(attrs={'id': "id_end"}, usel10n=True, bootstrap_version=3)
        }
コード例 #19
0
    class Meta:
        model = Voyage
        fields = '__all__'

        widgets = {
            'etd': DateTimeWidget(attrs={'id': "etd"}),
            'eta': DateTimeWidget(attrs={'id': "eta"}),
        }
コード例 #20
0
class EventForm(forms.ModelForm):
    title = forms.CharField(
        widget=forms.TextInput(attrs={
            'class': 'input',
            'placeholder': 'Enter event title'
        }),
        required=True)

    category = forms.CharField(
        widget=forms.TextInput(attrs={
            'class': 'input',
            'placeholder': 'Enter category here'
        }),
        required=False)

    priority = forms.ChoiceField(
        PRIORITY_CHOICES,
        required=False,
        widget=forms.Select(attrs={'class': 'filters-select'}))

    from_datetime = forms.DateTimeField(widget=DateTimeWidget(
        attrs={
            'id': 'datetimepicker',
            'placeholder': 'Tap to set datetime'
        },
        usel10n=True,
        bootstrap_version=3),
                                        required=False,
                                        label="from")

    to_datetime = forms.DateTimeField(widget=DateTimeWidget(
        attrs={
            'id': "datetimepicker",
            'placeholder': 'Tap to set datetime'
        },
        usel10n=True,
        bootstrap_version=3),
                                      required=False,
                                      label="to")

    place = forms.CharField(
        widget=forms.TextInput(attrs={
            'class': 'input',
            'placeholder': 'Where will the event occur'
        }),
        required=False)

    description = forms.CharField(
        widget=forms.Textarea(attrs={
            'class': 'input-area input',
            'placeholder': 'Enter description here'
        }),
        required=False)

    class Meta:
        model = Event
        fields = ('title', 'category', 'priority', 'from_datetime',
                  'to_datetime', 'place', 'description')
コード例 #21
0
class SearchForm(forms.Form):
    """
    This holds the information included in the search form, for POSTing to the backend
    """

    start = forms.DateTimeField(label='Start Date',
                                widget=DateTimeWidget(usel10n=True))
    end = forms.DateTimeField(label='End Date',
                              widget=DateTimeWidget(usel10n=True))
コード例 #22
0
 class Meta:
         model = Offers
         fields = ('code', 'start','end', 'discount','type_of_discount')
         widgets = {
         'start': DateTimeWidget(usel10n = True,
                                      bootstrap_version=3,options={'startDate':datetime.date.today().strftime('%Y-%m-%d')}),
         'end': DateTimeWidget(usel10n = True,
                                      bootstrap_version=3,options={'startDate':datetime.date.today().strftime('%Y-%m-%d')})
         }
コード例 #23
0
 class Meta:
     model = ProjectActivity
     fields = ('title', 'body', 'start_date', 'due_date')
     widgets = {
         'body':
         forms.Textarea(attrs={'placeholder': u'Activity description'}),
         'start_date': DateTimeWidget(),
         'due_date': DateTimeWidget(),
     }
コード例 #24
0
 class Meta:
     model = BusinessTripAllowance
     exclude = (
         'settlement',
         'is_first_day',
     )
     widgets = {
         'begin_time': DateTimeWidget(options=dateTimeOptions),
         'end_time': DateTimeWidget(options=dateTimeOptions),
     }
コード例 #25
0
class EditEventForm(forms.ModelForm):
    # Date time widgets to add automatic dropdown JS select menu
    time = forms.DateTimeField(
        widget=DateTimeWidget(usel10n=True, bootstrap_version=3))
    endTime = forms.DateTimeField(
        widget=DateTimeWidget(usel10n=True, bootstrap_version=3))

    class Meta:
        model = PrivateEvent
        fields = ('name', 'calendar', 'time', 'endTime')
コード例 #26
0
ファイル: forms.py プロジェクト: little-lily-17/webapp-group
class EventForm(forms.Form):
    def __init__(self, *args, **kwargs):
        self.band_id = kwargs.pop('band_id')
        super(EventForm, self).__init__(*args, **kwargs)
        self.fields['song_list'] = ModelChoiceField(
            queryset=SongList.objects.filter(band_id=self.band_id),
            required=False)

    event_name = forms.CharField(
        max_length=20,
        label='Event_name',
        widget=forms.TextInput(attrs={'class': 'form-control'}))
    start_date = forms.DateTimeField(widget=DateTimeWidget(
        usel10n=True, bootstrap_version=3, attrs={'class': 'form-control'}),
                                     required=True)
    end_date = forms.DateTimeField(widget=DateTimeWidget(
        usel10n=True, bootstrap_version=3, attrs={'class': 'form-control'}),
                                   required=True)
    event_type = forms.CharField(
        max_length=10, widget=forms.TextInput(attrs={'class': 'form-control'}))

    def clean(self):
        cleaned_data = super(EventForm, self).clean()
        start_date = self.cleaned_data.get('start_date')
        end_date = self.cleaned_data.get('end_date')

        if start_date != None and end_date != None:
            if end_date < start_date:
                raise forms.ValidationError(
                    "Invalid date entered: End date must be after start date")
        return cleaned_data

    def clean_event_name(self):
        event_name = self.cleaned_data.get('event_name')
        return event_name

    def clean_event_type(self):
        event_name = self.cleaned_data.get('event_type')
        return event_name

    def clean_start_date(self):
        utc = pytz.UTC
        start_date = self.cleaned_data.get('start_date')
        # start_time_utc = start_date.replace(tzinfo=utc)
        if start_date < datetime.datetime.now().replace(tzinfo=utc):
            raise forms.ValidationError("Please enter a date in future")
        return start_date

    def clean_end_date(self):
        utc = pytz.UTC
        end_date = self.cleaned_data.get('end_date')
        # end_time_utc = end_date.replace(tzinfo=utc)
        if end_date < datetime.datetime.now().replace(tzinfo=utc):
            raise forms.ValidationError("Please enter date in future")
        return end_date
コード例 #27
0
ファイル: views.py プロジェクト: hussam-almarzoq/rlugroup
 class Meta:
     model = Event
     fields = [
         'name', 'location', 'location_description', 'long_position',
         'lat_position', 'short_description', 'description',
         'starting_date', 'ending_date', 'announcement_date',
         'max_attendees', 'available_to'
     ]
     widgets = {
         'starting_date': DateTimeWidget(attrs={'id': "starting_date"}),
         'ending_date': DateTimeWidget(attrs={'id': "starting_date"})
     }
コード例 #28
0
ファイル: forms.py プロジェクト: Lukahm/ontask
    class Meta:
        model = Action
        fields = ('serve_enabled', 'active_from', 'active_to')

        widgets = {
            'active_from': DateTimeWidget(options=dateTimeOptions,
                                          usel10n=True,
                                          bootstrap_version=3),
            'active_to': DateTimeWidget(options=dateTimeOptions,
                                        usel10n=True,
                                        bootstrap_version=3)
        }
コード例 #29
0
ファイル: forms.py プロジェクト: tsockeel/ig
class EventForm(forms.Form):
    name = forms.CharField(max_length=50)
    dateTimeOptions = {
        'format': 'dd/mm/yyyy HH:ii',
        'autoclose': True,
        'clearBtn': False,
        'showMeridian': True
    }
    start_datetime = forms.DateTimeField(widget=DateTimeWidget(
        options=dateTimeOptions, usel10n=True, bootstrap_version=3))
    stop_datetime = forms.DateTimeField(widget=DateTimeWidget(
        options=dateTimeOptions, usel10n=True, bootstrap_version=3))
コード例 #30
0
ファイル: forms.py プロジェクト: verma1997/labper
 class Meta:
     model = Lab
     fields = {'number', 'start_time', 'end_time', 'description'}
     dateTimeOptions = {
         'autoclose': True,
         'startDate': str(datetime.datetime.today().date()),
         'endDate': str(datetime.datetime.today().date() + datetime.timedelta(7)),
         'format': 'mm/dd/yyyy hh:ii',
     }
     widgets = {
         'start_time': DateTimeWidget(options=dateTimeOptions),
         'end_time': DateTimeWidget(options=dateTimeOptions),
     }
コード例 #31
0
ファイル: scs_extras.py プロジェクト: susheel/vphshare
def datetimewidget_tag(widget_name, widget_value=""):
    from datetimewidget.widgets import DateTimeWidget

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