seshat.apps.core.views

Attributes

POLITY_RELIGIOUS_TRADITION_CHOICES

app_map

categorical_variables

world_map_initial_displayed_year

world_map_initial_polity

Classes

CapitalCreate

Create a new Capital.

CapitalDelete

Delete a Capital.

CapitalListView

List all Capitals.

CapitalUpdate

Update a Capital.

CitationCreate

Create a new citation.

CitationDelete

Delete a citation.

CitationDetailView

Display the details of a citation.

CitationListView

List all citations.

CitationUpdate

Update a citation.

NgaCreate

Create a new NGA.

NgaDetailView

Show details of an NGA.

NgaListView

List all NGAs.

NgaUpdate

Update an NGA.

NlpReferenceListView

List all NLP references.

PolityCreate

Create a new Polity.

PolityDetailView

Show details of a polity.

PolityListView

List all polities.

PolityListView1

List all polities.

PolityListViewCommented

List all polities with comments.

PolityListViewLight

List all polities.

PolityListViewX

List all polities.

PolityListView_old

List all polities.

PolityUpdate

Update a Polity.

ReferenceCreate

Create a new reference.

ReferenceDelete

Delete a reference.

ReferenceDetailView

Display the details of a reference.

ReferenceListView

List all references.

ReferenceUpdate

Update a reference.

ReligionListView

List all religions.

SeshatCommentCreate

Create a new comment.

SeshatCommentDelete

Delete a comment.

SeshatCommentDetailView

Display the details of a comment.

SeshatCommentListView

List all comments.

SeshatCommentPartCreate

Create a new comment part.

SeshatCommentPartCreate2

Create a new comment part.

SeshatCommentPartDelete

Delete a comment part.

SeshatCommentPartDetailView

SeshatCommentPartListView

List all comment parts.

SeshatCommentPartListView3

List all comment parts.

SeshatCommentPartUpdate

Update a comment part.

SeshatCommentUpdate

Update a comment.

SeshatPrivateCommentPartCreate2

Create a new private comment part.

SeshatPrivateCommentPartUpdate

Update a private comment part.

SeshatPrivateCommentUpdate

View to update a SeshatPrivateComment instance.

Functions

account_activation_sent(request)

Render the account activation sent page.

activate(request, uidb64, token)

Activate user account.

ajax_test(request)

Test if the request is an AJAX request.

assign_categorical_variables_to_shapes(shapes, variables)

Assign the categorical variables to the shapes.

assign_variables_to_shapes(shapes, app_map)

Assign the absent/present variables to the shapes.

capital_download(request)

Download all Capitals as CSV.

cliopatria(request)

create_a_comment_with_a_subcomment_new(request, ...)

Create a Comment and assign it to a model instance.

create_a_comment_with_a_subcomment_newer(request, ...)

Create the first chunk of a new comment and assign it to a model instance and a seshat comment.

create_a_private_comment_with_a_private_subcomment_new(...)

Create a PrivateComment and assign it to a model instance.

discussion_room(request)

Render the discussion room page.

do_zotero(results)

Process the results from the Zotero API.

do_zotero_manually(results)

Process the results from the Zotero API.

download_csv_all_polities(request)

Download a CSV file containing all polities.

download_oldcsv(request, file_name)

Download a CSV file.

four_o_four(request)

Return a 404 error page.

get_all_polity_capitals()

Get capital cities for polities that have them.

get_or_create_citation(reference, page_from, page_to)

Get or create a Citation instance. If a matching citation already exists, it

get_polity_data_single(polity_id)

Get the data for a single polity. The returned data includes the number of

get_polity_shape_content([displayed_year, seshat_id, ...])

This function returns the polity shapes and other content for the map.

get_provinces([selected_base_map_gadm])

Get all the province or country shapes for the map base layer.

index(request)

Returns a simple "Hello World" response.

is_ajax(request)

Return True if the request is an AJAX request, False otherwise.

