Esempio n. 1
0
def get_project_form(request):
    """
    Returns the project add/edit form
    """
    schema = get_project_schema().bind(request=request)
    form = Form(schema, buttons=(submit_btn, ))
    form.widget = GridFormWidget(named_grid=FORM_GRID)
    return form
Esempio n. 2
0
    def before(self, form):
        populate_actionmenu(self.request, self.context)

        if self.is_company_form():
            grid = COMPANY_FORM_GRID
        else:
            grid = INDIVIDUAL_FORM_GRID
        form.widget = GridFormWidget(named_grid=grid)
Esempio n. 3
0
def get_customer_form(request):
    """
        Returns the customer add/edit form
    """
    schema = get_customer_schema(request)
    schema = schema.bind(request=request)
    form = Form(schema, buttons=(submit_btn, ))
    form.widget = GridFormWidget(grid=FORM_GRID)
    return form
Esempio n. 4
0
def get_individual_customer_form(request, counter=None):
    """
    Return a form for an individual customer
    :param obj request: Pyramid's request object
    :param obj counter: An iterator for field number generation
    :returns: a deform.Form instance
    """
    schema = get_individual_customer_schema()

    schema = schema.bind(request=request)
    form = Form(schema,
                buttons=(submit_btn, ),
                counter=counter,
                formid='individual')
    form.widget = GridFormWidget(named_grid=INDIVIDUAL_FORM_GRID)
    return form
Esempio n. 5
0
def get_company_customer_form(request, counter=None):
    """
    Returns the customer add/edit form
    :param obj request: Pyramid's request object
    :param obj counter: An iterator for field number generation
    :returns: a deform.Form instance
    """
    schema = get_company_customer_schema()
    schema = schema.bind(request=request)
    form = Form(
        schema,
        buttons=(submit_btn,),
        counter=counter,
        formid='company',
    )
    form.widget = GridFormWidget(named_grid=COMPANY_FORM_GRID)
    return form
Esempio n. 6
0
 def before(self, form):
     FormView.before(self, form)
     if hasattr(self, "named_form_grid"):
         form.widget = GridFormWidget(named_grid=self.named_form_grid)
     elif hasattr(self, 'form_grid'):
         form.widget = GridFormWidget(grid=self.form_grid)
Esempio n. 7
0
 def before(self, form):
     populate_actionmenu(self.request, self.context)
     form.widget = GridFormWidget(grid=FORM_GRID)
Esempio n. 8
0
 def before(self, form):
     populate_actionmenu(self.request)
     form.widget = GridFormWidget(named_grid=FORM_GRID)
     # If there's no customer, redirect to customer view
     if len(self.request.context.customers) == 0:
         redirect_to_customerslist(self.request, self.request.context)