Пример #1
0
def snoseries(series=None):
    if series is None:
        form = CreateSnoSeriesForm()
        if form.validate_on_submit():
            try:
                ehserialnos.controller.get_series_obj(series=form.series.data)
                alert = 'Did not create series {0}. ' \
                        'Already exists.'.format(form.series.data)
                flash(alert, 'alert')
            except SeriesNotFound:
                ehserialnos.create_serial_series(
                        form.series.data, form.start_seed.data, form.description.data
                )
                alert = 'Created serial series {0}.'.format(form.series.data)
                flash(alert, 'success')

        stage_snoseries = sorted(ehserialnos.get_all_series(), key=lambda x: x.series)
        stage = {'series': stage_snoseries,
                 'crumbroot': '/entityhub',
                 'form': form,
                 'breadcrumbs': [Crumb(name="Entity Hub", path=""),
                                 Crumb(name="Serial Series", path="snoseries/")]
                 }
        return render_template('entityhub_snoseries.html', stage=stage,
                               pagetitle="Serial Series")
    else:
        abort(404)
Пример #2
0
def projects(projectname=None):
    projectlib = get_project_lib()
    if projectname is None:
        stage_projects = projectlib
        stage = {
            'projects':
            stage_projects,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="EDA Projects", path="projects/")
            ]
        }
        return render_template('entityhub_projects.html',
                               stage=stage,
                               pagetitle="EDA Projects")
    else:
        prototype = projectlib[projectname]
        stage = {
            'prototype':
            prototype,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="EDA Projects", path="projects/"),
                Crumb(name=projectname, path="projects/" + projectname)
            ]
        }
        stage.update(_get_configurations_stage(prototype))
        return render_template(
            'entityhub_project_detail.html',
            stage=stage,
            pagetitle="Project Details {0}".format(projectname))
Пример #3
0
def results(device_sno=None):
    # Presently only supports getting the latest result. A way to allow
    # any result to be retrieved would be nice.
    if device_sno is None:
        docs = dxtesting.get_all_test_reports()
        stage = {
            'docs':
            docs,
            'crumbroot':
            '/testing',
            'breadcrumbs': [
                Crumb(name="Testing", path=""),
                Crumb(name="Results", path="result/")
            ],
        }
        return render_template('test_results.html',
                               stage=stage,
                               pagetitle="All Test Results")
    else:
        docs = dxtesting.get_latest_test_report(device_sno)
        stage = {
            'docs':
            docs,
            'crumbroot':
            '/testing',
            'breadcrumbs': [
                Crumb(name="Testing", path=""),
                Crumb(name="Reports", path="result/"),
                Crumb(name=device_sno, path="result/" + device_sno)
            ],  # noqa
        }
        stage.update(get_test_report(serialno=device_sno))
        return render_template('test_result_detail.html',
                               stage=stage,
                               pagetitle=device_sno + " Test Result")
Пример #4
0
def indent(indent_sno=None):
    if indent_sno is None:
        docs = dxindent.get_all_indents_docs()
        stage = {
            'docs':
            docs,
            'crumbroot':
            '/inventory',
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Indent", path="indent/")
            ],
        }
        return render_template('indent.html',
                               stage=stage,
                               pagetitle="All Indents")
    else:
        indent_obj = InventoryIndent(indent_sno)
        stage = {
            'indent':
            indent_obj,
            'crumbroot':
            '/inventory',
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Indent", path="indent/"),
                Crumb(name=indent_sno, path="indent/" + indent_sno)
            ],  # noqa
        }
        return render_template('indent_detail.html',
                               stage=stage,
                               pagetitle="Stock Indent " + indent_sno)
