def setHelper(self): for fld in self.fields.keys(): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": u"Update {}".format(self.instance), "help_text": u"Update an existing data-pivot.", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": u"Create new data-pivot", "help_text": u""" Create a custom-visualization for this assessment. Generally, you will select a subset of available data, then customize the visualization the next-page. """, "cancel_url": self.instance.get_list_url(self.instance.assessment.id) } helper = BaseFormHelper(self, **inputs) helper.form_class = None return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' inputs = { "legend_text": "Password reset", "help_text": "Enter a new password for your account." } helper = BaseFormHelper(self, **inputs) helper.form_class = "loginForm" helper.layout.append( cfb.FormActions( cfl.Submit('submit', 'Change password'), cfl.HTML( """<a role="button" class="btn btn-default" href="{}">Cancel</a>""" .format(reverse('user:login'))), )) return helper
def setHelper(self): self.fields['description'].widget.attrs['rows'] = 4 for fld in list(self.fields.keys()): self.fields[fld].widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": "Update dosing regime", "help_text": "Update an existing dosing-regime.", "cancel_url": self.instance.dosed_animals.get_absolute_url() } else: inputs = { "legend_text": "Create new dosing-regime", "help_text": """ Create a new dosing-regime. Each dosing-regime is one protocol for how animals were dosed. Multiple different dose-metrics can be associated with one dosing regime. If this is a generational-experiment, you may not need to create a new dosing-regime, but could instead specify the dosing regime of parents or other ancestors.""", } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.form_id = "dosing_regime" helper.add_fluid_row('route_of_exposure', 3, "span4") helper.add_fluid_row('num_dose_groups', 3, "span4") return helper
def setHelper(self): for fld in self.fields.keys(): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": u"Update {}".format(self.instance), "help_text": u"Update an existing visualization.", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": u"Create new visualization", "help_text": u""" Create a custom-visualization. Generally, you will select a subset of available data on the "Data" tab, then will customize the visualization using the "Settings" tab. To view a preview of the visual at any time, select the "Preview" tab. """, "cancel_url": self.instance.get_list_url(self.instance.assessment.id) } helper = BaseFormHelper(self, **inputs) helper.form_class = None return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) not in [forms.CheckboxInput, forms.CheckboxSelectMultiple]: widget.attrs['class'] = 'span12' helper = BaseFormHelper(self) helper.form_method = "GET" helper.form_class = None helper.add_fluid_row('studies', 4, "span3") helper.add_fluid_row('species', 4, "span3") helper.add_fluid_row('name', 4, "span3") helper.add_fluid_row('tags', 4, "span3") helper.layout.append( cfb.FormActions( cfl.Submit('submit', 'Apply filters'), ) ) return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in self.fields.keys(): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 widget.attrs['class'] += " html5text" if self.instance.id: inputs = { "legend_text": u"Update {}".format(self.instance), "help_text": u"Update an existing HAWC assessment.<br><br>* required fields", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": u"Create new assessment", "help_text": u""" Assessments are the fundamental objects in HAWC; all data added to the tool will be related to an assessment. The settings below are used to describe the basic characteristics of the assessment, along with setting up permissions for role-based authorization and access for viewing and editing content associated with an assessment.<br><br>* required fields""", "cancel_url": reverse_lazy('portal') } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('name', 2, "span6") helper.add_fluid_row('version', 2, "span6") helper.add_fluid_row('project_manager', 3, "span4") return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 if self.instance.id: if self.instance.outcome: url = self.instance.outcome.get_absolute_url() else: url = self.instance.study_population.get_absolute_url() inputs = { "legend_text": "Update {}".format(self.instance), "help_text": self.HELP_TEXT_UPDATE, "cancel_url": url } else: inputs = { "legend_text": "Create new comparison set", "cancel_url": self.parent.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 if self.instance.id: inputs = { 'legend_text': 'Update {}'.format(self.instance), 'help_text': self.HELP_TEXT_UPDATE, 'cancel_url': self.instance.get_absolute_url() } else: inputs = { 'legend_text': 'Create new experiment', 'help_text': self.HELP_TEXT_CREATE, 'cancel_url': self.instance.study.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('name', 2, 'span6') helper.add_fluid_row('transfection', 2, 'span6') helper.add_fluid_row('dosing_notes', 2, 'span6') helper.add_fluid_row('has_positive_control', 2, 'span6') helper.add_fluid_row('has_negative_control', 2, 'span6') helper.add_fluid_row('has_vehicle_control', 2, 'span6') helper.add_fluid_row('control_notes', 2, 'span6') return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 if self.instance.id: inputs = { 'legend_text': 'Update {}'.format(self.instance), 'help_text': self.HELP_TEXT_UPDATE, 'cancel_url': self.instance.get_absolute_url() } else: inputs = { 'legend_text': 'Create new experimental chemical', 'help_text': self.HELP_TEXT_CREATE, 'cancel_url': self.instance.study.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('name', 3, 'span4') helper.add_fluid_row('source', 3, 'span4') helper.add_fluid_row('purity_confirmed_notes', 2, 'span6') return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' inputs = {"legend_text": "Create an account"} helper = BaseFormHelper(self, **inputs) helper.form_class = "loginForm" helper.layout.extend([ cfl.HTML( '''<a class="btn btn-small" href="#license_modal" data-toggle="modal">View License</a>''' ), cfb.FormActions( cfl.Submit('login', 'Create account'), cfl.HTML( """<a role="button" class="btn btn-default" href="{}">Cancel</a>""" .format(reverse('user:login'))), ) ]) return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' inputs = {"legend_text": "HAWC login"} helper = BaseFormHelper(self, **inputs) helper.form_class = "loginForm" helper.layout.append( cfb.FormActions( cfl.Submit('login', 'Login'), cfl.HTML( """<a role="button" class="btn btn-default" href="{}">Cancel</a>""" .format(reverse('home'))), cfl.HTML("""<br><br>"""), cfl.HTML( """<a href="{0}">Forgot your password?</a><br>""".format( reverse('user:reset_password'))), cfl.HTML("""<a href="{0}">Create an account</a><br>""".format( reverse('user:new'))))) return helper
def setHelper(self): inputs = { 'cancel_url': reverse('riskofbias:arob_update', args=[self.instance.assessment.pk]) } helper = BaseFormHelper(self, **inputs) return helper
def setHelper(self): inputs = { 'legend_text': 'Upload full-text URLs', 'help_text': 'Using an Excel file, upload full-text URLs for multiple references', 'cancel_url': reverse_lazy('lit:overview', args=[self.assessment.id]) } helper = BaseFormHelper(self, **inputs) return helper
def setHelper(self): if self.instance.id: inputs = { "legend_text": "Update {}".format(self.instance), "help_text": "Update an existing endpoint.", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": "Create new endpoint", "help_text": """ Create a new endpoint. An endpoint should describe one measure-of-effect which was measured in the study. It may or may not contain quantitative data. For endpoint terminology, use the reference document "<a href="https://hawcprd.epa.gov/assessment/100000039/">Recommended Terminology for Outcomes/Endpoints</a>." """, "cancel_url": self.instance.animal_group.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.form_id = "endpoint" self.fields['diagnostic'].widget.attrs['rows'] = 2 for fld in ('results_notes', 'endpoint_notes', 'power_notes'): self.fields[fld].widget.attrs['rows'] = 3 # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: if fld in ["effects"]: widget.attrs['class'] = 'span10' else: widget.attrs['class'] = 'span12' helper.add_fluid_row('system', 4, "span3") helper.add_fluid_row('effects', 2, "span6") helper.add_fluid_row('observation_time', 3, "span4") helper.add_fluid_row('data_reported', 3, "span4") helper.add_fluid_row('data_type', 3, "span4") helper.add_fluid_row('response_units', 3, "span4") helper.add_fluid_row('NOEL', 4, "span3") helper.add_fluid_row('statistical_test', 3, ["span6", "span3", "span3"]) helper.add_fluid_row('litter_effects', 2, "span6") url = reverse('assessment:effect_tag_create', kwargs={'pk': self.instance.assessment.pk}) helper.addBtnLayout(helper.layout[4], 0, url, "Add new effect tag", "span6") return helper
def setHelper(self): inputs = { 'legend_text': 'Copy study evaluation approach from existing assessments', # noqa 'help_text': 'Copy study evaluation metrics and domains from an existing HAWC assessment which you have access to.', # noqa 'cancel_url': reverse('riskofbias:arob_detail', args=[self.assessment.id]) } helper = BaseFormHelper(self, **inputs) helper.layout.insert(3, cfl.Div(css_id='extra_content_insertion')) helper.form_class = None return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if fld == "group": widget.attrs['class'] = "groupField" widget.attrs['style'] = "display: none;" if fld == "n": widget.attrs['class'] = "nField" helper = BaseFormHelper(self) helper.form_tag = False return helper
def setHelper(self): for fld in [ "inclusion_criteria", "exclusion_criteria", "confounding_criteria" ]: self.fields[fld].widget.update_query_parameters( {'related': self.instance.study.assessment_id}) for fld in self.fields.keys(): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: if fld in [ 'inclusion_criteria', 'exclusion_criteria', 'confounding_criteria' ]: widget.attrs['class'] = 'span11' else: widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": u"Update {}".format(self.instance), "help_text": u"Update an existing study-population.", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": u"Create new study-population", "help_text": u""" Create a new study population. Each study-population is a associated with an epidemiology study. There may be multiple study populations with a single study, though this is typically unlikely.""", "cancel_url": self.instance.study.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('name', 2, "span6") helper.add_fluid_row('country', 3, "span4") helper.add_fluid_row('sex', 4, "span3") helper.add_fluid_row('n', 2, "span6") helper.add_fluid_row('age_mean', 3, "span4") helper.add_fluid_row('age_description', 3, "span4") helper.add_fluid_row('age_lower', 4, "span3") url = '{% url "epi:studycriteria_create" assessment.pk %}' helper.add_adder("addIncCriteria", "Add new criteria", url) helper.add_adder("addExcCriteria", "Add new criteria", url) helper.add_adder("addConCriteria", "Add new criteria", url) return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: if fld in self.ADJUSTMENT_FIELDS or fld == "resulttags": widget.attrs['class'] = 'span10' else: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 if self.instance.id: inputs = { "legend_text": "Update {}".format(self.instance), "help_text": self.HELP_TEXT_UPDATE, "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": "Create new set of results", "help_text": self.HELP_TEXT_CREATE, "cancel_url": self.instance.outcome.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('name', 2, "span6") helper.add_fluid_row('metric', 3, "span4") helper.add_fluid_row('data_location', 2, "span6") helper.add_fluid_row('dose_response', 3, "span4") helper.add_fluid_row('statistical_power', 4, "span3") helper.add_fluid_row('factors_applied', 2, "span6") helper.add_fluid_row('estimate_type', 3, "span4") helper.add_fluid_row("resulttags", 1, "span6") url = reverse('assessment:effect_tag_create', kwargs={'pk': self.instance.outcome.assessment_id}) helper.addBtnLayout(helper.layout[8], 0, url, "Add new result tag", "span6") url = reverse('epi:adjustmentfactor_create', kwargs={'pk': self.instance.outcome.assessment_id}) # remove magic number 9; breaks if we change number of elements in the form. This still isn't great; what if comments went away? btn_target_idx = helper.find_layout_idx_for_field_name('comments') - 1 helper.addBtnLayout(helper.layout[btn_target_idx], 0, url, "Add new adjustment factor", "span6") helper.addBtnLayout(helper.layout[btn_target_idx], 1, url, "Add new adjustment factor", "span6") return helper
def setHelper(self, assessment): self.fields['studies'].widget.attrs['size'] = 15 for fld in list(self.fields.keys()): self.fields[fld].widget.attrs['class'] = 'span12' inputs = { "legend_text": "Copy studies across assessments", "help_text": self.HELP_TEXT, "cancel_url": reverse("study:list", args=[assessment.id]), } helper = BaseFormHelper(self, **inputs) helper.form_class = None return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 self.fields['study'].widget.attrs["class"] += " studySearch" helper = BaseFormHelper(self) helper.form_class = None return helper
def setHelper(self): for fld in ('diagnostic_description', 'summary', 'prevalence_incidence', 'statistical_power_details', 'dose_response_details', 'statistical_metric_description'): self.fields[fld].widget.attrs['rows'] = 3 for fld in self.fields.keys(): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: if fld in [ "adjustment_factors", "confounders_considered", "effects" ]: widget.attrs['class'] = 'span11' else: widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": u"Update {}".format(self.instance), "help_text": self.HELP_TEXT_UPDATE, "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": u"Create new exposure", "help_text": self.HELP_TEXT_CREATE, "cancel_url": self.instance.exposure.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('effects', 2, "span6") helper.add_fluid_row('diagnostic', 2, "span6") helper.add_fluid_row('summary', 2, "span6") helper.add_fluid_row('adjustment_factors', 2, "span6") helper.add_fluid_row('dose_response', 2, "span6") helper.add_fluid_row('statistical_power', 2, "span6") helper.add_fluid_row('main_finding', 2, "span6") helper.add_fluid_row('statistical_metric', 2, "span6") url = "{% url 'assessment:effect_tag_create' assessment.pk %}" helper.add_adder("addEffectTags", "Add new effect tag", url) url = "{% url 'epi:factor_create' assessment.pk %}" helper.add_adder("addAdj", "Add new adjustment factor", url) helper.add_adder("addAdjCons", "Add new adjustment factor", url) return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if fld in ["species", "strain"]: widget.attrs['class'] = 'span10' else: widget.attrs['class'] = 'span12' if self.instance.id: inputs = { "legend_text": "Update {}".format(self.instance), "help_text": "Update an existing animal-group.", "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": "Create new animal-group", "help_text": """ Create a new animal-group. Each animal-group is a set of animals which are comparable for a given experiment. For example, they may be a group of F1 rats. Animal-groups may have different exposures or doses, but should be otherwise comparable.""", "cancel_url": self.instance.experiment.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.form_id = "animal_group" helper.add_fluid_row('species', 3, "span4") helper.add_fluid_row('lifestage_exposed', 2, "span6") assessment_id = self.instance.experiment.study.assessment.pk url = reverse('assessment:species_create', kwargs={'pk': assessment_id}) helper.addBtnLayout(helper.layout[3], 0, url, "Add new species", "span4") url = reverse('assessment:strain_create', kwargs={'pk': assessment_id}) helper.addBtnLayout(helper.layout[3], 1, url, "Add new strain", "span4") if "generation" in self.fields: helper.add_fluid_row('siblings', 3, "span4") helper.add_fluid_row('comments', 2, "span6") return helper
def set_helper(self): help_text = u""" Please enter your new password twice so we can verify you typed it in correctly. """ buttons = cfb.FormActions(cfl.Submit('submit', 'Change my password'), ) helper = BaseFormHelper( self, horizontal=False, legend_text='Update your password', help_text=help_text, buttons=buttons, ) helper.form_class = 'loginForm' return helper
def set_helper(self): buttons = cfb.FormActions( cfl.Submit('login', 'Create account'), cfl.HTML( '<a role="button" class="btn btn-default" href="{}">Cancel</a>' .format(reverse('user:login'))), ) helper = BaseFormHelper(self, horizontal=False, legend_text='Create an account', buttons=buttons) helper.form_class = 'loginForm' return helper
def setHelper(self): inputs = {"legend_text": u"Create an account"} helper = BaseFormHelper(self, **inputs) helper.form_class = "loginForm" helper.layout.append( cfb.FormActions( cfl.Submit('login', 'Create account'), cfl.HTML( """<a role="button" class="btn btn-default" href="{}">Cancel</a>""" .format(reverse('user:login'))), )) return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' inputs = { "legend_text": "Update your profile", "help_text": "Change settings associated with your account", "cancel_url": reverse('user:settings') } helper = BaseFormHelper(self, **inputs) return helper
def setHelper(self): for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: if fld in ["metric_units"]: widget.attrs['class'] = 'span10' else: widget.attrs['class'] = 'span12' if type(widget) == forms.Textarea: widget.attrs['rows'] = 3 if self.instance.id: inputs = { "legend_text": "Update {}".format(self.instance), "help_text": self.HELP_TEXT_UPDATE, "cancel_url": self.instance.get_absolute_url() } else: inputs = { "legend_text": "Create new exposure", "help_text": self.HELP_TEXT_CREATE, "cancel_url": self.instance.study_population.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None helper.add_fluid_row('inhalation', 6, "span2") helper.add_fluid_row('measured', 3, "span4") helper.add_fluid_row('metric_description', 3, "span4") helper.add_fluid_row('age_of_exposure', 3, "span6") url = reverse( 'assessment:dose_units_create', kwargs={'pk': self.instance.study_population.study.assessment_id}) helper.addBtnLayout(helper.layout[4], 2, url, "Create units", "span4") # we want a single "help text" that spans the chemical exposure route checkboxes (inhalation, dermal, oral, etc.) # if we just attach help_text attribute in the model, it will appear grouped with inhalation. Doing it this way gives # a little more layout control; just need to find the right spot to do it inhalation_idx = helper.find_layout_idx_for_field_name('inhalation') if inhalation_idx is not None: helper.layout[inhalation_idx].append( cfl.HTML('<div style="margin-bottom:20px">' + self.instance.ROUTE_HELP_TEXT + '</div>')) return helper
def setHelper(self): inputs = { "cancel_url": reverse('study:asq_update', args=[self.instance.assessment.pk]) } if self.instance.id: inputs["legend_text"] = u"Update risk-of-bias domain" inputs["help_text"] = u"Update an existing domain." else: inputs["legend_text"] = u"Create new risk-of-bias domain" inputs["help_text"] = u"Create a new risk-of-bias domain." helper = BaseFormHelper(self, **inputs) helper['name'].wrap(cfl.Field, css_class="span6") helper['description'].wrap(cfl.Field, css_class="html5text span12") return helper
def setHelper(self): inputs = { "legend_text": u"Update enabled modules", "help_text": u""" HAWC is composed of multiple modules, each designed to capture data and decisions related to specific components of a health assessment. This screen allows a project-manager to change which modules are enabled for this assessment. Modules can be enabled or disabled at any time; content already entered into a particular module will not be changed when enabling or disabling modules. """, "cancel_url": self.instance.get_absolute_url() } helper = BaseFormHelper(self, **inputs) helper.form_class = None return helper
def setHelper(self): # by default take-up the whole row-fluid for fld in list(self.fields.keys()): widget = self.fields[fld].widget if type(widget) != forms.CheckboxInput: widget.attrs['class'] = 'span12' inputs = { "legend_text": "Change your password", "help_text": "Enter a new password for your account.", "cancel_url": reverse("user:settings") } helper = BaseFormHelper(self, **inputs) return helper