Exemple #1
0
 class Meta:
     model = MachineDownReports
     fields = ['starttime', 'endtime']
     widgets = {
         'starttime': DateTimePickerInput(),
         'endtime': DateTimePickerInput(),
     }
Exemple #2
0
 class Meta:
     model = Lesson
     fields = (
         'appt_date',
         'status',
     )
     widgets = {'appt_date': DateTimePickerInput()}
Exemple #3
0
def manage_lessons(request, pk):
    family = Family.objects.get(pk=pk)
    LessonInlineFormSet = inlineformset_factory(
        Family,
        Lesson,
        fields=(
            'appt_date',
            'status',
        ),
        widgets={'appt_date': DateTimePickerInput()},
        extra=0,
        can_delete=False)
    if request.method == "POST":
        formset = LessonInlineFormSet(request.POST,
                                      request.FILES,
                                      instance=family)
        if formset.is_valid():
            formset.save()
            family.save()

            return HttpResponseRedirect(
                reverse_lazy('payments:family-detail', args=(pk, )))
    else:
        formset = LessonInlineFormSet(instance=family)
    return render(request, 'payments/manage_lessons.html',
                  {'formset': formset})
Exemple #4
0
    class Meta:
        model = AuctionSession
        # fields = ['title', 'description']
        fields = (
            'house',
            'start',
            'end',
        )

        # Use only when testing
        # fields = ('start', 'end',)

        widgets = {
            'start': DateTimePickerInput(),
            'end': DateTimePickerInput(),
        }
Exemple #5
0
 class Meta:
     model = Event
     fields = [
         'start_date',
         'end_date',
         'start_time',
         'end_time',
         'start_datetime',
         'end_datetime',
     ]
     widgets = {
         'start_date': DatePickerInput().start_of('event active days'),
         'end_date': DatePickerInput().end_of('event active days'),
         'start_time': TimePickerInput().start_of('event active time'),
         'end_time': TimePickerInput().end_of('event active time'),
         'start_datetime': DateTimePickerInput().start_of('event datetime'),
         'end_datetime': DateTimePickerInput().end_of('event datetime'),
     }
Exemple #6
0
 class Meta:
     model = models.Transport
     exclude = [
         'carrier', 'passengers', 'passengers_confirmed',
         'passengers_picked', 'attendees_rated'
     ]
     widgets = {
         'departure_time': DateTimePickerInput(),
     }
Exemple #7
0
 class Meta:
     model = Diary
     fields = ('created_at', 'title', 'content', 'photo1', 'photo2',
               'photo3')
     widgets = {
         'created_at':
         DateTimePickerInput(options={
             'locale': 'ja',
             'dayViewHeaderFormat': 'YYYY年 MMMM',
         })
     }
Exemple #8
0
class PlantForm(forms.ModelForm):
    name = forms.CharField()
    last_water = forms.DateTimeField(widget=DateTimePickerInput())
    info_url = forms.URLInput()
    water_schedule = forms.Select(choices=list(
        IntervalSchedule.objects.values_list('id', 'every', 'period')))
    image = forms.ImageField()

    class Meta:
        model = Plants
        fields = ['name', 'last_water', 'info_url', 'image', 'water_schedule']
Exemple #9
0
 class Meta:
     model = Family
     fields = (
         'client_name',
         'student_name',
         'address',
         'price',
         'starting_date',
         'balance',
     )
     # exclude = ('user',)
     widgets = {'starting_date': DateTimePickerInput()}
