Exemplo n.º 1
0
class RecordingForm(forms.ModelForm):
    send_type=forms.TextField(default='http')
    path=forms.TextField(default='temperature') 
    duration = forms.TextField(default = '5')
    data_name = forms.TextField(default='temperature.csv')      
    class Meta:
        model=config
Exemplo n.º 2
0
 def __init__(self):
     self.fields = (
         forms.TextField(field_name='username',
                         length=30,
                         maxlength=30,
                         is_required=True,
                         validator_list=[
                             validators.isAlphaNumeric, self.isValidUsername
                         ]),
         forms.EmailField(field_name='email',
                          length=30,
                          maxlength=30,
                          is_required=True,
                          validator_list=[self.isValidUsername]),
         forms.PasswordField(field_name='password1',
                             length=30,
                             maxlength=60,
                             is_required=True),
         forms.PasswordField(field_name='password2',
                             length=30,
                             maxlength=60,
                             is_required=True,
                             validator_list=[
                                 validators.AlwaysMatchesOtherField(
                                     'password1', 'Passwords must match.')
                             ]),
         forms.TextField(field_name='first_name',
                         length=20,
                         maxlength=20,
                         is_required=True),
         forms.TextField(field_name='last_name',
                         length=20,
                         maxlength=20,
                         is_required=True),
     )
Exemplo n.º 3
0
class UserProfileForm(forms.ModelForm):

    SEATTLE = 'Seattle'
    PORTLAND = 'Portland'

    LOCATION_CHOICES = ((SEATTLE, 'Seattle'), (PORTLAND, 'Portland'))

    title = forms.TextField(default="Type your title here")

    description = forms.TextField(default="Type your description here")

    origin = forms.CharField(max_length=25,
                             choices=LOCATION_CHOICES,
                             default='Seattle')

    destination = forms.CharField(max_length=25,
                                  choices=LOCATION_CHOICES,
                                  default='Seattle')

    class Meta:
        model = Request
        fields = [
            'title',
            'description',
            'origin',
            'destination',
            'sender',
            'courier',
            'date_created',
        ]
Exemplo n.º 4
0
class LeaveApplicationFrom(forms.ModelForm):
	employee           = forms.ForeignKey(Employee, blank=True, null=True, related_name="LeaveApplicant",on_delete=models.CASCADE)
	hr_manager         = forms.ForeignKey(Employee, blank=True, null=True,related_name="HRManagerProcess",on_delete=models.CASCADE)
	subject            = models.CharField(max_length=255,blank=True, null=True)
	description        = forms.TextField(blank=True, null=True)
	date_from          = forms.DateField( blank=True, null=True)
	time_from          = forms.TimeField( blank=True, null=True)
	end_date           = forms.DateField( blank=True, null=True)
	end_time           = forms.TimeField( blank=True, null=True)
	total_in_hrs       = forms.CharField(max_length=255, blank=True, null=True)
	comments           = forms.TextField(blank=True, null=True)
	status             = forms.CharField(max_length=32, choices=(('approve','approve'),('reject','reject')), blank=True) 
Exemplo n.º 5
0
class PropostaForm(forms.ModelForm):
    nome = forms.TextField(widgets=forms.TextField())
    proposta = forms.TextField(widgets=forms.TextField())
    created_time = forms.DateTimeField(widgets=forms.HiddenField(),
                                       initial=datetime.now())

    def save(self, commit=True):
        prop = super(PropostaForm, self).save(commit=False)
        if commit:
            prop.save()
        return prop

    class Meta:
        model = Proposta
        fields = ('nome', 'proposta', 'created_time')
Exemplo n.º 6
0
class VotacaoForm(forms.ModelForm):
    usuario = forms.TextField(widgets=forms.TextField())
    proposal = forms.ForeignKey(widgets=forms.HiddenField())
    status = forms.IntegerField(widgets=forms.IntegerField(), initial=1)

    def save(self, commit=True):
        votar = super(VotacaoForm, self).save(commit=False)
        if commit:
            votar.save()
        return votar

    class Meta:
        model = Votacao

        fields = ('proposal', 'status')