Пример #5
0
def transforms(location_idx=None):
    if location_idx is None:
        locs = invelectronics.inventory_locations
        idents = gsymlib.gsymlib_idents
        stage = {
            'idents':
            idents,
            'locs':
            locs,
            'crumbroot':
            '/inventory',
            'inv':
            invelectronics,
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Transforms", path="transform/")
            ],
        }
        return render_template('overview.html',
                               stage=stage,
                               pagetitle="All Inventory Transforms")
    else:
        loc = invelectronics.get_inventory_location(idx=location_idx)
        form = TransformUpdateForm(names=loc.tf.names)
        if form.validate_on_submit():
            # This shouldn't actually be used anymore. The update_transform
            # AJAX handler should be called instead.
            if form.contextual.data in loc.tf.names:
                loc.tf.set_canonical_repr(form.contextual.data,
                                          form.canonical.data)
                loc.tf.set_status(form.contextual.data, form.status.data)
                loc.tf.update_on_disk()
            else:
                # TODO issue an alert here
                print(
                    "Couldn't find the contextual representation in the transform"
                )
                pass
        stage = {
            'loc':
            loc,
            'tf':
            loc.tf,
            'gsymlib_idents':
            gsymlib.gsymlib_idents,
            'form':
            form,
            'crumbroot':
            '/inventory',
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Transforms", path="transform/"),
                Crumb(name=loc.name, path="transform/" + location_idx)
            ],  # noqa
        }
        return render_template('transform_detail.html',
                               stage=stage,
                               pagetitle="Inventory Transform " + loc.name)
Пример #6
0
def render_search_results():
    form = SourcingIdentSearch()
    if form.validate_on_submit():
        ident = form.ident.data
        qty = form.qty.data

        if not qty:
            qty = electronics_qty.get_compliant_qty(ident, 1)
            form.qty.data = qty
        try:
            qty = int(qty)
        except ValueError:
            qty = Length(qty)

        vl = []
        for vname in form.vendors.data:
            v = get_vendor_by_name(vname)
            if not v:
                raise ValueError
            vl.append(v)

        try:
            vsi = get_sourcing_information(ident,
                                           qty,
                                           avendors=vl,
                                           allvendors=True,
                                           get_all=form.get_all.data)
        except SourcingException:
            vsi = []

        symbol = get_symbol(ident)

        stage = {
            'crumbroot':
            '/sourcing',
            'breadcrumbs': [
                Crumb(name="Sourcing", path=""),
                Crumb(name="Vendors", path="vendors/"),
                Crumb(name="Search Results", path="vendors/results")
            ],
            'isinfos':
            vsi,
            'ident':
            ident,
            'symbol':
            symbol,
        }

        return render_template('vendors_search_results.html',
                               stage=stage,
                               form=form,
                               pagetitle='Sourcing Search Results')
    else:
        return redirect(url_for('.main'))
Пример #7
0
def products(productname=None):
    if productname is None:
        stage_products = sorted(ehproducts.productlib,
                                key=lambda x: (x.info.status, x.name))
        lines = {}
        ptypes = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for product in stage_products:
            if product.info.ptype not in ptypes.keys():
                ptypes[product.info.ptype] = 1
            else:
                ptypes[product.info.ptype] += 1
            if product.info.line not in lines.keys():
                lines[product.info.line] = 1
            else:
                lines[product.info.line] += 1
            tstatuses[str(product.status)] += 1
        statuses = [(x, tstatuses[str(x)])
                    for x in status.get_known_statuses()]
        stage = {
            'statuses':
            statuses,
            'lines':
            lines,
            'ptypes':
            ptypes,
            'products':
            stage_products,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Products", path="products/")
            ]
        }
        return render_template('entityhub_products.html',
                               stage=stage,
                               pagetitle="Products")
    else:
        stage = {
            'product':
            ehproducts.get_product_by_ident(productname),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Products", path="products/"),
                Crumb(name=productname, path="pcbs/" + productname)
            ],  # noqa
        }
        return render_template(
            'entityhub_product_detail.html',
            stage=stage,
            pagetitle="Product Detail {0}".format(productname))