Exemple #10
0
class CheckoutAperoForm(forms.Form):

    couvert = forms.ChoiceField(required=True,
                                widget=forms.Select(attrs={
                                    'class': 'selectpicker',
                                    'data-size': "5"
                                }),
                                choices=COUVERT_CHOICES)

    name = forms.CharField(
        required=True,
        label='Nom',
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Turing',
            'class': 'form-control checkout-input',
        }))
    prenom = forms.CharField(
        required=True,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Alan',
            'class': 'form-control checkout-input',
        }))
    phone = forms.CharField(
        max_length=13,
        label='Téléphone',
        error_messages={'required': "Vous devez renseigner ce champ"},
        required=True,
        widget=forms.TextInput(attrs={
            'placeholder': '0145444646',
            'class': 'form-control checkout-input',
        }))
    email = forms.EmailField(
        required=True,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(
            attrs={
                'placeholder': '*****@*****.**',
                'class': 'form-control checkout-input',
            }))

    date_de_livraison = forms.CharField(required=True, error_messages={
        'required': "Vous devez renseigner ce champ"}, widget=DateTimePickerInput(
        attrs={    # input element attributes
            "class": "checkout-input form-control",
            "placeholder": 'Choisir une date de livraison',
            "id": 'datepicker-apero',
        }
    ))

    save_address = forms.BooleanField(required=False,
                                      widget=forms.CheckboxInput())
Exemple #11
0
 class Meta:
     model = Banner
     fields = [
         'name', 'url', 'start_at', 'end_at', 'administrator',
         'moderator_name', 'moderator_email', 'staff', 'participants',
         'hide'
     ]
     help_texts = {'hide': 'Hide from public banner list'}
     widgets = {
         'start_at':
         DateTimePickerInput(options={
             "dateFormat": "D, M j, Y h:i K"
         }).start_of('banner'),
         'end_at':
         DateTimePickerInput(options={
             "dateFormat": "D, M j, Y h:i K"
         }).end_of('banner'),
         'staff':
         TinyMCE(),
         'participants':
         TinyMCE(),
     }
Exemple #12
0
class ShareSearchForm(forms.Form):
    dest = forms.CharField(max_length=150, label="Destination")
    num = forms.IntegerField(initial=1, label="Number of passengers (including yourself)")
    start_datetime = forms.DateTimeField(widget=DateTimePickerInput(), initial=timezone.now,
                                         label="Expected Earliest Arrival Time")
    end_datetime = forms.DateTimeField(widget=DateTimePickerInput(), initial=timezone.now,
                                       label="And the Latest time you accept")

    def clean_start_datetime(self):
        start_datetime = self.cleaned_data.get('start_datetime')
        print(start_datetime)
        if start_datetime < timezone.now():
            raise forms.ValidationError("Sorry, the start time passed already.")

        return start_datetime

    def clean_end_datetime(self):
        start_datetime = self.cleaned_data.get('start_datetime')
        end_datetime = self.cleaned_data.get('end_datetime')

        if not start_datetime or start_datetime > end_datetime:
            raise forms.ValidationError("Please check the range is valid.")

        return end_datetime
Exemple #13
0
 class Meta:
     model = Health
     fields = ('create_date', 'health_menu', 'health')
     labels = {
         'create_date': '',
         'health_menu': '',
         'health': '',
     }
     widgets = {
         'create_date':
         DateTimePickerInput(options={
             'locale': 'ja',
             'dayViewHeaderFormat': 'YYYY年 MMMM',
         })
     }
Exemple #14
0
class CreateView(GenericViewWidgetMixin, generic.edit.CreateView):
    model = Event
    fields = [
        'start_date',
        'end_date',
        'start_time',
        'end_time',
        'start_datetime',
        'end_datetime',
    ]
    widgets = {
        'start_date': DatePickerInput().start_of('event days'),
        'end_date': DatePickerInput().end_of('event days'),
        'start_time': TimePickerInput().start_of('event time'),
        'end_time': TimePickerInput().end_of('event time'),
        'start_datetime': DateTimePickerInput().start_of('event dtime'),
        'end_datetime': DateTimePickerInput().end_of('event dtime'),
    }

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['title_text'] = 'Generic View without using model form'
        context['submit_text'] = 'Create Event'
        return context
