Exemplo n.º 1
0
class BeverageSaleForm(SaleForm):
    '''
    record information for the beverage sale that will change with each sale.
    '''

    barista = AutoCompleteField(label="Member", models=(User, ))
    beverage = AutoCompleteField(models=(Beverage, ))
Exemplo n.º 2
0
class MainPOSForm(forms.Form):
    '''
    for information that needs to be repeated multiple times in the sale. 
    for
     example, the member that records the sale.
    '''
    member = AutoCompleteField(label="Member", models=(User, ))
    other_party = AutoCompleteField(label="Client", models=(User, ))
    payment_method = forms.ModelChoiceField(
        queryset=PaymentMethod.objects.all())
    '''
Exemplo n.º 3
0
class ConsultationSaleForm(SaleForm):
    '''
    tech, web development, radical feminism, spackling, etc. consultation
    '''

    consultant = AutoCompleteField(label="Member", models=(User, ))
    start_time = forms.DateTimeField()
    end_time = forms.DateTimeField()
Exemplo n.º 4
0
Arquivo: forms.py Projeto: jMyles/WHAT
class UserInGroupForm(forms.Form):
    user = AutoCompleteField(label="User", models=([User,'first_name'],))
    role = forms.ModelChoiceField(Role.objects.all())
    group = forms.ModelChoiceField(Group.objects.all())
    
    def save(self):
        '''
        Given validated data, gets_or_creates a RoleInGroup.
        Assigns user to that RoleInGroup.
        
        Returns boolean for whether RoleInGroup was created
        '''
        try:
            user = self.cleaned_data['user']
            role = self.cleaned_data['role']
            group = self.cleaned_data['group']
        except (KeyError, AttributeError), e:
            raise TypeError('You must validate this form before saving the underlying objects.')
        
        role_in_group, is_new = RoleInGroup.objects.get_or_create(role=role, group=group)
        user_in_group = UserInGroup.objects.create(role=role_in_group, user=user)
        
        return is_new
Exemplo n.º 5
0
class ServiceCheckinForm(forms.Form):
    client_name = AutoCompleteField(label='Search for Device or Client',
                                    models=(User, [Device, 'quick']))
Exemplo n.º 6
0
Arquivo: views.py Projeto: jMyles/WHAT
 class SimpleParentForm(forms.Form):
     parent = AutoCompleteField(models=(TaskPrototype, ),
                                name_visible_field=True)
Exemplo n.º 7
0
Arquivo: views.py Projeto: jMyles/WHAT
 class SimpleChildForm(forms.Form):
     child = AutoCompleteField(models=(TaskPrototype, ),
                               name_visible_field=True)
Exemplo n.º 8
0
class TaskPrototypeNameForm(forms.ModelForm):
    name = AutoCompleteField(models=(TaskPrototype, ), name_visible_field=True)

    class Meta:
        model = TaskPrototype
        fields = ['name']
Exemplo n.º 9
0
class TaskPrototypeForm(forms.ModelForm):
    name = AutoCompleteField(models=(TaskPrototype, ))
    no_generate = forms.BooleanField()

    class Meta:
        model = TaskPrototype
Exemplo n.º 10
0
class DonationRealThingForm(forms.Form):
    real_thing_donation = AutoCompleteField(models=(RealThing, ))
Exemplo n.º 11
0
class DonationForm(forms.Form):
    other_party = AutoCompleteField(label="Donor",
                                    models=(User, CommerceGroup))
Exemplo n.º 12
0
    class Meta:
        model = form_model
        exclude = exclude_fields
        fields = include_fields

    return Meta


PurchaseItemForm = purchase_form_factory(
    'PurchaseItemForm', forms.Form, {
        'unit of quantification':
        forms.ModelChoiceField(queryset=QuantificationUnit.objects.all()),
        'amount':
        forms.IntegerField(widget=forms.TextInput(attrs={'size': '4'})),
        'item_name':
        AutoCompleteField(models=(TradeElement, ), new_buttons=True),
        'description':
        forms.CharField(widget=forms.Textarea),
    })

PurchaseIngredientForm = purchase_form_factory(
    'PurchaseIngredientForm', forms.Form, {
        'unit of quantification':
        forms.ModelChoiceField(queryset=QuantificationUnit.objects.all()),
        'amount':
        forms.IntegerField(widget=forms.TextInput(attrs={'size': '10'})),
        'brand':
        AutoCompleteField(models=(ProductBrand, ), new_buttons=True),
        'ingredient':
        AutoCompleteField(models=(Ingredient, ), new_buttons=True),
        'property':