map_view_all(request)

This view is used to display a map with polities plotted on it. The view

map_view_all_with_vars(request)

This view is used to display a map with polities plotted on it. The view

map_view_initial(request)

nlp_datapoints(request)

Render the NLP data points page.

nlp_datapoints_2(request)

Render the NLP data points page.

no_zotero_refs_list(request)

List all references without a Zotero link.

polity_filter_options_view(request)

This view returns the options for the polity filter.

provinces_and_countries_view(request)

This view is used to get the provinces and countries for the map.

random_polity_shape([from_selection])

This function is used to get a pseudo-random polity for the map_view_initial and map_view_initial views to display.

reference_update_modal(request, pk)

Update a reference using a modal or a standalone page depending on the

references_download(request)

Download all references as a CSV file.

religion_create(request)

Create a new religion.

religion_update(request, pk)

Update an existing religion.

search_suggestions(request)

View to get search suggestions for a polity.

search_view(request)

View to search for a polity.

seshat_comment_part_create_from_null_view(request, ...)

Create a new comment part.

seshat_comment_part_create_from_null_view_OLD(request, ...)

Create a new comment part.

seshat_comment_part_create_from_null_view_inline(...)

seshat_private_comment_part_create_from_null_view(...)

Create a new private comment part.

seshatacknowledgements(request)

Return the Seshat "Acknowledgements" page.

seshatcodebooknew1(request)

seshatcodebookold(request)

Return the Seshat "Codebook" page.

seshatcomment_create_view(request)

View to create a SeshatComment instance.

seshatcommentpart_create_view(request)

Create a new SeshatCommentPart instance.

seshatcommentpart_create_view_old(request)

Create a new SeshatCommentPart instance.

seshatindex(request)

Render the Seshat landing page.

seshatindex2(request)

Return the Seshat landing page.

seshatmethods(request)

Return the Seshat "Methods" page.

seshatolddownloads(request)

Return the Seshat "Downloads" page.

seshatwhoweare(request)

Return the Seshat "Who We are" page.

signup_traditional(request)

Handle user signup.

signupfollowup(request)

Handle user signup follow-up.

synczotero(request)

This function is used to sync the Zotero data with the database.

synczotero100(request)

This function is used to sync the Zotero data with the database.

synczoteromanually(request)

This function is used to manually input the references from the Zotero data

update_citations(request)

This function takes all the references and build a citation for them.

update_citations_from_inside_zotero_update()

This function takes all the references and build a citation for them.

update_seshat_comment_part_view(request, pk)

View to update a SeshatCommentPart instance.

variablehierarchysetting(request)

Handle variable hierarchy setting. This is a view for the admin to set the

xxyyzz(request, com_id)

Module Contents

class seshat.apps.core.views.CapitalCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

Create a new Capital.

form_class
model
permission_required = 'core.add_capital'
success_message = 'You successfully created a new Capital.'
success_url
template_name = 'core/capital/capital_form_create.html'
class seshat.apps.core.views.CapitalDelete

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a Capital.

model
permission_required = 'core.add_capital'
success_message = 'You successfully deleted one Capital.'
success_url
template_name = 'core/delete_general.html'
class seshat.apps.core.views.CapitalListView

Bases: django.views.generic.ListView

List all Capitals.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

model
template_name = 'core/capital/capital_list.html'
class seshat.apps.core.views.CapitalUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update a Capital.

form_class
model
permission_required = 'core.add_capital'
success_message = 'You successfully updated the Capital.'
success_url
template_name = 'core/capital/capital_form.html'
class seshat.apps.core.views.CitationCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

Create a new citation.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
success_message = 'Yoohoooo...'
template_name = 'core/references/citation_form.html'
class seshat.apps.core.views.CitationDelete

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a citation.

model
permission_required = 'core.add_capital'
success_url
template_name = 'core/delete_general.html'
class seshat.apps.core.views.CitationDetailView