Exemple #15
0
class MeetingAddForm(forms.ModelForm):
    meet_date = forms.DateTimeField(widget=DateTimePickerInput(
        options={
            'dateFormat': 'Y-m-d H:i',
        }))
    meet_title = forms.CharField(widget=forms.TextInput(
        attrs={'class': 'form-control'}))
    meet_desc = forms.CharField(widget=forms.Textarea(
        attrs={
            'class': 'form-control',
            'style': 'height: 100px; min-height: 100px;'
            'max-height: 200px;'
        }))
    participants = forms.CharField(
        widget=forms.SelectMultiple(attrs={'class': 'form-control choices'}),
        required=False)
    meet_contents = summer_fields.SummernoteTextFormField(
        label='',
        widget=forms.TextInput(),
        required=False,
        error_messages={
            'required': (u'내용을 입력해주세요'),
        })
    progress = forms.BooleanField(widget=forms.CheckboxInput(attrs={
        'id': 'progress',
        'class': 'd-none'
    }),
                                  required=False)
    file1 = forms.FileField(
        label='첨부파일1',
        widget=forms.ClearableFileInput(attrs={'class': 'form-control-file'}))
    file2 = forms.FileField(
        label='첨부파일2',
        widget=forms.ClearableFileInput(attrs={'class': 'form-control-file'}))

    class Meta:
        model = Meeting
        fields = ('meet_date', 'meet_title', 'meet_desc', 'participants',
                  'meet_contents', 'progress', 'file1', 'file2')

    def __init__(self, *args, **kwargs):
        super(MeetingAddForm, self).__init__(*args, **kwargs)
        self.fields['file1'].required = False
        self.fields['file2'].required = False
class ProjectsForm(forms.ModelForm):
    projectname = forms.CharField(
        label='Project Name',
        max_length=30,
        min_length=5,
        widget=forms.TextInput(
            attrs={'placeholder': 'Enter the project name'}))
    projdesc = forms.CharField(
        label='Project Description',
        widget=forms.Textarea(
            attrs={'placeholder': 'Describe the project in 500 characters'}),
        required=True)
    project_deadline = forms.DateTimeField(label='Project Deadline Date',
                                           widget=DateTimePickerInput(),
                                           required=True)

    class Meta:
        model = Project
        fields = ['projectname', 'projdesc', 'project_deadline']
Exemple #17
0
 class Meta:
     model = AdvDetails
     fields = ['title', 'dept', 'descrip', 
               'bid_start_date', 'bid_end_date', 
               'part_start_date', 'part_end_date', 
               'comb_start_date', 'comb_end_date',
               'advFile']
     widgets = {
         'descrip' : forms.Textarea(),
         'bid_start_date' : DateTimePickerInput().start_of('bids'),
         'bid_end_date' : DateTimePickerInput().end_of('bids').start_of('part'),
         'part_start_date' : DateTimePickerInput().end_of('part').start_of('share'),
         'part_end_date' : DateTimePickerInput().end_of('share').start_of('fwd'),
         'comb_start_date' : DateTimePickerInput().end_of('fwd').start_of('comb'),
         'comb_end_date' : DateTimePickerInput().end_of('comb'),
     }
Exemple #18
0
 class Meta:
     model = Post
     fields = ('photo', 'title', 'manage_post', 'published_date',)
     widgets = {
         'published_date': DateTimePickerInput(attrs={'id' : 'publishedDate', 'placeholder' : 'Wybierz datę'}),
     }