Пример #8
0
def main():
    latest = dxcustoms.get_all_customs_invoice_serialnos(limit=5)
    stage = {
        'latest':
        latest,
        'crumbroot':
        '/sourcing',
        'breadcrumbs': [
            Crumb(name="Sourcing", path=""),
            Crumb(name="Customs", path="customs/")
        ],
    }
    return render_template('customs_main.html',
                           stage=stage,
                           pagetitle='Customs')
Пример #9
0
def main():
    form = SourcingIdentSearch()
    stage = {
        'vendors':
        vendor_list,
        'crumbroot':
        '/sourcing',
        'breadcrumbs': [
            Crumb(name="Sourcing", path=""),
            Crumb(name="Vendors", path="vendors/")
        ],
    }
    return render_template('vendors_main.html',
                           stage=stage,
                           form=form,
                           pagetitle='Vendors')
Пример #10
0
def landing_sourcing():
    stage = {
        'crumbroot': '/sourcing',
        'breadcrumbs': [Crumb(name="Sourcing", path="")],
    }
    return render_template('pages/land_sourcing.html',
                           stage=stage,
                           pagetitle='Sourcing')
Пример #11
0
def landing_inventory():
    stage = {
        'crumbroot': '/inventory',
        'breadcrumbs': [Crumb(name="Inventory", path="")],
    }
    return render_template('pages/land_inventory.html',
                           stage=stage,
                           pagetitle='Inventory')
Пример #12
0
def main():
    latest = dxtesting.get_all_test_reports(limit=5)
    stage = {
        'latest': latest,
        'crumbroot': '/testing',
        'breadcrumbs': [Crumb(name="Testing", path="")],
    }
    return render_template('testing_main.html',
                           stage=stage,
                           pagetitle='Testing')
Пример #13
0
def main():
    latest_prod = dxproduction.get_all_production_orders_docs(limit=5)
    stage = {
        'latest_prod': latest_prod,
        'crumbroot': '/production',
        'breadcrumbs': [Crumb(name="Production", path="")],
    }
    return render_template('production_main.html',
                           stage=stage,
                           pagetitle='Production')
Пример #14
0
def status(location_idx=None):
    if location_idx is None:
        locs = invelectronics.inventory_locations
        idents = []
        for loc in locs:
            for line in loc.lines:
                if line.ident not in idents:
                    idents.append(line.ident)
        stage = {
            'idents':
            idents,
            'locs':
            locs,
            'crumbroot':
            '/inventory',
            'inv':
            invelectronics,
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Status", path="location/")
            ],
        }
        return render_template('status.html',
                               stage=stage,
                               pagetitle="All Inventory Locations")
    else:
        loc = invelectronics.get_inventory_location(idx=location_idx)

        stage = {
            'loc':
            loc,
            'crumbroot':
            '/inventory',
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Status", path="location/"),
                Crumb(name=loc.name, path="location/" + location_idx)
            ],  # noqa
        }
        return render_template('location_detail.html',
                               stage=stage,
                               pagetitle="Inventory Location " + loc.name)
Пример #15
0
def cards(cardname=None):
    prototypes = get_prototype_lib()
    if cardname is None:
        stage_cards = [
            v for k, v in viewitems(prototypes)
            if isinstance(v, CardPrototype)
        ]
        stage_cards.sort(key=lambda x: (x.status, x.ident))

        series = {}
        tstatuses = {str(x): 0 for x in status.get_known_statuses()}
        for card in stage_cards:
            if card.configs.snoseries not in series.keys():
                series[card.configs.snoseries] = 1
            else:
                series[card.configs.snoseries] += 1
            tstatuses[str(card.status)] += 1
        statuses = [(x, tstatuses[str(x)])
                    for x in status.get_known_statuses()]

        stage = {
            'statuses':
            statuses,
            'series':
            series,
            'cards':
            stage_cards,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cards", path="cards/")
            ]
        }
        return render_template('entityhub_cards.html',
                               stage=stage,
                               pagetitle="Cards")
    else:
        prototype = prototypes[cardname]
        stage = {
            'prototype':
            prototype,
            'inclusion':
            ehproducts.get_module_inclusion(cardname),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cards", path="cards/"),
                Crumb(name=cardname, path="cards/" + cardname)
            ]
        }
        return render_template('entityhub_card_detail.html',
                               stage=stage,
                               pagetitle=cardname + " Card Details")