Exemplo n.º 7
0
class GoalForm(forms.Form):
    # place DBからpkと県名を取得する
    object_list = place.objects.all()
    # -> for文で回すか、そのまま入れれるものなのか -> 格納表記
    prefecture = forms.ChoiseField(
        # 今のchoicesは例
        choices=((1, '愛知県'), (2, '青森県'), (3, '石川県'), (4, '富山県'), (5, '東京都')))
    address = forms.CharField(max_length=100)
    name = forms.CharField(max_length=30)
    image = forms.ImageField(required=False, upload_to='')
    starttime = forms.TimeField(required=False)
    endtime = forms.TimeField(required=False)
    url = forms.URLField(required=False)
    explanation = forms.TextField(required=False, max_length=1000)
    otherinfo = forms.TextField(required=False, max_length=1000)
Exemplo n.º 8
0
class search(forms.Form):
    search_field=forms.TextField(label="Search")

    for e in Article.objects.all():
        search_articles(e)
    for e in Question.objects.all():
        search_questions(e)
Exemplo n.º 9
0
 def __init__(self, request):
     self.fields = (
         forms.TextField(field_name="Comment"),
         forms.ModelChoiceField(field_name="Thread",
                                queryset=Thread.objects.all()),
     )
     self.request = request
Exemplo n.º 10
0
class Query(forms.ModelForm):
    subject = forms.CharField(max_length=500)
    Message = forms.TextField()

    class Meta():
        model = Customer
        fields = ('Name', 'Email', 'Contact_no')
Exemplo n.º 11
0
class AddReviewForm(forms.Form):
    reviewer_name=forms.CharField(max_length=70,required=True)
    reviewer_company=forms.CharField(max_length=50,required=True)
    reviewer_subject=forms.CharField(max_length=256)
    reviewer_review=forms.TextField()
    class Meta:
        model=CompanyReview
Exemplo n.º 12
0
class Contact(forms.Form):
    firstname=forms.CharField(max_length=122)
    lastname=forms.CharField(max_length=122)
    phone=forms.CharField(max_length=15)
    email=forms.CharField(max_length=90)
    subject=forms.TextField()
    class Meta:
Exemplo n.º 13
0
class RegisterActivityForm(forms.Form):
    renewal_date = forms.DateField()
    outcome_entries = [
        ('Outcome1', 'Outcome 1'),
        ('Outcome2', 'Outcome 2'),
        ('Outcome3', 'Outcome 3'),
        ('Outcome4', 'Outcome 4'),
    ]

    outcome = forms.CharField(
        label='What is the Outcome you are reporting for?',
        widget=forms.Select(choices=outcome_entries))
    total_budget = forms.FloatField(max_length=300)
    activity = forms.CharField(max_length=200)

    sub_activity = forms.CharField(max_length=300)

    cost = forms.FloatField(max_length=300)
    description = forms.TextField(max_length=300)

    def register_activity_form(self):
        data = self.cleaned_data['renewal_date']

        # Check if a date is not in the past.
        if data < datetime.date.today():
            raise ValidationError(_('Invalid date - renewal in past'))

        # Check if a date is in the allowed range (+4 weeks from today).
        if data > datetime.date.today() + datetime.timedelta(weeks=4):
            raise ValidationError(
                _('Invalid date - renewal more than 4 weeks ahead'))

        # Remember to always return the cleaned data.
        return data
Exemplo n.º 14
0
class addPost(forms.Form):
    title = forms.CharField(max_length=30)
    isRoast = forms.BooleanField()
    submitDate = forms.DateField(auto_now=False, auto_now_add=True)
    message = forms.TextField()
    upvote = forms.IntegerField()
    downvote = forms.IntegerField()