Exemple #19
0
class CheckoutForm(forms.Form):

    couvert = forms.ChoiceField(
        required=True,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.Select(attrs={
            'class': 'selectpicker',
            'data-size': "5"
        }),
        choices=COUVERT_CHOICES)

    name = forms.CharField(
        required=True,
        label='Nom',
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Turing',
            'class': 'form-control checkout-input',
        }))

    prenom = forms.CharField(
        required=True,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Alan',
            'class': 'form-control checkout-input',
        }))

    phone = forms.CharField(
        max_length=13,
        label='Téléphone',
        help_text='Numéro valide',
        error_messages={'required': "Vous devez renseigner ce champ"},
        required=True,
        widget=forms.TextInput(attrs={
            'placeholder': '0145444646',
            'class': 'form-control checkout-input',
        }))
    email = forms.EmailField(
        required=True,
        help_text='Rentrez votre email',
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(
            attrs={
                'placeholder': '*****@*****.**',
                'class': 'form-control checkout-input',
            }))

    delivery_option = forms.ChoiceField(
        required=True,
        widget=forms.RadioSelect,
        choices=LIVRAISON_CHOICES,
        help_text='Choississez une date de livraison et son horaire')

    date_de_livraison = forms.CharField(required=True, help_text="Les commandes pour le déjeuner doivent être prises au plus tard la veille pour le lendemain ", error_messages={
        'required': "Vous devez renseigner ce champ"}, widget=DateTimePickerInput(
        attrs={    # input element attributes
            "class": "checkout-input",
            "placeholder": 'Choisir une date de livraison',
            "id": 'datepicker-dejeuner',

        }
    ))

    save_address = forms.BooleanField(required=False,
                                      widget=forms.CheckboxInput())

    zone_delivery = forms.ChoiceField(
        label='Zone de livraison',
        required=False,
        widget=forms.Select(attrs={'class': 'selectpicker'}),
        choices=ZONE_LIVRAISON_BATEAU)

    rang_delivery = forms.CharField(
        label='Rang',
        required=False,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Turing',
            'class': 'form-control checkout-input',
        }))
    numero_delivery = forms.CharField(
        label='Numéro',
        required=False,
        error_messages={'required': "Vous devez renseigner ce champ"},
        widget=forms.TextInput(attrs={
            'placeholder': 'Turing',
            'class': 'form-control checkout-input',
        }))

    creneau_delivery = forms.ChoiceField(required=False,
                                         label='Heure de livraison',
                                         widget=forms.Select(
                                             attrs={
                                                 'id': 'select-time',
                                                 'class': 'selectpicker',
                                                 'data-size': "5",
                                                 'data-hide-disabled': 'true',
                                             }),
                                         choices=CRENEAU_DELIVERY)

    loueur_bateau = forms.ChoiceField(
        label='Préciser le loueur de bateau',
        required=False,
        widget=forms.Select(attrs={'class': 'selectpicker'}),
        choices=LOUEUR_CHOICES)

    def clean(self):
        cleaned_data = super().clean()
        delivery_option = cleaned_data.get('delivery_option')
        loueur_bateau = cleaned_data.get('loueur_bateau')
        zone_delivery = cleaned_data.get('zone_delivery')
        creneau_delivery = cleaned_data.get('creneau_delivery')
        rang_delivery = cleaned_data.get('rang_delivery')
        numero_delivery = cleaned_data.get('numero_delivery')

        list = ['10:30', '10:40', '10:50', '11:30', '11:40', '11:50']
        list1 = ['10:00', '10:10', '10:20', '11:00', '11:10', '11:20']

        if delivery_option == "livraison-sur-bateau" and (
                rang_delivery == "" or numero_delivery == ""):
            msg = 'Vous devez préciser votre emplacement'
            if rang_delivery == "":
                self.add_error('rang_delivery', msg)
                self.add_error('delivery_option', msg)
            elif numero_delivery == "":
                self.add_error('numero_delivery', msg)
                self.add_error('delivery_option', msg)
            else:
                self.add_error('delivery_option', msg)

        if (zone_delivery == '4'
                or zone_delivery == '5b') and creneau_delivery not in list:
            msg = 'Vous devez sélectionner un créneau horaire correspondant à votre zone'
            self.add_error('delivery_option', msg)
            self.add_error('creneau_delivery', msg)

        if (zone_delivery == '5a' or zone_delivery == '6'
                or zone_delivery == '7') and creneau_delivery not in list1:
            msg = 'Vous devez sélectionner un créneau horaire correspondant à votre zone'
            self.add_error('delivery_option', msg)
            self.add_error('creneau_delivery', msg)

        if delivery_option == 'loueur-bateau' and loueur_bateau == '':
            msg = 'Vous devez préciser un loueur de bateau'
            self.add_error('delivery_option', msg)
            self.add_error('loueur_bateau', msg)
Exemple #20
0
 class Meta:
     model = Ride
     fields = ['dest', 'owner_count', 'arrival_daytime', 'is_shared', 'vehicle_type', 'special_request']
     widgets = {
         'arrival_daytime': DateTimePickerInput(),
     }
Exemple #21
0
 class Meta:
     model = models.Task
     exclude = ['completed']
     widgets = {
         'deadline': DateTimePickerInput(),
     }