API Reference¶
ScaffoldReport¶
-
class
scaffold_report.report.ScaffoldReport[source]¶ Bases:
objectBase class for any actual scaffold reports A scaffold report is named after UI effects for moving various filters and previews into the report building screen. All reports require customized options set by the programmer.
-
name= ''¶ Unique name of report.
-
name_verbose= None¶ Verbose name of report to show users.
-
model= None¶ Base model for this report’s queryset.
-
preview_fields= ['id']¶ Array of field names to show on previews.
-
num_preview= 3¶ How many objects in the queryset should be show in preview.
-
filters= []¶ Filters that can be applied to the report.
Buttons will show in sidebar area. These can be premade reports and give the user more options than just clicking submit
-
permissions_required= []¶ Report is only viewable to those with these permissions. Will default to the model’s change permission if not set
-
appy_template= None¶ A statically defined template. Could override get_template instead.
-
get_appy_template()[source]¶ Return a appy template This could be hard coded or perhaps get report_context from a filter.
-
get_name¶ Return name_verbose if it has been set; otherwise return name. Replaces all spaces with underscores.
-
-
class
scaffold_report.report.ReportButton[source]¶ Bases:
objectAn alternative way to submit a report. Could be used for one off reports that behave differently.
-
name= ''¶ For button name attr
-
value= ''¶ For button value attr
-
accepts_queryset= True¶ When true the queryset is processed first (so filters will run) and passed to get_report
-
get_name¶ Return name_verbose if it has been set; otherwise return name. Replaces all spaces with underscores.
-
Filters¶
-
class
scaffold_report.filters.Filter(**kwargs)[source]¶ Bases:
objectA customized filter for querysets
-
name= None¶ Unique name of filter
-
verbose_name= None¶ Human readable name of filter
-
template_name= None¶ If set the filter will render using this django template If not set the filter will render using scaffold_report/filter.html
-
fields= None¶ Define fields here that will be appended together to make a generic form
-
form_class= None¶ Optional form class to use.
-
form= None¶ Optional form. If not set, an instance of the form_class will be used
-
raw_form_data= None¶ uncleaned_form data from the post
-
add_fields= []¶ Add these fields to the preview and spreadsheet reports
-
default= False¶ Show this filter as on by default
-
can_remove= True¶ User is able to delete this filter. Should be used with default = True.
-
can_add= True¶ User is able to add this filter
-
queryset_filter(queryset, report_context=None, form=None)[source]¶ Allow custom handeling of queryset Must return the queryset.
-
-
class
scaffold_report.filters.DecimalCompareFilter(**kwargs)[source]¶ Bases:
scaffold_report.filters.FilterX greater, less, etc than decimal field
-
class
scaffold_report.filters.ModelChoiceFilter(**kwargs)[source]¶ Bases:
scaffold_report.filters.FilterSelect object from a queryset
-
compare_field_string= None¶ String used in the Django orm filter function. See queryset_filter()
-
model= None¶ Model used for queryset. Set this for any object of such model.
-
queryset= None¶ queryset that populates the widget. Model is not needed if this is set.
-
-
class
scaffold_report.filters.ModelMultipleChoiceFilter(**kwargs)[source]¶ Bases:
scaffold_report.filters.ModelChoiceFilterSelect multiple objects from a queryset
-
class
scaffold_report.filters.IntCompareFilter(**kwargs)[source]¶ Bases:
scaffold_report.filters.DecimalCompareFilterx greater, less, etc than int field