Bases: django.views.generic.DetailView

Display the details of a citation.

model
template_name = 'core/references/citation_detail.html'
class seshat.apps.core.views.CitationListView

Bases: django.views.generic.ListView

List all citations.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

model
paginate_by = 20
template_name = 'core/references/citation_list.html'
class seshat.apps.core.views.CitationUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update a citation.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
success_message = 'Yoohoooo...'
template_name = 'core/references/citation_update.html'
class seshat.apps.core.views.NgaCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new NGA.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_class
model
permission_required = 'core.add_capital'
success_url
template_name = 'core/nga/nga_form.html'
class seshat.apps.core.views.NgaDetailView

Bases: django.views.generic.DetailView

Show details of an NGA.

model
template_name = 'core/nga/nga_detail.html'
class seshat.apps.core.views.NgaListView

Bases: django.views.generic.ListView

List all NGAs.

model
template_name = 'core/nga/nga_list.html'
class seshat.apps.core.views.NgaUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update an NGA.

form_class
model
permission_required = 'core.add_capital'
success_message = 'You successfully updated the Nga.'
success_url
template_name = 'core/nga/nga_update.html'
class seshat.apps.core.views.NlpReferenceListView

Bases: django.views.generic.ListView

List all NLP references.

get_absolute_url()

Return the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_queryset()

Return the queryset of NLP references.

Returns:

The queryset of NLP references.

Return type:

QuerySet

model
paginate_by = 50
template_name = 'core/references/nlp_reference_list.html'
class seshat.apps.core.views.PolityCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new Polity.

form_invalid(form)
form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_class
model
permission_required = 'core.add_capital'
success_url
template_name = 'core/polity/polity_form.html'
class seshat.apps.core.views.PolityDetailView

Bases: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.DetailView

Show details of a polity.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

get_object(queryset=None)

Get the object of the view.

Parameters:

queryset – The queryset to use.

Returns:

The object of the view.

Return type:

Polity

Raises:
  • Http404 – If no polity matches the given name.

  • Http404 – If multiple polities are found with the same name.

model
template_name = 'core/polity/polity_detail.html'
class seshat.apps.core.views.PolityListView

Bases: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
template_name = 'core/polity/polity_list.html'
class seshat.apps.core.views.PolityListView1

Bases: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities.

Note

This class is not used in the current implementation.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
template_name = 'core/polity/polity_list.html'
class seshat.apps.core.views.PolityListViewCommented

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities with comments.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
permission_required = 'core.add_seshatprivatecommentpart'
template_name = 'core/polity/polity_list_commented.html'
class seshat.apps.core.views.PolityListViewLight

Bases: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
template_name = 'core/polity/polity_list_light.html'
class seshat.apps.core.views.PolityListViewX

Bases: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities.

Note

This class is not used in the current implementation.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
template_name = 'core/polity/polity_list.html'
class seshat.apps.core.views.PolityListView_old

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.ListView

List all polities.

Note

This class is not used in the current implementation.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

model
permission_required = 'core.add_capital'
template_name = 'core/polity/polity_list.html'
class seshat.apps.core.views.PolityUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update a Polity.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

get_success_url()
form_class
model
permission_required = 'core.add_capital'
success_message = 'You successfully updated the Polity.'
template_name = 'core/polity/polity_form.html'
class seshat.apps.core.views.ReferenceCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new reference.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/references/reference_form.html'
class seshat.apps.core.views.ReferenceDelete

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a reference.

model
permission_required = 'core.add_capital'
success_url
template_name = 'core/delete_general.html'
class seshat.apps.core.views.ReferenceDetailView

Bases: django.views.generic.DetailView

Display the details of a reference.

model
template_name = 'core/references/reference_detail.html'
class seshat.apps.core.views.ReferenceListView

Bases: django.views.generic.ListView

List all references.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_queryset()

Get the queryset of references.

Returns:

The queryset of references.

Return type:

QuerySet

model
paginate_by = 100
template_name = 'core/references/reference_list.html'
class seshat.apps.core.views.ReferenceUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a reference.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/references/reference_update.html'
class seshat.apps.core.views.ReligionListView

Bases: django.views.generic.ListView

List all religions.

context_object_name = 'religions'
model
ordering = ['religion_name']
permission_required = 'core.add_seshatprivatecommentpart'
template_name = 'core/religion_list.html'
class seshat.apps.core.views.SeshatCommentCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new comment.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/seshatcomments/seshatcomment_form.html'
class seshat.apps.core.views.SeshatCommentDelete

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a comment.

model
permission_required = 'core.add_capital'
success_url
template_name = 'core/delete_general.html'
class seshat.apps.core.views.SeshatCommentDetailView

Bases: django.views.generic.DetailView

Display the details of a comment.

model
template_name = 'core/seshatcomments/seshatcomment_detail.html'
class seshat.apps.core.views.SeshatCommentListView

Bases: django.views.generic.ListView

List all comments.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

model
paginate_by = 20
template_name = 'core/seshatcomments/seshatcomment_list.html'
class seshat.apps.core.views.SeshatCommentPartCreate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new comment part.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/seshatcomments/seshatcommentpart_form.html'
class seshat.apps.core.views.SeshatCommentPartCreate2

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new comment part.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/seshatcomments/seshatcommentpart_form_prefilled.html'
class seshat.apps.core.views.SeshatCommentPartDelete

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.DeleteView

Delete a comment part.

get_success_url()
model
permission_required = 'core.add_capital'
template_name = 'core/delete_general.html'
class seshat.apps.core.views.SeshatCommentPartDetailView

Bases: django.views.generic.DetailView

model
template_name = 'core/seshatcomments/seshatcommentpart_detail.html'
class seshat.apps.core.views.SeshatCommentPartListView

Bases: django.views.generic.ListView

List all comment parts.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

model
paginate_by = 20
template_name = 'core/seshatcomments/seshatcommentpart_list.html'
class seshat.apps.core.views.SeshatCommentPartListView3

Bases: django.views.generic.ListView

List all comment parts.

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

model
paginate_by = 20
template_name = 'core/seshatcomments/seshatcommentpart_list3.html'
class seshat.apps.core.views.SeshatCommentPartUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update a comment part.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
success_message = 'You successfully updated the subdescription.'
template_name = 'core/seshatcomments/seshatcommentpart_update.html'
class seshat.apps.core.views.SeshatCommentUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView

Update a comment.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_capital'
template_name = 'core/seshatcomments/seshatcomment_update.html'
class seshat.apps.core.views.SeshatPrivateCommentPartCreate2

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.CreateView

Create a new private comment part.

form_invalid(form)

Handle invalid form data.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

form_valid(form)

Validate the form.

Parameters:

form (Form) – The form object.

Returns:

The response object.

Return type:

HttpResponse

get_absolute_url()

Get the absolute URL of the view.

Returns:

The absolute URL of the view.

Return type:

str

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_seshatprivatecommentpart'
template_name = 'core/seshatcomments/seshatprivatecommentpart_form_prefilled.html'
class seshat.apps.core.views.SeshatPrivateCommentPartUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

Update a private comment part.

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

form_class
model
permission_required = 'core.add_seshatprivatecommentpart'
success_message = 'You successfully updated the Private comment.'
template_name = 'core/seshatcomments/seshatprivatecommentpart_update2.html'
class seshat.apps.core.views.SeshatPrivateCommentUpdate

Bases: django.contrib.auth.mixins.PermissionRequiredMixin, django.views.generic.edit.UpdateView, django.views.generic.edit.FormMixin

View to update a SeshatPrivateComment instance.

get_another_form(request, *args, **kwargs)

Return the data from another form in the SeshatPrivateCommentPartForm.

Parameters:
  • request – The request object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

The form instance.