Exemplo n.º 15
0
class AssessmentForm(forms.Form):
    creator = forms.IntegerField(widget=forms.HiddenInput)
    address = forms.TextField()

    def __new__(cls, *a, **kw):
        steps = models.StepType.objects.all()
        for s in steps:
            field_description = forms.TextField()
            field_time = forms.IntegerField(help='(%s)' % s.unit)
            field_start = forms.DateField()
            field_end = forms.DateField()
            setattr(cls, '%s_description' % s.title, field_description)
            setattr(cls, '%s_time' % s.title, field_time)
            setattr(cls, '%s_start' % s.title, field_start)
            setattr(cls, '%s_end' % s.title, field_end)
        return object.__new__(cls, *a, **kw)

    def save(self):
        assessment = models.Assessment.objects.create(
            creator=self.cleaned_data['creator'],
            address=self.cleaned_data['address'])

        steps = models.StepType.objects.all()
        for s in steps:
            description = self.cleaned_data.get('%s_description' % s.title)
            time = self.cleaned_data.get('%s_time' % s.title)
Exemplo n.º 16
0
class AddCourse(forms.Form):
    title = forms.CharField(max_length=255)
    description = forms.TextField()
    syllabus = forms.FileField()
    course_image = forms.ImageField()
    
     title = models.CharField(max_length=255, help_text="Name of course")
Exemplo n.º 17
0
class ContactForm(forms.Form):

	your_name = forms.CharField(label=_('Your name'), max_length=30
								required=True)
	your_email = forms.EmailField(label=_('Your email'),required=True)
	your_message = forms.TextField(label=_('Your message to us, no mo then 500 characters please'), 
								   max_length=500, required=True,
								   widget=forms.Textarea)
Exemplo n.º 18
0
class RaceCreateForm(forms.Form):
    race_name = forms.TextField(help_text="Enter a name for the class")

    def clean_race_name(self):
        cleaned_data = self.cleaned_data['race_name']

        # Remember to always return the cleaned data.
        return cleaned_data
class IceCreamStoreUpdateForm(forms.ModelForm):
    # Don't do this! Duplication of the model field!
    phone = forms.CharField(required=True)
    # Don't do this! Duplication of the model field!
    description = forms.TextField(required=True)

    class Meta:
        model = IceCreamStore
Exemplo n.º 20
0
class LeaveFrom(models.Model):
	leave_application   = forms.ForeignKey(LeaveApplication, blank=True, null=True,related_name="LeaveApplication",on_delete=models.CASCADE)
	leave_type          = forms.CharField(max_length=32, choices=(('Official','Official'),('Casual','Casual')), blank=True) 
	date_from           = forms.DateField( blank=True, null=True)
	time_from           = forms.TimeField( blank=True, null=True)
	end_date            = forms.DateField( blank=True, null=True)
	end_time            = forms.TimeField( blank=True, null=True)
	total_in_hrs        = forms.CharField(max_length=255, blank=True, null=True)
	comments            = forms.TextField(blank=True, null=True)
	status              = forms.CharField(max_length=32, choices=(('approve','approve'),('rejected','rejected')), blank=True) 
Exemplo n.º 21
0
class DocumentForm(forms.ModelForm):
    long_desc = forms.CharField(widget=forms.TextField(attrs={
        'cols': 10,
        'rows': 2
    }))

    class Meta:
        model = DVD
        fields = ('Title', 'year', 'genre', 'PriceDVD', 'InStock', 'Synopsis',
                  'BookingPickup', 'NumOfTimesRented', 'ImageDVD')
Exemplo n.º 22
0
 def __new__(cls, *a, **kw):
     steps = models.StepType.objects.all()
     for s in steps:
         field_description = forms.TextField()
         field_time = forms.IntegerField(help='(%s)' % s.unit)
         field_start = forms.DateField()
         field_end = forms.DateField()
         setattr(cls, '%s_description' % s.title, field_description)
         setattr(cls, '%s_time' % s.title, field_time)
         setattr(cls, '%s_start' % s.title, field_start)
         setattr(cls, '%s_end' % s.title, field_end)
     return object.__new__(cls, *a, **kw)
Exemplo n.º 23
0
    def method(self):
        name = forms.CharField(max_length=256, label='商品名')

        category = forms.ModelChoiceField(
            FoodCategory.objects.filter(user=self.user),
            label='カテゴリー',
            empty_label='選択してください')

        memo = forms.TextField(default='', label='詳細')

        limit = forms.DateField(default=(date.today() +
                                         timedelta(days=1)))  #賞味期限 defaultは翌日
