seshat.apps.rt.views

Functions

confirm_delete_view(request, model_class, pk, var_name)

View function to confirm the deletion of an object.

delete_object_view(request, model_class, pk, var_name)

View function to delete an object.

download_csv_all_rt(request)

Download all data for all models in the RT app.

download_csv_government_restrictions(request)

Download all data for the Government Restrictions model in the RT app.

download_csv_religious_landscape(request)

Download all data for the Religious Landscape model in the RT app.

download_csv_societal_restrictions(request)

Download all data for the Societal Restrictions model in the RT app.

dynamic_create_view(request, form_class, x_name, ...)

View function for the create page of a model.

dynamic_detail_view(request, pk, model_class, myvar, ...)

View function for the detail page of a model.

dynamic_update_view(request, object_id, form_class, ...)

dynamic_update_view_old(request, object_id, ...)

View function for the update page of a model.

generic_download(request, model_class, var_name)

Download all data for a given model.

generic_list_view(request, model_class, var_name, ...)

View function for the list page of a model.

generic_metadata_download(request, var_name, ...)

Download metadata for a given model.

get_ref_options(request)

has_add_capital_permission(user)

Check if the user has the 'core.add_capital' permission.

rtvars(request)

View function for the RT variables page.

rtvarsold(request)

show_problematic_rt_data_table(request)

View that shows a table of problematic data in the RT app.

Module Contents

seshat.apps.rt.views.confirm_delete_view(request, model_class, pk, var_name)

View function to confirm the deletion of an object.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • model_class (Model) – The model class of the object.

  • pk (int) – The primary key of the object.

  • var_name (str) – The variable name.

Returns:

The response object that contains the rendered confirmation page.

Return type:

HttpResponse

seshat.apps.rt.views.delete_object_view(request, model_class, pk, var_name)

View function to delete an object.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • model_class (Model) – The model class of the object.

  • pk (int) – The primary key of the object.

  • var_name (str) – The variable name.

Returns:

The response object that contains the rendered confirmation page.

Return type:

HttpResponse

seshat.apps.rt.views.download_csv_all_rt(request)

Download all data for all models in the RT app.

Note

The access to this view is restricted to users with the ‘core.view_capital’ permission.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.download_csv_government_restrictions(request)

Download all data for the Government Restrictions model in the RT app.

Note

The access to this view is restricted to users with the ‘core.view_capital’ permission.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.download_csv_religious_landscape(request)

Download all data for the Religious Landscape model in the RT app.

Note

The access to this view is restricted to users with the ‘core.view_capital’ permission.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.download_csv_societal_restrictions(request)

Download all data for the Societal Restrictions model in the RT app.

Note

The access to this view is restricted to users with the ‘core.view_capital’ permission.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.dynamic_create_view(request, form_class, x_name, myvar, my_exp, var_section, var_subsection)

View function for the create page of a model.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • form_class (Form) – The form class used to create the object.

  • x_name (str) – The variable name.

  • myvar (str) – The variable name.

  • my_exp (str) – The variable explanation.

  • var_section (str) – The section name.

  • var_subsection (str) – The subsection name.

Returns:

The response object that contains the rendered create page.

Return type:

HttpResponse

seshat.apps.rt.views.dynamic_detail_view(request, pk, model_class, myvar, var_name_display)

View function for the detail page of a model.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • pk (int) – The primary key of the object.

  • model_class (Model) – The model class of the object.

  • myvar (str) – The variable name.

  • var_name_display (str) – The variable name to display.

Returns:

The response object that contains the rendered detail page.

Return type:

HttpResponse

seshat.apps.rt.views.dynamic_update_view(request, object_id, form_class, model_class, x_name, myvar, my_exp, var_section, var_subsection, delete_url_name)
seshat.apps.rt.views.dynamic_update_view_old(request, object_id, form_class, model_class, x_name, myvar, my_exp, var_section, var_subsection, delete_url_name)

View function for the update page of a model.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • object_id (int) – The primary key of the object.

  • form_class (Form) – The form class used to update the object.

  • model_class (Model) – The model class of the object.

  • x_name (str) – The variable name.

  • myvar (str) – The variable name.

  • my_exp (str) – The variable explanation.

  • var_section (str) – The section name.

  • var_subsection (str) – The subsection name.

  • delete_url_name (str) – The URL name for deleting the object.

Returns:

The response object that contains the rendered update page.

Return type:

HttpResponse

seshat.apps.rt.views.generic_download(request, model_class, var_name)

Download all data for a given model.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • model_class (Model) – The model class of the object.

  • var_name (str) – The variable name.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.generic_list_view(request, model_class, var_name, var_name_display, var_section, var_subsection, var_main_desc)

View function for the list page of a model.

Note

This function is a generic view function that can be used for any model. The access to this view is restricted to users with the ‘core.add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • model_class (Model) – The model class of the object.

  • var_name (str) – The variable name.

  • var_name_display (str) – The variable name to display.

  • var_section (str) – The section name.

  • var_subsection (str) – The subsection name.

  • var_main_desc (str) – The main description.

Returns:

The response object that contains the rendered list page.

Return type:

HttpResponse

seshat.apps.rt.views.generic_metadata_download(request, var_name, var_name_display, var_section, var_subsection, var_main_desc)

Download metadata for a given model.

Note

This function is a generic view function that can be used for any model. This view is only accessible to users with the ‘add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object used to generate this page.

  • var_name (str) – The variable name.

  • var_name_display (str) – The variable name to display.

  • var_section (str) – The section name.

  • var_subsection (str) – The subsection name.

  • var_main_desc (str) – The main description.

Returns:

The response object that contains the CSV file.

Return type:

HttpResponse

seshat.apps.rt.views.get_ref_options(request)
seshat.apps.rt.views.has_add_capital_permission(user)

Check if the user has the ‘core.add_capital’ permission.

Note

TODO This is built-in functionality in Django. You can use the built-in permission_required decorator instead.

Parameters:

user (User) – The user object.

Returns:

True if the user has the ‘core.add_capital’ permission, False otherwise.

Return type:

bool

seshat.apps.rt.views.rtvars(request)

View function for the RT variables page.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the rendered RT variables page.

Return type:

HttpResponse

seshat.apps.rt.views.rtvarsold(request)
seshat.apps.rt.views.show_problematic_rt_data_table(request)

View that shows a table of problematic data in the RT app.

Note

The access to this view is restricted to users with the ‘core.view_capital’ permission.

Parameters:

request (HttpRequest) – The request object used to generate this page.

Returns:

The response object that contains the rendered problematic data table.

Return type:

HttpResponse