Return type:

SeshatPrivateCommentPartForm

get_context_data(**kwargs)

Get the context data of the view.

Noindex:

Parameters:

**kwargs – Arbitrary keyword arguments.

Returns:

The context data of the view.

Return type:

dict

post(request, *args, **kwargs)

Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.

Parameters:
  • request – The request object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

The HTTP response.

Return type:

HttpResponse

form_class
model
permission_required = 'core.add_seshatprivatecommentpart'
template_name = 'core/seshatcomments/seshatprivatecomment_update.html'
seshat.apps.core.views.account_activation_sent(request)

Render the account activation sent page.

seshat.apps.core.views.activate(request, uidb64, token)

Activate user account.

Parameters:
  • request – The request object.

  • uidb64 – The user ID encoded in base64.

  • token – The token.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.ajax_test(request)

Test if the request is an AJAX request.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.assign_categorical_variables_to_shapes(shapes, variables)

Assign the categorical variables to the shapes.

Note

Currently only language and religion variables are implemented.

Parameters:
  • shapes (list) – The shapes to assign the variables to.

  • variables (dict) – The variables to assign to the shapes.

Returns:

A tuple containing the shapes and the variables.

Return type:

tuple

seshat.apps.core.views.assign_variables_to_shapes(shapes, app_map)

Assign the absent/present variables to the shapes.

Parameters:
  • shapes (list) – The shapes to assign the variables to.

  • app_map (dict) – A dictionary mapping app names to their long names.

Returns:

A tuple containing the shapes and the variables.

Return type:

tuple

seshat.apps.core.views.capital_download(request)

Download all Capitals as CSV.

Note

This view is only accessible to users with the ‘view_capital’ permission.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.cliopatria(request)
seshat.apps.core.views.create_a_comment_with_a_subcomment_new(request, app_name, model_name, instance_id)

Create a Comment and assign it to a model instance.

Note

This view has the login_required decorator to ensure that only logged-in users can access it.

Parameters:
  • request – The request object.

  • app_name – The name of the app containing the model.

  • model_name – The name of the model.

  • instance_id – The id of the model instance.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.create_a_comment_with_a_subcomment_newer(request, app_name, model_name, instance_id)

Create the first chunk of a new comment and assign it to a model instance and a seshat comment. Get the data on citations and do the appropriate assignments there as well.

seshat.apps.core.views.create_a_private_comment_with_a_private_subcomment_new(request, app_name, model_name, instance_id)

Create a PrivateComment and assign it to a model instance.

Note

This view is only accessible to users with the ‘add_seshatprivatecommentpart’ permission.

Parameters:
  • request – The request object.

  • app_name – The name of the app containing the model.

  • model_name – The name of the model.

  • instance_id – The id of the model instance.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.discussion_room(request)

Render the discussion room page.

seshat.apps.core.views.do_zotero(results)

Process the results from the Zotero API.

Parameters:

results – The results from the Zotero API.

Returns:

A list of dictionaries containing the processed data.

Return type:

list

seshat.apps.core.views.do_zotero_manually(results)

Process the results from the Zotero API.

Parameters:

results – The results from the Zotero API.

Returns:

A list of dictionaries containing the processed data.

Return type:

list

seshat.apps.core.views.download_csv_all_polities(request)

Download a CSV file containing all polities.

Note

This view is restricted to users with the ‘view_capital’ permission.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.download_oldcsv(request, file_name)

Download a CSV file.

Parameters:
  • request – The request object.

  • file_name (str) – The name of the file to download.

Returns:

The file response.

Return type:

FileResponse

seshat.apps.core.views.four_o_four(request)

Return a 404 error page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.get_all_polity_capitals()

Get capital cities for polities that have them.

Returns:

A dictionary containing the capital cities for polities.

Return type:

dict

seshat.apps.core.views.get_or_create_citation(reference, page_from, page_to)

Get or create a Citation instance. If a matching citation already exists, it is returned; otherwise, a new one is created.