Exemplo n.º 24
0
 def __init__(self, user_id):
     try:
         self.original_object = User.objects.get(id=user_id)
     except User.DoesNotExist:
         from django.http import Http404
         raise Http404
     self.fields = (
         forms.EmailField(field_name='email',
                          length=30,
                          maxlength=30,
                          is_required=True,
                          validator_list=[self.isValidUsername]),
         forms.TextField(field_name='first_name',
                         length=20,
                         maxlength=20,
                         is_required=True),
         forms.TextField(field_name='last_name',
                         length=20,
                         maxlength=20,
                         is_required=True),
     )
Exemplo n.º 25
0
class LocationForm(forms.ModelForm):
    title = forms.CharField(max_length=256)
    description = forms.TextField()
    type = forms.CharField(max_length=16)

    def __unicode__(self):
        return self.title

    class Meta:
        model = Location
        fields = ('title', 'description', 'type', 'geom')
        widgets = ('geom': LeafletWidget())
Exemplo n.º 26
0
 def __init__(self):
     self.fields = (
         forms.TextField(field_name='username',
                         length=30,
                         maxlength=30,
                         is_required=True,
                         validator_list=[validators.isAlphaNumeric]),
         forms.PasswordField(field_name='password',
                             length=30,
                             maxlength=60,
                             is_required=True),
     )
Exemplo n.º 27
0
 class Meta:
     product_name = forms.CharField(max_length=100)
     price = forms.IntegerField()
     description = forms.TextField(max_length=500)
     # category = forms.ForeignKey(Category)
     image = forms.ImageField(upload_to='media/products')
     categories = forms.ManyToManyField(Category)
     default = forms.ForeignKey('Category',
                                related_name='default_category',
                                null=True,
                                blank=False)
     active = forms.BooleanField(default=True)
Exemplo n.º 28
0
    def __init__(self, user=None, create=False, groups=None, systemOnly=False):
        debugOutput("Creating")

        self.user = user
        self.create = create
        self.groups = groups
        self.systemOnly = systemOnly

        self.fields = [
            forms.TextField(field_name="name", maxlength=100,
                            is_required=True),
            forms.PasswordField(field_name="password1",
                                length=PASSWORD_LENGTH,
                                maxlength=PASSWORD_LENGTH,
                                is_required=self.create),
            forms.PasswordField(
                field_name="password2",
                length=PASSWORD_LENGTH,
                maxlength=PASSWORD_LENGTH,
                is_required=self.create,
                validator_list=[
                    validators.AlwaysMatchesOtherField(
                        "password1",
                        error_message="This must match the field above.")
                ]),
        ]

        if self.create:
            self.fields[0:0] = [
                forms.TextField(field_name="username",
                                length=USER_LENGTH,
                                maxlength=USER_LENGTH,
                                is_required=True,
                                validator_list=[isValidUsername])
            ]
        else:
            self.fields[0:0] = [
                forms.HiddenField(field_name="username", is_required=True)
            ]
Exemplo n.º 29
0
class agForm(ModelForm):
    def __init__(self,*args,**kargs):
        super(ProductoForm,self).__init__(*args,**kargs)
        control(self.fields)
    
    
    nombre = forms.CharField(max_length=35,required=True,label='nombre producto',help_text='no debe ser mayor a 30')
    descripcion = forms.TextField(max_length=256,label='descripcion')
    stock= PositiveSmallIntegerField()
    precio = forms.IntegerField()

    class Meta:
        model = Producto
        fields =['nombre','descripcion','stock','precio']
Exemplo n.º 30
0
class share_zone_creation_form(ModelForm):
	"""
	Creation of new Share zone
	"""
	name		= forms.CharField(required = True, label = "name")
	address		= forms.TextField(required = True, label = "address")
	zip			= forms.IntegerField(required = True, label = "zip")
	summary		= forms.CharField(required = False, label = "summary")
	
	def __init__(self, *arg, **kwargs):
		super(share_zone_creation_form, self).__init__(*arg, **kwargs)
		
	class Meta:
		model = ShareZone
		fields = ["name", "summary"]