Пример #16
0
def production_orders(order_sno=None):
    # Presently only supports getting the latest result. A way to allow
    # any result to be retrieved would be nice.
    if order_sno is None:
        docs = dxproduction.get_all_production_orders_docs()
        stage = {
            'docs':
            docs,
            'crumbroot':
            '/production',
            'breadcrumbs': [
                Crumb(name="Production", path=""),
                Crumb(name="Orders", path="order/")
            ],
        }
        return render_template('production_orders.html',
                               stage=stage,
                               pagetitle="All Production Orders")
    else:
        production_order = order.ProductionOrder(order_sno)
        docs = production_order.docs

        stage = {
            'docs':
            docs,
            'order':
            production_order,
            'title':
            production_order.title,
            'order_sno':
            order_sno,
            'crumbroot':
            '/production',
            'breadcrumbs': [
                Crumb(name="Production", path=""),
                Crumb(name="Orders", path="order/"),
                Crumb(name=order_sno, path="order/" + order_sno)
            ],  # noqa
        }
        return render_template('production_order_detail.html',
                               stage=stage,
                               pagetitle="Production Order " + order_sno)
Пример #17
0
def pcbs(pcbname=None):
    pcblib = get_pcb_lib()
    if pcbname is None:
        stage_pcbs = [v for k, v in viewitems(pcblib)]
        stage = {
            'pcbs':
            sorted([x for x in stage_pcbs], key=lambda y: (y.status, y.ident)),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Bare PCBs", path="pcbs/")
            ]
        }
        return render_template('entityhub_pcbs.html',
                               stage=stage,
                               pagetitle="Bare PCBs")
    else:
        prototype = pcblib[pcbname]
        stage = {
            'prototype':
            prototype,
            'imgs':
            get_img_list(prototype.projfolder),
            'costing':
            get_pcb_costing_chart(prototype.projfolder),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Bare PCBs", path="pcbs/"),
                Crumb(name=pcbname, path="pcbs/" + pcbname)
            ]
        }
        ident = 'PCB ' + pcbname
        stage.update(get_inventory_stage(ident))
        return render_template('entityhub_pcb_detail.html',
                               stage=stage,
                               pagetitle="PCB Detail {0}".format(pcbname))
Пример #18
0
def cables(cblname=None):
    prototypes = get_prototype_lib()
    if cblname is None:
        stage_cables = [
            v for k, v in viewitems(prototypes)
            if isinstance(v, CablePrototype)
        ]
        stage_cables.sort(key=lambda x: (x.status, x.ident))

        series = {}

        for cable in stage_cables:
            if cable.configs.snoseries not in series.keys():
                series[cable.configs.snoseries] = 1
            else:
                series[cable.configs.snoseries] += 1

        stage = {
            'series':
            series,
            'cables':
            stage_cables,
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cables", path="cables/")
            ]
        }
        return render_template('entityhub_cables.html',
                               stage=stage,
                               pagetitle="Cables")
    else:
        prototype = prototypes[cblname]
        stage = {
            'prototype':
            prototype,
            'inclusion':
            ehproducts.get_module_inclusion(cblname),
            'crumbroot':
            '/entityhub',
            'breadcrumbs': [
                Crumb(name="Entity Hub", path=""),
                Crumb(name="Modules", path="modules/"),
                Crumb(name="Cables", path="cables/"),
                Crumb(name=cblname, path="cables/" + cblname)
            ]
        }
        return render_template('entityhub_cable_detail.html',
                               stage=stage,
                               pagetitle=cblname + " Cable Details")