Parameters:
  • reference (Reference) – The reference.

  • page_from (int) – The starting page number.

  • page_to (int) – The ending page number.

Returns:

The Citation instance.

Return type:

Citation

seshat.apps.core.views.get_polity_data_single(polity_id)

Get the data for a single polity. The returned data includes the number of records for each app (general, sc, wf, hs, cc, pt).

Parameters:

polity_id – The ID of the polity.

Returns:

The data for the polity.

Return type:

dict

seshat.apps.core.views.get_polity_shape_content(displayed_year='all', seshat_id='all', tick_number=80, override_earliest_year=None, override_latest_year=None, geometries=True)

This function returns the polity shapes and other content for the map. Only one of displayed_year or seshat_id should be set; not both.

Note

seshat_id in Cliopatria is new_name in Polity.

Parameters:
  • displayed_year (str) – The year to display the polities for. “all” will return all polities. Any given year will return polities that were active in that year.

  • seshat_id (str) – The seshat_id of the polity to display. If a value is provided, only the shapes for that polity being returned.

Returns:

The content for the polity shapes.

Return type:

dict

seshat.apps.core.views.get_provinces(selected_base_map_gadm='province')

Get all the province or country shapes for the map base layer.

Parameters:

selected_base_map_gadm (str) – The selected base map GADM level.

Returns:

A list of dictionaries containing the province or country shapes.

Return type:

list

seshat.apps.core.views.index(request)

Returns a simple “Hello World” response.

Note

This is a simple view to test the server. It is not part of the application.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.is_ajax(request)

Return True if the request is an AJAX request, False otherwise.

Parameters:

request (HttpRequest) – The request object.

Returns:

True if the request is an AJAX request, False otherwise.

Return type:

bool

seshat.apps.core.views.map_view_all(request)

This view is used to display a map with polities plotted on it. The view loads all polities for the range of years.

Parameters:

request – The request object.

Returns:

The HTTP response with serialized JSON.

Return type:

JsonResponse

seshat.apps.core.views.map_view_all_with_vars(request)

This view is used to display a map with polities plotted on it. The view loads all polities for the range of years with added variables for each polity shape.

Parameters:

request – The request object.

Returns:

The HTTP response with serialized JSON.

Return type:

JsonResponse

seshat.apps.core.views.map_view_initial(request)
seshat.apps.core.views.nlp_datapoints(request)

Render the NLP data points page.

seshat.apps.core.views.nlp_datapoints_2(request)

Render the NLP data points page.

seshat.apps.core.views.no_zotero_refs_list(request)

List all references without a Zotero link.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.polity_filter_options_view(request)

This view returns the options for the polity filter.

Note

The view is decorated with the require_GET decorator to ensure that only GET requests are allowed.

Parameters:

request – The request object.

Returns:

The JSON response.

Return type:

JsonResponse

seshat.apps.core.views.provinces_and_countries_view(request)

This view is used to get the provinces and countries for the map.

Parameters:

request – The request object.

Returns:

The HTTP response with serialized JSON.

Return type:

JsonResponse

seshat.apps.core.views.random_polity_shape(from_selection=True)

This function is used to get a pseudo-random polity for the map_view_initial and map_view_initial views to display. It selects a polity with a large area and which has a seshat_id.

If from_selection is true, choose a polity from a pre-approved list. TODO: if the loading time of map_view_initial becomes sufficiently fast, we could set from_selection to False.

Returns:

A tuple containing the start year and seshat_id.

Return type:

tuple

seshat.apps.core.views.reference_update_modal(request, pk)

Update a reference using a modal or a standalone page depending on the request.

Parameters:
  • request (HttpRequest) – The request object.

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

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.references_download(request)

Download all references as a CSV file.

Note

This view is only accessible to users with the ‘view_capital’ permission.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.religion_create(request)

Create a new religion.

Note

This view is only accessible to users with the ‘add_seshatprivatecommentpart’ permission.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.religion_update(request, pk)

Update an existing religion.

Note

This view is only accessible to users with the ‘add_seshatprivatecommentpart’ permission.

Parameters:
  • request (HttpRequest) – The request object.

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

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.search_suggestions(request)

View to get search suggestions for a polity.

Note

This view can handle GET requests.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.search_view(request)

View to search for a polity.

Note

This view can handle GET requests.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.seshat_comment_part_create_from_null_view(request, com_id, subcom_order)

Create a new comment part.

Note

This view is only accessible to users with the ‘add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object.

  • com_id (int) – The primary key of the comment.

  • subcom_order (int) – The order of the comment part.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshat_comment_part_create_from_null_view_OLD(request, com_id, subcom_order)

Create a new comment part.

Note

This function is not used in the current implementation. This view is only accessible to users with the ‘add_capital’ permission.

Parameters:
  • request (HttpRequest) – The request object.

  • com_id (int) – The primary key of the comment.

  • subcom_order (int) – The order of the comment part.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshat_comment_part_create_from_null_view_inline(request, app_name, model_name, instance_id)
seshat.apps.core.views.seshat_private_comment_part_create_from_null_view(request, private_com_id)

Create a new private comment part.

Note

This view is only accessible to users with the ‘add_seshatprivatecommentpart’ permission.

Parameters:
  • request (HttpRequest) – The request object.

  • private_com_id (int) – The primary key of the private comment.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatacknowledgements(request)

Return the Seshat “Acknowledgements” page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatcodebooknew1(request)
seshat.apps.core.views.seshatcodebookold(request)

Return the Seshat “Codebook” page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatcomment_create_view(request)

View to create a SeshatComment instance.

Note

This view can handle POST and GET requests.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.seshatcommentpart_create_view(request)

Create a new SeshatCommentPart instance.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.seshatcommentpart_create_view_old(request)

Create a new SeshatCommentPart instance.

Note

The old view of the SeshatCommentPart creation is not currently used in the application.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.seshatindex(request)

Render the Seshat landing page.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.seshatindex2(request)

Return the Seshat landing page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatmethods(request)

Return the Seshat “Methods” page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatolddownloads(request)

Return the Seshat “Downloads” page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.seshatwhoweare(request)

Return the Seshat “Who We are” page.

Parameters:

request (HttpRequest) – The request object.

Returns:

The response object.

Return type:

HttpResponse

seshat.apps.core.views.signup_traditional(request)

Handle user signup.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.signupfollowup(request)

Handle user signup follow-up.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.synczotero(request)

This function is used to sync the Zotero data with the database.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.synczotero100(request)

This function is used to sync the Zotero data with the database.

Note

This function syncs only 100 references.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.synczoteromanually(request)

This function is used to manually input the references from the Zotero data available in the manual_input_refs.py file into the database.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.update_citations(request)

This function takes all the references and build a citation for them.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.update_citations_from_inside_zotero_update()

This function takes all the references and build a citation for them.

Parameters:

None

Returns:

None

seshat.apps.core.views.update_seshat_comment_part_view(request, pk)

View to update a SeshatCommentPart instance.

Note

This view can handle POST and GET requests.

Parameters:
  • request – The request object.

  • pk – The primary key of the SeshatCommentPart instance.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.variablehierarchysetting(request)

Handle variable hierarchy setting. This is a view for the admin to set the variable hierarchy.

Parameters:

request – The request object.

Returns:

The HTTP response.

Return type:

HttpResponse

seshat.apps.core.views.xxyyzz(request, com_id)
seshat.apps.core.views.POLITY_RELIGIOUS_TRADITION_CHOICES
seshat.apps.core.views.app_map
seshat.apps.core.views.categorical_variables
seshat.apps.core.views.world_map_initial_displayed_year = 117
seshat.apps.core.views.world_map_initial_polity = 'it_roman_principate'