Пример #19
0
def get_geda_symbol_context(ident):
    symbol = tendril.gedaif.gsymlib.get_symbol(ident, get_all=True)
    symbol = [x for x in symbol if x.status != 'Generator']

    navpath = os.path.relpath(symbol[0].fpath, GEDA_SYMLIB_ROOT)
    navpath = os.path.join('browse', navpath)
    breadcrumbs = get_path_breadcrumbs(navpath, rootst="gEDA Symbol Library")
    if symbol[0].is_virtual:
        breadcrumbs.insert(-1, Crumb(name=os.path.splitext(symbol[0].fname)[0] + '.gen',  # noqa
                                     path='detail/' + os.path.splitext(symbol[0].fname)[0] + '.gen'))  # noqa

    stage = {'ident': ident,
             'symbol': symbol[0],
             'sympaths': [os.path.relpath(sym.fpath, GEDA_SYMLIB_ROOT) for sym in symbol],  # noqa
             'imgpaths': [sym.img_repr_fname for sym in symbol],
             'inclusion': supersets.get_symbol_inclusion(ident),
             'breadcrumbs': breadcrumbs}

    stage.update(get_inventory_stage(ident))
    return stage
Пример #20
0
def invoices(invoice_sno=None):
    if invoice_sno is None:
        snos = dxcustoms.get_all_customs_invoice_serialnos()
        stage = {
            'snos':
            snos,
            'crumbroot':
            '/sourcing',
            'breadcrumbs': [
                Crumb(name="Sourcing", path=""),
                Crumb(name="Customs", path="customs/"),
                Crumb(name="Invoices", path="customs/inv/")
            ],
        }
        return render_template('customs_invoices.html',
                               stage=stage,
                               pagetitle="Customs Document Sets")
    else:
        sno = serialnos.get_serialno_object(sno=invoice_sno)
        docs = docstore.get_docs_list_for_serialno(invoice_sno)
        invoice = dxcustoms.get_customs_invoice(invoice_sno)
        stage = {
            'sno':
            sno,
            'docs':
            docs,
            'invoice':
            invoice,
            'crumbroot':
            '/sourcing',
            'breadcrumbs': [
                Crumb(name="Sourcing", path=""),
                Crumb(name="Customs", path="customs/"),
                Crumb(name="Invoices", path="customs/invoice/"),  # noqa
                Crumb(name=invoice_sno, path="customs/invoice/" + invoice_sno)
            ],  # noqa
        }
        return render_template('customs_invoice_detail.html',
                               stage=stage,
                               pagetitle=invoice_sno + " Customs Document Set")
Пример #21
0
def new_indent(indent_sno=None):
    form = CreateIndentForm(parent_indent_sno=indent_sno)
    stage = {'crumbroot': '/inventory'}
    if form.validate_on_submit():
        try:
            with get_session() as session:
                sno = form.indent_sno.sno.data
                if not sno:
                    if indent_sno is not None:
                        sno = form.get_supplementary_sno_default()
                        register_serialno(sno=sno,
                                          efield="WEB FRONTEND INDENT",
                                          session=session)
                    else:
                        sno = get_serialno(series='IDT',
                                           efield='WEB FRONTEND INDENT',
                                           register=True,
                                           session=session)
                else:
                    # additional sno validation?
                    pass
                nindent = InventoryIndent(sno=sno, session=session)
                # Construct COBOM
                obom = create_obom_from_listing(form.components.data,
                                                'MANUAL (WEB)')
                cobom = CompositeOutputBom([obom],
                                           name='MANUAL (WEB) {0}'.format(sno))

                requested_by = get_username_from_full_name(
                    full_name=form.user.data, session=session)

                icparams = {
                    'cobom': cobom,
                    'title': form.indent_title.data,
                    'desc': form.indent_desc.data,
                    'requested_by': requested_by,
                    'rdate': form.rdate.data or arrow.utcnow(),
                    'indent_type': form.indent_type.data,
                }
                nindent.create(**icparams)

                root_order_sno = form.root_order_sno.data
                prod_order_sno = form.prod_order_sno.data
                try:
                    nindent.define_auth_chain(prod_order_sno=prod_order_sno,
                                              root_order_sno=root_order_sno,
                                              session=session)
                except AuthChainNotValidError:
                    raise
                nindent.register_auth_chain(session=session)

                fe_workspace_path = os.path.join(TEMPDIR, 'frontend')
                if not os.path.exists(fe_workspace_path):
                    os.makedirs(fe_workspace_path)
                workspace_path = os.path.join(fe_workspace_path,
                                              get_tempname())
                os.makedirs(workspace_path)

                nindent.process(outfolder=workspace_path,
                                register=True,
                                session=session)

                shutil.rmtree(workspace_path)
            return redirect(url_for('.indent', indent_sno=str(sno)))
        except AuthChainNotValidError:
            stage['auth_not_valid'] = True

    if indent_sno is None:
        stage_crumbs = {
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Indent", path="indent/"),
                Crumb(name="New", path="indent/new")
            ],
        }
        pagetitle = "Create New Indent"
    else:
        stage_crumbs = {
            'breadcrumbs': [
                Crumb(name="Inventory", path=""),
                Crumb(name="Indent", path="indent/"),
                Crumb(name=indent_sno, path="indent/" + indent_sno),
                Crumb(name="New",
                      path='/'.join(["indent", indent_sno, "/new"])),
            ]
        }
        pagetitle = "New Supplementary Indent for " + indent_sno
    stage.update(stage_crumbs)
    return render_template('indent_new.html',
                           stage=stage,
                           form=form,
                           pagetitle=pagetitle)
Пример #22
0
def new_production_order():
    form = CreateProductionOrderForm()
    stage = {'crumbroot': '/production'}
    if form.validate_on_submit():
        try:
            sno = form.prod_order_sno.sno.data
            with get_session() as session:
                title = form.prod_order_title.data.strip()
                if not sno:
                    sno = get_serialno(series='PROD',
                                       efield=title,
                                       register=True,
                                       session=session)
                else:
                    # additional sno validation?
                    pass

                cards = {
                    x['ident']: int(x['qty'])
                    for x in form.modules.data if x['ident']
                }
                deltas = [{
                    'orig-cardname': x['orig_cardname'],
                    'target-cardname': x['target_cardname'],
                    'sno': x['sno']
                } for x in form.deltas.data if x['sno']]
                requested_by = get_username_from_full_name(
                    full_name=form.user.data, session=session)
                # Construct Production Order
                prod_order = order.ProductionOrder(sno=sno)
                prod_order.create(
                    title=form.prod_order_title.data.strip(),
                    desc=form.desc.data.strip(),
                    cards=cards,
                    deltas=deltas,
                    sourcing_order_snos=None,
                    root_order_snos=form.root_order_sno.data,
                    ordered_by=requested_by,
                )
                # Check for Authorization
                # Nothing right now.
                # Create Order

                # TODO detach at this point
                fe_workspace_path = os.path.join(TEMPDIR, 'frontend')
                if not os.path.exists(fe_workspace_path):
                    os.makedirs(fe_workspace_path)
                workspace_path = os.path.join(fe_workspace_path,
                                              get_tempname())
                os.makedirs(workspace_path)
                prod_order.process(outfolder=workspace_path,
                                   register=True,
                                   session=session)
                shutil.rmtree(workspace_path)
                # Redirect to Created Order
            return redirect(url_for('.production_orders', order_sno=str(sno)))
        except AuthChainNotValidError:
            stage['auth_not_valid'] = True

    stage_crumbs = {
        'breadcrumbs': [
            Crumb(name="Production", path=""),
            Crumb(name="Orders", path="order/"),
            Crumb(name="New", path="order/new")
        ],
    }
    stage.update(stage_crumbs)
    pagetitle = "Create New Production Order"
    return render_template('production_order_new.html',
                           stage=stage,
                           form=form,
                           pagetitle=pagetitle)