diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..b142a6f55
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,33 @@
+---
+name: build_docker_image
+
+on:
+ push:
+ branches: [dev]
+ paths:
+ - 'Dockerfile'
+ - 'requirements.txt'
+ pull_request:
+ branches: [dev]
+ paths:
+ - 'Dockerfile'
+ - 'requirements.txt'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+ - name: Login to GitHub Packages
+ uses: docker/login-action@v1
+ with:
+ registry: docker.pkg.github.com
+ username: ${{ github.actor }}
+ password: ${{ secrets.GH_TOKEN }}
+ - name: Build and push Docker image
+ uses: docker/build-push-action@v2
+ with:
+ context: .
+ push: true
+ tags: docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest
\ No newline at end of file
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 000000000..13b2c5912
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,31 @@
+---
+name: test_code
+
+on:
+ push:
+ branches: [dev]
+ pull_request:
+ branches: [dev]
+
+jobs:
+ test_core:
+ runs-on: ['ubuntu-latest']
+ steps:
+ - uses: actions/checkout@v3
+ - name: Login to GitHub Packages
+ uses: docker/login-action@v1
+ with:
+ registry: docker.pkg.github.com
+ username: ${{ github.actor }}
+ password: ${{ secrets.GH_TOKEN }}
+ - name: Pull and run Docker image
+ run: |
+ docker pull docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest
+ docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/edwardchalstrey1/seshat/tests-image:latest
+ - name: Sleep, then check PostgreSQL connectivity
+ run: |
+ sleep 10
+ docker exec seshat_testing psql -h localhost -U postgres -c 'SELECT 1'
+ - name: Run tests
+ run: |
+ docker exec seshat_testing python3 /seshat/manage.py test seshat.apps.core
diff --git a/.gitignore b/.gitignore
index 87d289ecf..4b5a0be17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -211,3 +211,16 @@ cython_debug/
#.idea/
# End of https://www.toptal.com/developers/gitignore/api/django
+
+# Ed's bits
+data
+database_dumps
+seshat/staticfiles
+pulumi/logs
+pulumi/Pulumi.seshat.yaml
+scripts
+.DS_Store
+*.ipynb
+
+docs/source/api/seshat/
+docs/source/api/custom_filters/
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..19620a997
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,22 @@
+FROM postgis/postgis
+
+# Update the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories.
+RUN apt-get update -y
+
+# Install the packages
+RUN apt-get install -y gdal-bin libgdal-dev libgeos++-dev libgeos-c1v5 libgeos-dev libgeos-doc
+
+# Install pip
+RUN apt-get install -y python3-pip
+
+# Upgrade pip
+RUN python3 -m pip install --upgrade pip
+
+# Copy requirements.txt file into the Docker image
+COPY requirements.txt .
+
+# Install Python dependencies
+RUN pip install -r requirements.txt
+
+# Install django-geojson
+RUN pip install "django-geojson[field]"
\ No newline at end of file
diff --git a/README.md b/README.md
index 23e37586b..eb44b33e4 100644
--- a/README.md
+++ b/README.md
@@ -4,3 +4,30 @@
This repo contains the necessary Django Python code to host the [Seshat](http://seshat-db.com/) website and interact with the backend PostgreSQL database.
+## Developers
+
+Follow the instructions available in [docs/source/getting-started/setup/index.rst](docs/source/getting-started/setup/index.rst).
+
+In order to generate the documentation, in the correct environment run the following command:
+
+```bash
+pip install -r docs/requirements.txt
+cd docs
+make html
+```
+
+## GitHub process
+
+1. Create a new branch from `dev`
+2. Test changes locally
+3. Test changes on Azure VM set up with Pulumi if needed (see [Azure Setup](docs/setup.md)).
+ - ATI VMs are set up currently under the `Sustainable Scholarly Communities around Data and Software` subscription
+4. Merge branch into `dev` on this fork
+5. Repeat the above until satisfied, then PR `dev` to upstream `dev` branch
+
+## Tests and checks
+
+On this fork, currently GH actions is set up to run django tests for the following apps when pushing or PR-ing to the `dev` branch:
+- Core
+
+See [docs/source/contribute/testing.rst](docs/source/contribute/testing.rst) on how to run locally.
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 000000000..d0c3cbf10
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,20 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 000000000..747ffb7b3
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,35 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=source
+set BUILDDIR=build
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.https://www.sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+
+:end
+popd
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644
index 000000000..dd3f4499d
--- /dev/null
+++ b/docs/requirements.txt
@@ -0,0 +1,14 @@
+docstr-coverage
+myst-parser
+nbsphinx
+pandoc
+sphinx
+sphinx_togglebutton
+sphinx-autoapi
+sphinx-autoapi
+sphinx-book-theme
+sphinx-copybutton
+sphinx-tabs
+sphinx-togglebutton
+sphinxcontrib-napoleon
+sphinx-rtd-theme
\ No newline at end of file
diff --git a/docs/setup.md b/docs/setup.md
deleted file mode 100644
index a532f50d1..000000000
--- a/docs/setup.md
+++ /dev/null
@@ -1,82 +0,0 @@
-# Setup instructions
-
-This page instructs software engineers how to get started working with the Django codebase and PostgreSQL database.
-
-## Local setup
-
-1. Ensure you have a working installation of Python 3
-
-2. Set up a virtual environment for the project using e.g. venv or conda
- - Note: The application has been tested with Python **3.8.13**
- - Example:
- ```
- conda create --name seshat38 python=3.8.13
- conda activate seshat38
- ```
-
-3. Create a fork of the GitHub repo with all branches: https://github.com/MajidBenam/seshat
-
-4. Clone your fork to your local machine
-
-5. Ensure you have a working installation of PostgreSQL **version 12**
- - Example instructions for macOS
-
- - `brew install postgres@12`
- - `brew services start postgresql@12`
- - Update `~/.zshrc` (or equivalent for your terminal) with:
- ```
- export PATH="/opt/homebrew/opt/postgresql@12/bin:$PATH"
- export LDFLAGS="-L/opt/homebrew/opt/postgresql@12/lib"
- export CPPFLAGS="-I/opt/homebrew/opt/postgresql@12/include"
- ```
- - Open a new terminal
-
- - Open PostgreSQL with:
- ```
- psql postgres
- ```
- - In psql, create a default superuser called "postgres", which is needed to restore the Seshat database from backup:
- ```
- CREATE USER postgres SUPERUSER;
- ```
-
-6. After PostgreSQL is installed, install the Python packages in your environment (some packages have psql as a dependency). From the top level of the `seshat` repo:
- ```
- pip install -r requirements.txt
- ```
-
-7. Restore Seshat database from dump:
- - Note: you'll need a dump file of the Seshat database, which can be provided by one of the current developers
- ```
- createdb -U postgres
-
- pg_restore -U postgres -d /path/to/file.dump
- ```
- - Connect to the new test database to make sure things are in order
- ```
- psql -U postgres -d
- ```
-
-8. Create a config with your database info for Django
- - Within the repo, create a file called `seshat/settings/.env` with the db connection vars
- - For example:
- ```
- NAME=
- USER=postgres
- HOST=localhost
- PORT=5432
- ```
- - The presence of this file will ensure Django connects to your local database
-
-9. Run Django
- ```
- python manage.py runserver
- ```
-
-10. The webapp should be visible in a browser at http://127.0.0.1:8000/
-
-
-
-## Production setup (AWS)
-
-_TODO_
\ No newline at end of file
diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst
new file mode 100644
index 000000000..4c9ee338b
--- /dev/null
+++ b/docs/source/api/index.rst
@@ -0,0 +1,10 @@
+API Reference
+=============
+
+This page contains auto-generated API reference documentation.
+
+.. toctree::
+ :titlesonly:
+
+ /api/seshat/index
+ /api/custom_filters/index
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 000000000..2361951bb
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,120 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+
+import os
+import sys
+sys.path.insert(0, os.path.abspath('../..'))
+os.environ['DJANGO_SETTINGS_MODULE'] = 'seshat.settings.base'
+
+import sphinx_rtd_theme
+
+import seshat
+
+
+# -- Project information -----------------------------------------------------
+
+project = 'Seshat'
+copyright = '2024, Majid Benam'
+author = 'Majid Benam'
+
+release = seshat.__version__
+
+# -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
+
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.autosummary",
+ "sphinx.ext.doctest",
+ # "sphinx_rtd_theme",
+ "myst_parser",
+ "autoapi.extension",
+ "sphinx_copybutton",
+ "nbsphinx",
+ "sphinx.ext.napoleon",
+ "sphinx.ext.todo",
+ "sphinx_togglebutton",
+ "sphinx_tabs.tabs",
+]
+
+templates_path = ["_templates"]
+exclude_patterns = []
+
+source_suffix = {
+ ".rst": "restructuredtext",
+ ".md": "markdown",
+}
+
+# -- autoapi configuration -----
+
+autoapi_dirs = [
+ "../../seshat/",
+ "../../pulumi/",
+]
+autoapi_type = "python"
+autoapi_root = "api"
+
+autoapi_options = [
+ "members",
+ "undoc-members",
+ "show-inheritance",
+ "show-module-summary",
+ # "imported-members",
+]
+
+autoapi_ignore = [
+ '_*',
+ '*backup*',
+ '*migrations*',
+ '*mycodes*',
+ '*myviews*',
+]
+
+autoapi_keep_files = True
+autodoc_typehints = "description"
+autoapi_add_toctree_entry = False
+autoapi_member_order = "groupwise"
+
+# def skip_attributes(app, what, name, obj, skip, options):
+# if what == "attribute":
+# skip = True
+# return skip
+
+# def setup(sphinx):
+# sphinx.connect("autoapi-skip-member", skip_attributes)
+
+# -- Napoleon settings ----
+
+napoleon_numpy_docstring = True
+napoleon_include_private_with_doc = True
+napoleon_include_special_with_doc = True
+
+# -- todo --
+todo_include_todos = False
+
+# -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
+
+html_theme = "sphinx_book_theme"
+
+# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+html_static_path = ["_static"]
+
+html_theme_options = {
+ "use_download_button": True,
+}
+
+# -- copybutton settings ----
+
+copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
+copybutton_prompt_is_regexp = True
diff --git a/docs/source/contribute/code-of-conduct.rst b/docs/source/contribute/code-of-conduct.rst
new file mode 100644
index 000000000..f623574b9
--- /dev/null
+++ b/docs/source/contribute/code-of-conduct.rst
@@ -0,0 +1,4 @@
+Code of Conduct and Inclusivity
+================================
+
+...
\ No newline at end of file
diff --git a/docs/source/contribute/developers-guide.rst b/docs/source/contribute/developers-guide.rst
new file mode 100644
index 000000000..4540ef579
--- /dev/null
+++ b/docs/source/contribute/developers-guide.rst
@@ -0,0 +1,4 @@
+Developer's Guide
+=================
+
+...
\ No newline at end of file
diff --git a/docs/source/contribute/index.rst b/docs/source/contribute/index.rst
new file mode 100644
index 000000000..34bbf1753
--- /dev/null
+++ b/docs/source/contribute/index.rst
@@ -0,0 +1,12 @@
+Contribute
+==========
+
+.. todo:: Add a bit of welcoming introduction to contributing to the package.
+
+
+.. toctree::
+ :maxdepth: 1
+
+ code-of-conduct
+ developers-guide
+ testing
diff --git a/docs/source/contribute/testing.rst b/docs/source/contribute/testing.rst
new file mode 100644
index 000000000..ff502daf7
--- /dev/null
+++ b/docs/source/contribute/testing.rst
@@ -0,0 +1,42 @@
+Testing
+=======
+
+Prerequisites
+-------------
+
+Activate your project python environment. Then install all the required test packages:
+
+.. code-block:: bash
+
+ $ pip install -r requirements/tests.txt
+
+Running tests locally
+---------------------
+
+First, make sure the Seshat repo root directory is in your PYTHONPATH:
+
+.. code-block:: bash
+
+ $ export PYTHONPATH="${PYTHONPATH}:/path/to/seshat"
+
+Then use the Django test interface to run tests for apps:
+
+.. code-block:: bash
+
+ $ python manage.py test --keepdb
+
+Replace ```` with the app's full name (e.g. ``seshat.apps.core``) (or leave this setting entirely off to run all tests).
+
+The ``--keepdb`` flag ensures you can rerun tests quickly if the setup hasn't changed.
+
+CI
+---
+
+GitHub actions is set up to run on this repo. It uses a custom Docker image that gets built on every push or PR to ``dev`` if the Dockerfile has changed.
+
+See ``.github/workflows`` and the ``Dockerfile``. The tests (``.github/workflows/tests.yml``) and any subsequently introduced workflows should always run on push/PR to ``dev``.
+
+To set up pushing the docker image using the GH action workflow, I first did the following:
+
+- Generated a new GitHub token with the ``read:packages`` and ``write:packages`` scopes. Under my ``Settings > Developer settings > Personal access tokens`` (classic token).
+- Stored the GitHub token as a secret in the Seshat GitHub repository, ``Settings > Secrets``, named ``GH_TOKEN``.
diff --git a/docs/source/figures/pg_hba.conf.png b/docs/source/figures/pg_hba.conf.png
new file mode 100644
index 000000000..6daa3e974
Binary files /dev/null and b/docs/source/figures/pg_hba.conf.png differ
diff --git a/docs/source/getting-started/index.rst b/docs/source/getting-started/index.rst
new file mode 100644
index 000000000..9f3f3fbc8
--- /dev/null
+++ b/docs/source/getting-started/index.rst
@@ -0,0 +1,9 @@
+Getting started with Seshat
+===========================
+
+TODO
+
+.. toctree::
+ :maxdepth: 1
+
+ setup/index
diff --git a/docs/source/getting-started/setup/cloud/pulumi.rst b/docs/source/getting-started/setup/cloud/pulumi.rst
new file mode 100644
index 000000000..c9c4f6e38
--- /dev/null
+++ b/docs/source/getting-started/setup/cloud/pulumi.rst
@@ -0,0 +1,314 @@
+Azure cloud setup with Pulumi
+=============================
+
+.. note::
+
+ This guide on how to run a full setup of the Seshat django app on Azure with Pulumi based on `this guide `_.
+
+ It assumes that you have access to a Seshat database dump, including all the spatial data. You can access it through the project's `Google Drive `_ if you have access to it.
+
+ It assumes that you are located in the UK and have access to the Azure subscription that the Seshat project is under.
+
+ It assumes that your data tables are populated with the shape data. If it is not, you can populate them with the instructions in `spatialdb.rst <../spatialdb.rst>`_.
+
+.. warning::
+
+ The setup is only partially automated with Pulumi currently. As you'll see below, subsequent steps are required to that involve SSH-ing into the created VM.
+
+
+Prerequisites
+-------------
+
+The following instructions assume you have the following software installed:
+
+- Python 3 (in order to use ``venv``)
+- Pulumi
+- Azure CLI
+
+.. admonition:: Installation instructions for prerequisites
+ :class: dropdown
+
+ **Python 3**
+
+ Ensure you have a working installation of Python 3. The application has been tested with Python **3.8.13**.
+
+ If you don't have Python installed, you can download it from `Python's official website `_.
+
+ **Pulumi**
+
+ Ensure you have a working installation of Pulumi.
+
+ .. hint::
+
+ If you need to install Homebrew, you can find instructions on how to do so on `Homebrew's website `_.
+
+ If you don't have Pulumi installed, follow the `documentation `_ e.g. on a Mac:
+
+ .. code-block:: bash
+
+ brew install pulumi/tap/pulumi
+
+ **Azure CLI**
+
+ Ensure you have a working installation of the Azure CLI.
+
+ If you don't have the Azure CLI installed, you can download it from `Microsoft's official website `_.
+
+Step 1: Log in to Azure
+-----------------------
+
+Ensure that you are correctly logged in and that the subscription you will use comes up in the list of subscriptions printed out, then set to that subscription:
+
+.. code-block:: bash
+
+ $ az login
+ $ az account set --subscription ""
+
+
+Step 2: Create a virtual environment for Pulumi
+-----------------------------------------------------------------
+
+You can use either Conda or Python's built-in ``venv`` module to create a virtual environment (you could also re-use the environment you set up for Seshat development and install the requirements there).
+
+.. tabs::
+
+ .. tab:: Conda example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ conda create --name seshat_pulumi
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ conda activate seshat_pulumi
+
+ .. tab:: venv example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ python3 -m venv seshat_pulumi
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ source seshat_pulumi/bin/activate
+
+Install the requirements:
+
+.. code-block:: bash
+
+ $ pip install -r pulumi/requirements.txt
+
+Step 3: Set up a Pulumi stack
+------------------------------
+
+We assume here that you'll use our provided Pulumi setup (located in the ``/pulumi`` directory in this repository).
+
+.. admonition:: Setting up a Pulumi stack from scratch
+ :class: dropdown
+
+ If you're setting up a Pulumi stack from scratch, you can follow the below steps:
+
+ 1. Set up a Pulumi stack for Azure Python:
+
+ .. code-block:: bash
+
+ $ pulumi new azure-python
+
+ 2. Initialize a new Pulumi stack:
+
+ .. code-block:: bash
+
+ $ pulumi stack init
+
+ 3. Select the stack:
+
+ .. code-block:: bash
+
+ $ pulumi stack select
+
+.. important::
+
+ In the provided set up in the ``/pulumi`` directory, we have already set up the Pulumi stack for you.
+
+ In the included set up, we:
+
+ - Chose a sensible project name: `seshat-dev`
+ - Chose the stack name `seshat`
+ - Chose ``UKSouth`` location
+ - Made custom edits to the config files for the Seshat app
+
+To set up this Pulumi stack, run the following commands:
+
+.. code-block:: bash
+
+ $ pulumi stack init seshat
+ $ pulumi stack select seshat
+
+Step 4: Configure Pulumi
+------------------------
+
+You will need to provide the following configuration values:
+
+- ``sshPublicKey``: The public key that will be used to SSH into the VM. You can find your public key by running:
+
+ .. code-block:sh
+
+ $ cat ~/.ssh/id_rsa.pub
+
+The following command will set the `sshPublicKey` configuration value:
+
+.. code-block:: bash
+
+ $ pulumi config set --secret sshPublicKey "$(cat ~/.ssh/id_rsa.pub)"
+
+..
+ TODO: `privateKey` and `dumpFile` paths are needed for SCP command, which currently isn't working via Pulumi, see manual steps below
+
+ $ pulumi config set privateKey "~/.ssh/id_rsa"
+ $ pulumi config set dumpFile "/path/to/dumpfile.dump"
+
+
+Step 5: Deploy the app
+----------------------
+
+To deploy the app, run the following command:
+
+.. code-block:: bash
+
+ $ pulumi up
+
+
+Manual steps
+------------
+
+The Pulumi setup is only partially automated. The following steps are required to complete the setup:
+
+- SSH into the created VM
+- Set up the database
+- Run the Django app
+
+Manual step 1: SSH into the created VM
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+First, we want to get the public IP address of the VM:
+
+.. code-block:: bash
+
+ $ pulumi stack output
+
+This will output the public IP address of the VM. Make a note of this IP address as you will need it to SSH into the VM.
+
+In order to SSH into the VM, run the following command:
+
+.. code-block:: bash
+
+ $ ssh -i ~/.ssh/id_rsa webadmin@
+
+
+Manual step 2: Set up the database
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once we've logged inot the VM, we need to set up the database. In this step, we create the database, add PostGIS to it, set a password for the superuser, update postgres to use md5, and restore the database from the dump.
+
+To create the database, we need to open ``psql``:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql
+
+Then, create the database:
+
+.. code-block:: sql
+
+ CREATE DATABASE ;
+
+Exit out of ``psql`` using ``\q``.
+
+Next, we need to add PostGIS to the database by opening ``psql`` again using the correct user:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql -d
+
+Then, add PostGIS to the database:
+
+.. code-block:: sql
+
+ CREATE EXTENSION postgis;
+
+Exit out of ``psql`` using ``\q``.
+
+Manual step 3: Secure the database
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Choose a password for Postgres. At Turing we have an Azure Key Vault set up under the project subscription where this can be saved (the one we have set up can be reused).
+
+In order to add the password for the superuser, open ``psql``:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql
+
+Then, add the password for the superuser:
+
+.. code-block:: sql
+
+ ALTER USER postgres WITH PASSWORD '';
+
+Update postgres to use md5:
+
+.. code-block:: bash
+
+ $ sudo nano /etc/postgresql/16/main/pg_hba.conf
+
+.. image:: ../../../figures/pg_hba.conf.png
+
+In order for the changes to take effect, reload postgres:
+
+.. code-block:: bash
+
+ $ sudo systemctl reload postgresql
+
+Exit out of ``psql`` using ``\q``.
+
+Manual step 4: Restore the database from the dump
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. hint::
+
+ This step assumes that you have access to the Seshat database dump.
+
+ You can access it through the project's `Google Drive `_.
+
+In order to restore the database from the dump, run the following command:
+
+.. code-block:: bash
+
+ $ sudo psql -U postgres < ~/seshat.dump
+
+Manual step 5: Run the Django app
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In order to run the Django app, we need to configure and run it.
+
+First, open ``seshat/settings/local.py`` and add the created IP address to ``ALLOWED_HOSTS``.
+
+Then, configure and run the Django app:
+
+.. code-block:: bash
+
+ $ sudo ufw allow 8000
+ $ cd seshat
+ $ source venv/bin/activate
+ $ export DJANGO_SETTINGS_MODULE=seshat.settings.local
+ $ gunicorn seshat.wsgi:application --config gunicorn.conf.py
+
+Now, you should be able to go to the publicly' exposed IP on port 8000: ``http://:8000/``.
diff --git a/docs/source/getting-started/setup/index.rst b/docs/source/getting-started/setup/index.rst
new file mode 100644
index 000000000..790d3fe2c
--- /dev/null
+++ b/docs/source/getting-started/setup/index.rst
@@ -0,0 +1,26 @@
+Setting up Seshat
+=================
+
+This page instructs software engineers how to get started working with the Django codebase and PostgreSQL database for the "core" Seshat webapp. It assumes the engineer has access to a dumpfile of the Seshat "core" database.
+
+
+Setting up in the cloud
+-----------------------
+
+We use Pulumi to manage our cloud infrastructure. To set up the infrastructure, you will need to install Pulumi and configure your Azure credentials.
+
+Instructions for installing Pulumi can be found :doc:`here `.
+
+
+Setting up in a local environment
+---------------------------------
+
+We also have instructions for how to set up Seshat in a local environment. You can find these instructions :doc:`here `.
+
+
+.. toctree::
+ :maxdepth: 1
+
+ cloud/pulumi
+ local/index
+ spatialdb
\ No newline at end of file
diff --git a/docs/source/getting-started/setup/local/index.rst b/docs/source/getting-started/setup/local/index.rst
new file mode 100644
index 000000000..ac184be5b
--- /dev/null
+++ b/docs/source/getting-started/setup/local/index.rst
@@ -0,0 +1,14 @@
+Setting up Seshat in a local environment
+========================================
+
+macOS and Ubuntu are supported for local development. The following instructions are for macOS and Ubuntu.
+
+Windows instructions are forthcoming. For Windows, you can use the Windows Subsystem for Linux (WSL) to run Ubuntu.
+
+.. toctree::
+ :maxdepth: 1
+
+ macos
+ ubuntu
+ windows
+ macos-ubuntu
diff --git a/docs/source/getting-started/setup/local/macos-ubuntu.rst b/docs/source/getting-started/setup/local/macos-ubuntu.rst
new file mode 100644
index 000000000..cdd1a19c9
--- /dev/null
+++ b/docs/source/getting-started/setup/local/macos-ubuntu.rst
@@ -0,0 +1,57 @@
+Setting up a local Ubuntu environment on a Mac
+==============================================
+
+In this guide, we will walk you through setting up a local Ubuntu environment on a Mac. This guide is intended for software engineers who are working on the Seshat project and need to set up a local development environment.
+
+We will use multipass to create a virtual machine running Ubuntu on your Mac. Multipass is a lightweight VM manager for Linux, Windows, and macOS. It's designed for developers who need a fresh Ubuntu environment with a single command.
+
+Prerequisites
+-------------
+
+You will need to have Homebrew installed on your Mac to install multipass. If you need to install Homebrew, you can find instructions on how to do so on `Homebrew's website `_.
+
+Steps
+-----
+
+1. Install multipass with brew:
+
+ .. code-block:: bash
+
+ $ brew install multipass
+
+ - Note: the images used by Multipass don’t have a pre-installed graphical desktop
+
+2. Create a VM (Ubuntu 22.04)
+
+ .. code-block:: bash
+
+ $ multipass launch 22.04
+
+ - This should create a VM called `primary` by default
+
+3. Make sure the VM has enough resources:
+
+ .. code-block:: bash
+
+ $ multipass stop primary
+ $ multipass set local.primary.cpus=4
+ $ multipass set local.primary.disk=60G
+ $ multipass set local.primary.memory=8G
+ $ multipass start primary
+
+4. Mount the dir containing the database dump to the VM:
+
+ .. code-block:: bash
+
+ $ multipass mount /path/to/database_dumps/ primary:database_dumps
+
+5. Then log in to the VM with `multipass shell` and install pre-requisites:
+
+ .. code-block:: bash
+
+ $ sudo apt update
+ $ sudo add-apt-repository ppa:deadsnakes/ppa
+ $ sudo apt install python3.8 -y
+ $ sudo apt install python3.8-venv -y
+ $ sudo apt-get install python3.8-dev -y
+ $ sudo apt-get install g++ -y
diff --git a/docs/source/getting-started/setup/local/macos.rst b/docs/source/getting-started/setup/local/macos.rst
new file mode 100644
index 000000000..76ad05577
--- /dev/null
+++ b/docs/source/getting-started/setup/local/macos.rst
@@ -0,0 +1,252 @@
+Setting up Seshat in a local macOS environment
+==============================================
+
+Prerequisites
+-------------
+
+Seshat requires the following software to be installed on your machine:
+
+- Python 3
+- PostgreSQL 16 with PostGIS
+- GDAL
+- GEOS
+
+.. admonition:: Installation instructions for prerequisites
+ :class: dropdown
+
+ **Python 3**
+
+ Ensure you have a working installation of Python 3. The application has been tested with Python **3.8.13**.
+
+ If you don't have Python installed, you can download it from the `official website `_.
+
+ **PostgreSQL and PostGIS**
+
+ Ensure you have a working installation of PostgreSQL with PostGIS. The application has been tested with PostgreSQL **16**.
+
+ If you don't have the software installed, you can use the instructions on `Postgres' website `_ to install it on macOS.
+
+ **GDAL and GEOS**
+
+ Ensure you have a working installation of GDAL and GEOS.
+
+ .. hint::
+
+ If you need to install Homebrew, you can find instructions on how to do so on `Homebrew's website `_.
+
+ If you don't have them, you can install them using Homebrew.
+
+ Then use Homebrew to install ``gdal`` and ``geos``:
+
+ .. code-block:: bash
+
+ $ brew install gdal geos
+
+
+Step 1: Set up a virtual environment for the project
+----------------------------------------------------
+
+You can use either Conda or Python's built-in ``venv`` module to create a virtual environment for the project.
+
+.. tabs::
+
+ .. tab:: Conda example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ conda create --name seshat python=3.8.13
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ conda activate seshat
+
+ .. tab:: venv example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ python3.8 -m venv seshat
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ source seshat/bin/activate
+
+
+Step 2: Create a fork of the correct GitHub repo
+------------------------------------------------
+
+.. note::
+
+ Note: In the next step, you'll use the URL of the fork you choose to clone the repo.
+
+Choose which fork you want to work with.
+
+- If you want to work with the main development branch of Seshat, you should make note of Majid Benam's fork: https://github.com/MajidBenam/seshat
+- If you want to work with the spatial development branch of Seshat, you should make note of Ed Chalstrey's fork: https://github.com/edwardchalstrey1/seshat
+
+
+Step 3: Clone the repo
+----------------------
+
+Using your Terminal, clone the repository:
+
+.. code-block:: bash
+
+ $ git clone https://github.com/edwardchalstrey1/seshat
+
+
+Step 4: Create an empty database and add the PostGIS extension
+--------------------------------------------------------------
+
+.. hint::
+
+ Note that you'll have to use ``;`` to end each SQL command. They will not work without this character.
+
+In order to create a database, open ``psql`` in the terminal:
+
+.. code-block:: bash
+
+ $ psql postgres
+
+In the database, run the following SQL command to create a new database. Note that you should replace ```` with the name you want to give the database:
+
+.. code-block:: sql
+
+ CREATE DATABASE ;
+
+Exit out of the ``psql`` program:
+
+.. code-block:: sql
+
+ \q
+
+Then open the database using the name you just created in place of ````:
+
+.. code-block:: bash
+
+ $ psql postgres -d
+
+Now, you can add the PostGIS extension to your database:
+
+.. code-block:: sql
+
+ CREATE EXTENSION postgis;
+
+
+Step 5: Configure GDAL and GEOS
+-------------------------------
+
+.. hint::
+
+ Note: If you installed GDAL and GEOS using Homebrew, you can find the paths to the installations by running ``brew info gdal`` and ``brew info geos``.
+
+ The paths should look something like ``/opt/homebrew/Cellar/gdal/3.9.0_1`` and ``/opt/homebrew/Cellar/geos/3.9.1``.
+
+Open :doc:`seshat/settings/base.py ` and check (or update) the paths in the following variables, which should be to the paths to your local ``gdal`` and ``geos`` installations:
+
+- ``GDAL_LIBRARY_PATH``
+- ``GEOS_LIBRARY_PATH``
+
+Note: there are hardcoded paths in ``base.py`` for the Mac and Ubuntu instructions above included.
+
+
+Step 6: Install the Python packages
+-----------------------------------
+
+Install the Python packages in your environment (some packages have these as dependencies).
+
+From the top level of the ``seshat`` directory, run the following commands to install the packages from the ``requirements.txt`` file and the ``django-geojson`` package:
+
+.. code-block:: bash
+
+ $ pip install -r requirements.txt
+ $ pip install "django-geojson [field]"
+
+
+Step 7: Seshat database setup
+-----------------------------
+
+Restore Seshat database from dump file:
+
+.. code-block:: bash
+
+ $ pg_restore -U postgres -d /path/to/file.dump
+
+
+Step 8: Secure the database
+---------------------------
+
+Add a password to the database for security.
+
+Add a password for the superuser by logging in to the database with your superuser:
+
+.. code-block:: bash
+
+ $ psql -U postgres
+
+Send the following SQL command to set the password for the superuser. Make sure to replace ```` with your desired password (and make sure to remember it):
+
+.. code-block:: sql
+
+ ALTER USER postgres WITH PASSWORD '';
+
+Locate ``pg_hba.conf`` if you don't know where it is
+
+.. code-block:: bash
+
+ $ psql -U postgres -c 'SHOW hba_file;'
+
+Update postgres to use md5 with ``nano /path/to/pg_hba.conf``
+
+.. image:: ../../../figures/pg_hba.conf.png
+
+
+Step 9: Set up environment variables for connecting to the database
+-------------------------------------------------------------------
+
+Create a configuration file with your database info for Django. The presence of this file will ensure Django connects to your local database.
+
+Within the repo, create a file called ``seshat/settings/.env`` with the database connection variables.
+
+The file should look like this:
+
+.. code-block::
+
+ NAME=
+ USER=postgres
+ HOST=localhost
+ PORT=5432
+ PASSWORD=
+
+
+Step 10: Migrate the database
+-----------------------------
+
+Ensure that all Django database migrations have run:
+
+.. code-block:: bash
+
+ $ python manage.py migrate
+
+
+Step 11: Load the shape data
+----------------------------
+
+If the shape data tables are not yet populated in your copy of the Seshat core database and you have access to source data, populate one or more of them with the instructions `here <../spatialdb.rst>`_.
+
+
+Step 12: Run Django
+-------------------
+
+.. code-block:: bash
+
+ $ python manage.py runserver
+
+The webapp should be visible in a browser at http://127.0.0.1:8000/
diff --git a/docs/source/getting-started/setup/local/ubuntu.rst b/docs/source/getting-started/setup/local/ubuntu.rst
new file mode 100644
index 000000000..3025dc530
--- /dev/null
+++ b/docs/source/getting-started/setup/local/ubuntu.rst
@@ -0,0 +1,321 @@
+Setting up Seshat in a local Ubuntu environment
+===============================================
+
+.. hint::
+ Local setup steps have been tested on an M1 Mac and on an Ubuntu VM running on the Mac. Instructions for setting up an Ubuntu VM on a Mac can be found `here <../getting-started/setup/local/macos-ubuntu.rst>`_.
+
+
+Prerequisites
+-------------
+
+Seshat requires the following software to be installed on your machine:
+
+- Python 3
+- PostgreSQL 16 with PostGIS
+- GDAL
+- GEOS
+
+.. admonition:: Installation instructions for prerequisites
+ :class: dropdown
+
+ **Python 3**
+
+ Ensure you have a working installation of Python 3. The application has been tested with Python **3.8.13**.
+
+ If you don't have Python installed, you can download it from the `official website `_.
+
+ **PostgreSQL and PostGIS**
+
+ Ensure you have a working installation of PostgreSQL with PostGIS. The application has been tested with PostgreSQL **16**.
+
+ If you don't have PostgreSQL installed, you can follow the instructions below to install it on Ubuntu:
+
+ .. code-block:: bash
+
+ $ sudo apt install gnupg2 wget vim -y
+ $ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+ $ curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
+ $ sudo apt update
+ $ sudo apt install postgresql-16 postgresql-contrib-16 postgresql-16-postgis-3 -y
+ $ sudo systemctl start postgresql
+ $ sudo systemctl enable postgresql
+
+ **GDAL and GEOS**
+
+ Ensure you have a working installation of GDAL and GEOS.
+
+ If you don't have GDAL and GEOS installed, you can follow the instructions below to install them on Ubuntu:
+
+ .. warning::
+
+ You may first want to check the latest available version of ``libgeos`` using
+
+ .. code-block:: bash
+
+ $ sudo apt search libgeos
+
+ .. code-block:: bash
+
+ $ sudo apt-get install gdal-bin -y
+ $ sudo apt-get install libgdal-dev -y
+ $ sudo apt install libgeos++-dev libgeos3.10.2 -y
+ $ sudo apt install libgeos-c1v5 libgeos-dev libgeos-doc -y
+
+
+Step 1: Set up a virtual environment for the project
+----------------------------------------------------
+
+You can use either Conda or Python's built-in ``venv`` module to create a virtual environment for the project.
+
+.. tabs::
+
+ .. tab:: Conda example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ conda create --name seshat python=3.8.13
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ conda activate seshat
+
+ .. tab:: venv example
+
+ Create the environment:
+
+ .. code-block:: bash
+
+ $ python3.8 -m venv seshat
+
+ Activate the environment:
+
+ .. code-block:: bash
+
+ $ source seshat/bin/activate
+
+
+Step 2: Create a fork of the correct GitHub repo
+------------------------------------------------
+
+.. note::
+
+ Note: In the next step, you'll use the URL of the fork you choose to clone the repo.
+
+Choose which fork you want to work with.
+
+- If you want to work with the main development branch of Seshat, you should make note of Majid Benam's fork: https://github.com/MajidBenam/seshat
+- If you want to work with the spatial development branch of Seshat, you should make note of Ed Chalstrey's fork: https://github.com/edwardchalstrey1/seshat
+
+
+Step 3: Clone the repo
+----------------------
+
+Using your Terminal, clone the repository:
+
+.. code-block:: bash
+
+ $ git clone https://github.com/edwardchalstrey1/seshat
+
+
+Step 4: Create an empty database and add the PostGIS extension
+--------------------------------------------------------------
+
+.. hint::
+
+ Note that you'll have to use ``;`` to end each SQL command. They will not work without this character.
+
+
+In order to create a database, open ``psql`` in the terminal:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql
+
+In the database, run the following SQL command to create a new database. Note that you should replace ```` with the name you want to give the database:
+
+.. code-block:: sql
+
+ CREATE DATABASE ;
+
+Exit out of the ``psql`` program:
+
+.. code-block:: sql
+
+ \q
+
+Then open the database using the name you just created in place of ````:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql -d
+
+Now, you can add the PostGIS extension to your database:
+
+.. code-block:: sql
+
+ CREATE EXTENSION postgis;
+
+
+Step 5: Configure GDAL and GEOS
+-------------------------------
+
+Open :doc:`seshat/settings/base.py ` and check (or update) the paths in the following variables, which should be to the paths to your local ``gdal`` and ``geos`` installations:
+
+- ``GDAL_LIBRARY_PATH``
+- ``GEOS_LIBRARY_PATH``
+
+Note: there are hardcoded paths in ``base.py`` for the Mac and Ubuntu instructions above included.
+
+
+Step 6: Install the Python packages
+-----------------------------------
+
+Install the Python packages in your environment (some packages have these as dependencies).
+
+From the top level of the ``seshat`` directory, run the following commands to install the packages from the ``requirements.txt`` file and the ``django-geojson`` package:
+
+.. code-block:: bash
+
+ $ pip install -r requirements.txt
+ $ pip install "django-geojson [field]"
+
+
+Step 7: Seshat database setup
+-----------------------------
+
+Restore Seshat database from dump file:
+
+.. code-block:: bash
+
+ $ sudo nano /etc/postgresql/16/main/pg_hba.conf
+
+On the line ``local all postgres peer`` change "peer" to "trust"
+
+You should now be able to reload postgres and populate the database with the following commands:
+
+.. code-block:: bash
+
+ $ sudo systemctl reload postgresql
+ $ sudo psql -U postgres < /path/to/file.dump
+
+
+Step 8: Secure the database
+---------------------------
+
+Add a password to the database for security.
+
+Add a password for the superuser by logging in to the database with your superuser:
+
+.. code-block:: bash
+
+ $ sudo -u postgres psql
+
+Send the following SQL command to set the password for the superuser. Make sure to replace ```` with your desired password (and make sure to remember it):
+
+.. code-block:: sql
+
+ ALTER USER postgres WITH PASSWORD '';
+
+Locate ``pg_hba.conf`` if you don't know where it is:
+
+.. code-block:: bash
+
+ $ sudo psql -U postgres -c 'SHOW hba_file;'
+
+Update postgres to use md5 with ``nano /path/to/pg_hba.conf``
+
+.. image:: ../../../figures/pg_hba.conf.png
+
+Restart postgres:
+
+.. code-block:: bash
+
+ $ sudo systemctl reload postgresql
+
+
+Step 9: Set up environment variables for connecting to the database
+-------------------------------------------------------------------
+
+Create a configuration file with your database info for Django. The presence of this file will ensure Django connects to your local database.
+
+Within the repo, create a file called ``seshat/settings/.env`` with the database connection variables.
+
+The file should look like this:
+
+.. code-block::
+
+ NAME=
+ USER=postgres
+ HOST=localhost
+ PORT=5432
+ PASSWORD=
+
+
+Step 10: Migrate the database
+-----------------------------
+
+Ensure that all Django database migrations have run:
+
+.. code-block:: bash
+
+ $ python manage.py migrate
+
+
+Step 11: Load the shape data
+----------------------------
+
+If the shape data tables are not yet populated in your copy of the Seshat core database and you have access to source data, populate one or more of them with the instructions `here <../spatialdb.rst>`_.
+
+
+Step 12: Run Django
+-------------------
+
+.. code-block:: bash
+
+ $ python manage.py runserver
+
+If you have set up Seshat on a Multipass VM, you can access the Django server from your host machine by following these commands:
+
+First, check IP inside VM:
+
+.. code-block:: bash
+
+ $ ip addr show
+
+This will return a value like ``192.168.64.3``. Note this IP address as you will need to insert it into the following commands.
+
+In the VM, you need to now ensure that the firewall is not blocking incoming connections on port 8000:
+
+.. code-block:: bash
+
+ $ sudo ufw allow 8000
+
+In a macOS Terminal, run the following command to forward the port, but replace ```` with the IP address you noted earlier:
+
+.. code-block:: bash
+
+ $ multipass exec primary -- sudo iptables -t nat -A PREROUTING -p tcp --dport 8000 -j DNAT --to-destination :8000
+
+Now, restart the VM:
+
+.. code-block:: bash
+
+ $ multipass restart primary
+
+Log back into the VM:
+
+.. code-block:: bash
+
+ $ multipass shell primary
+
+Finally, run the Django server but remember to first activate the virtual environment (see Step 1):
+
+.. code-block:: bash
+
+ $ python manage.py runserver 0.0.0.0:8000
+
+You should now be able to access the Django server from your host machine by going to ``http://192.168.64.3:8000/`` in a browser (where ``192.168.64.3`` may need to be replaced with the IP address you noted earlier).
diff --git a/docs/source/getting-started/setup/local/windows.rst b/docs/source/getting-started/setup/local/windows.rst
new file mode 100644
index 000000000..7303da8d7
--- /dev/null
+++ b/docs/source/getting-started/setup/local/windows.rst
@@ -0,0 +1,4 @@
+Setting up Seshat in a local Windows environment
+================================================
+
+TODO
\ No newline at end of file
diff --git a/docs/source/getting-started/setup/spatialdb.rst b/docs/source/getting-started/setup/spatialdb.rst
new file mode 100644
index 000000000..82431a371
--- /dev/null
+++ b/docs/source/getting-started/setup/spatialdb.rst
@@ -0,0 +1,47 @@
+Setting up new shape datasets
+=============================
+
+Ensure that the database and Django are already set up (see :doc:`local instructions ` for more detail) and all migrations have been run for the "core" Django app (``python manage.py migrate core``).
+
+To create a new shape dataset for use in the Seshat map explorer, you can do the following:
+
+1. Create a new model for the new dataset in ``seshat/apps/core/models.py``
+2. Generate migration from model, and run it for your database to create the table
+
+ .. code-block:: bash
+
+ $ python manage.py makemigrations core
+ $ python manage.py migrate core
+
+3. Create a new "command" at `seshat/apps/core/management/commands` which can be used to populate the db table from the dataset files
+ - See the examples below
+ - Add a new header on this page to document here how this works
+
+4. Create a new view and update the the map template with the necessary logic to use this dataset
+ - views at ``seshat/apps/core/views.py``
+ - template e.g. ``seshat/apps/core/templates/core/world_map.html``
+
+Cliopatria shape dataset
+-------------------------
+
+..
+ TODO: Add a link here to the published Clipatria dataset
+
+1. Download and unzip the Cliopatria dataset.
+2. Populate ``core_videoshapefile`` table using the following command:
+
+ .. code-block:: bash
+
+ $ python manage.py populate_videodata /path/to/data
+
+ Note: if you wish to further simplify the Cliopatria shape resolution used by the world map after loading it into the database, open ``seshat/apps/core/management/commands/populate_videodata.py`` and modify the SQL query under the comment: "Adjust the tolerance param of ST_Simplify as needed"
+
+GADM
+----
+
+1. `Download `_ the whole world GeoPackage file from the `GADM website `_.
+2. Populate the ``core_gadmshapefile``, ``core_gadmcountries`` and ``core_gadmprovinces`` tables using the following command:
+
+ .. code-block:: bash
+
+ $ python manage.py populate_gadm /path/to/gpkg_file
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 000000000..56271a451
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,20 @@
+Seshat: Global History Databank
+===============================
+
+Seshat: Global History Databank brings together the most current and comprehensive body of knowledge about human history in one place.
+
+.. toctree::
+ :maxdepth: 5
+
+ getting-started/index
+ contribute/index
+ api/index
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/gunicorn.conf.py b/gunicorn.conf.py
new file mode 100644
index 000000000..94c5b6121
--- /dev/null
+++ b/gunicorn.conf.py
@@ -0,0 +1,28 @@
+import multiprocessing
+
+# The socket to bind
+bind = '0.0.0.0:8000'
+
+# The number of worker processes for handling requests
+workers = multiprocessing.cpu_count() * 2 + 1
+
+# The number of worker threads for handling requests
+threads = 2
+
+# Max number of requests per worker before restarting the worker
+max_requests = 1200
+
+# The type of workers to use
+worker_class = 'sync' # or 'gevent' for async workers
+
+# The maximum number of simultaneous clients
+worker_connections = 1000
+
+# How long to keep an idle worker running
+keepalive = 2
+
+# Logging
+errorlog = '-'
+loglevel = 'info'
+accesslog = '-'
+access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
diff --git a/manage.py b/manage.py
index 35a6274fd..932a6e865 100755
--- a/manage.py
+++ b/manage.py
@@ -2,11 +2,12 @@
"""Django's command-line utility for administrative tasks."""
import os
import sys
-
+from pathlib import Path
def main():
"""Run administrative tasks."""
- if os.path.exists(".env"):
+ local_env_path = str(Path.cwd()) + "/seshat/settings/.env"
+ if os.path.exists(local_env_path):
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'seshat.settings.local')
else:
diff --git a/notebooks/README.md b/notebooks/README.md
new file mode 100644
index 000000000..7c3275dee
--- /dev/null
+++ b/notebooks/README.md
@@ -0,0 +1,21 @@
+# Visualise Cliopatria shape dataset
+
+Cliopatria is the shape dataset used by the Seshat Global History Databank website. It can also be explored in a local Jupyter notebook running on your local machine by following these instructions.
+
+1. Ensure you have a working installation of Python 3 and Conda. If not, [download Anaconda](https://docs.anaconda.com/free/anaconda/install/index.html), which should give you both
+ - Note: you can use a different tool for creating a Python virtual environment than conda (e.g. venv) if you prefer
+
+2. Set up the required virtual environment, install packages into it and create a jupyter kernel.
+ - Conda example:
+ ```
+ conda create --name cliopatria python=3.11
+ conda activate cliopatria
+ pip install -r requirements.txt
+ python -m ipykernel install --user --name=cliopatria --display-name="Python (cliopatria)"
+ ```
+ - Note: This will install Geopandas 0.13.2, but if you [install from source](https://geopandas.org/en/stable/getting_started/install.html#installing-from-source) it's much faster with version 1.0.0 (unreleased on pip as of 18th June 2024)
+
+3. Open the `cliopatria.ipynb` notebook with Jupyter (or another application that can run notebooks such as VSCode).
+ - `jupyter lab` (or `jupyter notebook`)
+ - Note: make sure the notebook Python kernel is using the virtual environment you created (click top right)
+4. Follow the instructions in the notebook.
\ No newline at end of file
diff --git a/notebooks/cliopatria.ipynb b/notebooks/cliopatria.ipynb
new file mode 100644
index 000000000..c48b61df0
--- /dev/null
+++ b/notebooks/cliopatria.ipynb
@@ -0,0 +1,144 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Cliopatria viewer\n",
+ "\n",
+ "1. To get started, download a copy of the Cliopatria dataset from here: `[INSERT LINK]`\n",
+ "2. Move the downloaded dataset to an appropriate location on your machine and pass in the paths in the code cell below and run\n",
+ "3. Run the subsequent cells of the notebook\n",
+ "4. Play around with both the GeoDataFrame (gdf) and the rendered map\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cliopatria_geojson_path = \"../data/cliopatria_composite_unique_nonsimplified.geojson_06052024/cliopatria_composite_unique_nonsimplified.geojson\"\n",
+ "cliopatria_json_path = \"../data/cliopatria_composite_unique_nonsimplified.geojson_06052024/cliopatria_composite_unique_nonsimplified_name_years.json\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from map_functions import cliopatria_gdf, display_map"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Load the Cliopatria data to a GeoDataFrame including end years for each shape\n",
+ "gdf = cliopatria_gdf(cliopatria_geojson_path, cliopatria_json_path)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Play with the data on the map\n",
+ "\n",
+ "**Notes**\n",
+ "- The slider is a bit buggy, the best way to change year is to enter a year in the box and hit enter. Use minus numbers for BCE.\n",
+ "- The map is also displayed thrice for some reason!\n",
+ "- Initial attempts to implement a play button similar to the website code failed, but that may not be needed here.\n",
+ "- Click the shapes to reveal the polity display names, using the same logic used in the website code - see `map_functions.py`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "a95aced3593446ceb228a171178f978b",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "IntText(value=0, description='Year:')"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "80c96982f4a34628b3026e9f853a6af9",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "IntSlider(value=0, description='Year:', max=2024, min=-3400)"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "44078fdd8e91499bad99d7fd38b76a65",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ "Output()"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/echalstrey/.pyenv/versions/3.11.4/lib/python3.11/site-packages/geopandas/geodataframe.py:1538: SettingWithCopyWarning: \n",
+ "A value is trying to be set on a copy of a slice from a DataFrame.\n",
+ "Try using .loc[row_indexer,col_indexer] = value instead\n",
+ "\n",
+ "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
+ " super().__setitem__(key, value)\n"
+ ]
+ }
+ ],
+ "source": [
+ "display_year = 0\n",
+ "display_map(gdf, display_year)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python (cliopatria1)",
+ "language": "python",
+ "name": "cliopatria1"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.11.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/notebooks/map_functions.py b/notebooks/map_functions.py
new file mode 100644
index 000000000..2148739c0
--- /dev/null
+++ b/notebooks/map_functions.py
@@ -0,0 +1,171 @@
+import geopandas as gpd
+import json
+import folium
+import folium
+import ipywidgets as widgets
+from IPython.display import display, clear_output
+
+
+def convert_name(gdf, i):
+ """
+ Convert the polity name of a shape in the Cliopatria dataset to what we want to display on the Seshat world map.
+ Where gdf is the geodataframe, i is the index of the row/shape of interest.
+ Returns the name to display on the map.
+ Returns None if we don't want to display the shape (see comments below for details).
+ """
+ polity_name = gdf.loc[i, 'Name'].replace('(', '').replace(')', '') # Remove spaces and brackets from name
+ # If a shape has components (is a composite) we'll load the components instead
+ # ... unless the components have their own components, then load the top level shape
+ # ... or the shape is in a personal union, then load the personal union shape instead
+ try:
+ if gdf.loc[i, 'Components']: # If the shape has components
+ if ';' not in gdf.loc[i, 'SeshatID']: # If the shape is not a personal union
+ if len(gdf.loc[i, 'Components']) > 0 and '(' not in gdf.loc[i, 'Components']: # If the components don't have components
+ polity_name = None
+ except KeyError: # If the shape has no components, don't modify the name
+ pass
+ return polity_name
+
+
+def cliopatria_gdf(cliopatria_geojson_path, cliopatria_json_path):
+ """
+ Load the Cliopatria shape dataset with GeoPandas and add the EndYear column to the geodataframe.
+ """
+ # Load the geojson and json files
+ gdf = gpd.read_file(cliopatria_geojson_path)
+ with open(cliopatria_json_path, 'r') as f:
+ name_years = json.load(f)
+
+ # Create new columns in the geodataframe
+ gdf['EndYear'] = None
+ gdf['DisplayName'] = None
+
+ # Loop through the geodataframe
+ for i in range(len(gdf)):
+
+ # Get the raw name of the current row and the name to display
+ polity_name_raw = gdf.loc[i, 'Name']
+ polity_name = convert_name(gdf, i)
+
+ if polity_name: # convert_name returns None if we don't want to display the shape
+ if gdf.loc[i, 'Type'] != 'POLITY': # Add the type to the name if it's not a polity
+ polity_name = gdf.loc[i, 'Type'] + ': ' + polity_name
+
+ # Get the start year of the current row
+ start_year = gdf.loc[i, 'Year']
+
+ # Get a sorted list of the years for that name from the geodataframe
+ this_polity_years = sorted(gdf[gdf['Name'] == polity_name_raw]['Year'].unique())
+
+ # Get the end year for a shape
+ # Most of the time, the shape end year is the year of the next shape
+ # Some polities have a gap in their active years
+ # For a shape year at the start of a gap, set the end year to be the shape year, so it doesn't cover the inactive period
+ start_end_years = name_years[polity_name_raw]
+ end_years = [x[1] for x in start_end_years]
+
+ polity_start_year = start_end_years[0][0]
+ polity_end_year = end_years[-1]
+
+ # Raise an error if the shape year is not the start year of the polity
+ if this_polity_years[0] != polity_start_year:
+ raise ValueError(f'First shape year for {polity_name} is not the start year of the polity')
+
+ # Find the closest higher value from end_years to the shape year
+ next_end_year = min(end_years, key=lambda x: x if x >= start_year else float('inf'))
+
+ if start_year in end_years: # If the shape year is in the list of polity end years, the start year is the end year
+ end_year = start_year
+ else:
+ this_year_index = this_polity_years.index(start_year)
+ try: # Try to use the next shape year minus one as the end year if possible, unless it's higher than the next_end_year
+ next_shape_year_minus_one = this_polity_years[this_year_index + 1] - 1
+ end_year = next_shape_year_minus_one if next_shape_year_minus_one < next_end_year else next_end_year
+ except IndexError: # Otherwise assume the end year of the shape is the end year of the polity
+ end_year = polity_end_year
+
+ # Set the EndYear column to the end year
+ gdf.loc[i, 'EndYear'] = end_year
+
+ # Set the DisplayName column to the name to display
+ gdf.loc[i, 'DisplayName'] = polity_name
+
+ return gdf
+
+
+def create_map(selected_year, gdf, map_output):
+ global m
+ m = folium.Map(location=[0, 0], zoom_start=2, tiles='https://a.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png', attr='CartoDB')
+
+ # Filter the gdf for shapes that overlap with the selected_year
+ filtered_gdf = gdf[(gdf['Year'] <= selected_year) & (gdf['EndYear'] >= selected_year)]
+
+ # Remove '0x' and add '#' to the start of the color strings
+ filtered_gdf['Color'] = '#' + filtered_gdf['Color'].str.replace('0x', '')
+
+ # Transform the CRS of the GeoDataFrame to WGS84 (EPSG:4326)
+ filtered_gdf = filtered_gdf.to_crs(epsg=4326)
+
+ # Define a function for the style_function parameter
+ def style_function(feature, color):
+ return {
+ 'fillColor': color,
+ 'color': color,
+ 'weight': 2,
+ 'fillOpacity': 0.5
+ }
+
+ # Add the polygons to the map
+ for _, row in filtered_gdf.iterrows():
+ # Convert the geometry to GeoJSON
+ geojson = folium.GeoJson(
+ row.geometry,
+ style_function=lambda feature, color=row['Color']: style_function(feature, color)
+ )
+
+ # Add a popup to the GeoJSON
+ folium.Popup(row['DisplayName']).add_to(geojson)
+
+ # Add the GeoJSON to the map
+ geojson.add_to(m)
+
+ # Display the map
+ with map_output:
+ clear_output(wait=True)
+ display(m)
+
+
+def display_map(gdf, display_year):
+
+ # Create a text box for input
+ year_input = widgets.IntText(
+ value=display_year,
+ description='Year:',
+ )
+
+ # Define a function to be called when the value of the text box changes
+ def on_value_change(change):
+ create_map(change['new'], gdf, map_output)
+
+ # Create a slider for input
+ year_slider = widgets.IntSlider(
+ value=display_year,
+ min=gdf['Year'].min(),
+ max=gdf['EndYear'].max(),
+ description='Year:',
+ )
+
+ # Link the text box and the slider
+ widgets.jslink((year_input, 'value'), (year_slider, 'value'))
+
+ # Create an output widget
+ map_output = widgets.Output()
+
+ # Attach the function to the text box
+ year_input.observe(on_value_change, names='value')
+
+ # Display the widgets
+ display(year_input, year_slider, map_output)
+
+ # Call create_map initially to display the map
+ create_map(display_year, gdf, map_output)
\ No newline at end of file
diff --git a/notebooks/requirements.txt b/notebooks/requirements.txt
new file mode 100644
index 000000000..03f14b0c2
--- /dev/null
+++ b/notebooks/requirements.txt
@@ -0,0 +1,5 @@
+jupyter==1.0.0
+ipykernel==6.29.3
+geopandas==0.13.2
+contextily==1.6.0
+folium==0.16.0
\ No newline at end of file
diff --git a/pulumi/.gitignore b/pulumi/.gitignore
new file mode 100644
index 000000000..f1321d096
--- /dev/null
+++ b/pulumi/.gitignore
@@ -0,0 +1,3 @@
+*.pyc
+venv/
+logs
\ No newline at end of file
diff --git a/pulumi/Pulumi.yaml b/pulumi/Pulumi.yaml
new file mode 100644
index 000000000..ff370606b
--- /dev/null
+++ b/pulumi/Pulumi.yaml
@@ -0,0 +1,10 @@
+name: seshat-dev
+runtime:
+ name: python
+ options:
+ virtualenv: venv
+description: Spin up the Seshat Django app on a dev server
+config:
+ pulumi:tags:
+ value:
+ pulumi:template: azure-python
diff --git a/pulumi/__main__.py b/pulumi/__main__.py
new file mode 100644
index 000000000..b096e31b4
--- /dev/null
+++ b/pulumi/__main__.py
@@ -0,0 +1,163 @@
+import base64
+import pulumi
+import subprocess
+from os.path import expanduser
+from pulumi_azure import core, compute, network
+
+# Create an Azure Resource Group
+resource_group = core.ResourceGroup('seshat-pulumi', location='uksouth')
+
+# Create a network with a single subnet
+virtual_network = network.VirtualNetwork('virtualNetwork',
+ resource_group_name=resource_group.name,
+ address_spaces=['10.0.0.0/16'],
+ subnets=[{
+ 'name': 'default',
+ 'address_prefix': '10.0.1.0/24',
+ }]
+)
+
+# Create a public IP
+public_ip = network.PublicIp('publicIp',
+ resource_group_name=resource_group.name,
+ location=resource_group.location,
+ allocation_method='Dynamic',
+)
+
+# Create a network security group
+network_security_group = network.NetworkSecurityGroup('networkSecurityGroup',
+ resource_group_name=resource_group.name,
+ security_rules=[
+ {'name': 'ssh', 'priority': 1001, 'direction': 'Inbound',
+ 'access': 'Allow', 'protocol': 'Tcp', 'source_port_range': '*',
+ 'destination_port_range': '22', 'source_address_prefix': '*',
+ 'destination_address_prefix': '*'},
+ {'name': 'http', 'priority': 1002, 'direction': 'Inbound',
+ 'access': 'Allow', 'protocol': 'Tcp', 'source_port_range': '*',
+ 'destination_port_range': '80', 'source_address_prefix': '*',
+ 'destination_address_prefix': '*'},
+ {'name': 'https', 'priority': 1003, 'direction': 'Inbound',
+ 'access': 'Allow', 'protocol': 'Tcp', 'source_port_range': '*',
+ 'destination_port_range': '443', 'source_address_prefix': '*',
+ 'destination_address_prefix': '*'},
+ {'name': 'django', 'priority': 1004, 'direction': 'Inbound',
+ 'access': 'Allow', 'protocol': 'Tcp', 'source_port_range': '*',
+ 'destination_port_range': '8000', 'source_address_prefix': '*',
+ 'destination_address_prefix': '*'},
+ ]
+)
+
+# Associate the network security group with the subnet
+association = network.SubnetNetworkSecurityGroupAssociation('association',
+ subnet_id=virtual_network.subnets[0].id, # Use the subnet from the virtual network
+ network_security_group_id=network_security_group.id,
+)
+
+# Create a network interface and associate it with the subnet
+network_interface = network.NetworkInterface('networkInterface',
+ resource_group_name=resource_group.name,
+ ip_configurations=[{
+ 'name': 'webserver',
+ 'subnet_id': virtual_network.subnets[0].id, # Use the subnet from the virtual network
+ 'private_ip_address_allocation': 'Dynamic',
+ 'public_ip_address_id': public_ip.id,
+ }]
+)
+
+# Get the IP address as a string
+# TODO: move this into the VM script and run in python
+# ip_address = public_ip.ip_address.apply(lambda ip: ip if ip is not None else '')
+# os.environ['ALLOWED_HOSTS'] = ip_address
+
+# Create a data script for the VM
+# TODO: Set the ALLOWED_HOSTS environment variable (used by Django)
+custom_data_script = '''#!/bin/bash
+
+# Install Python 3.8
+sudo apt update
+sudo add-apt-repository ppa:deadsnakes/ppa
+sudo apt install -y python3.8
+sudo apt install -y python3.8-venv
+sudo apt-get install -y python3.8-dev
+sudo apt-get install -y g++
+
+# Install PostgreSQL 16
+sudo apt install -y gnupg2 wget vim
+sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
+curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
+sudo apt update
+sudo apt install -y postgresql-16 postgresql-contrib-16 postgresql-16-postgis-3
+sudo systemctl start postgresql
+sudo systemctl enable postgresql
+
+# Install GDAL and GEOS
+sudo apt-get install -y gdal-bin
+sudo apt-get install -y libgdal-dev
+sudo apt install -y libgeos++-dev libgeos3.10.2
+sudo apt install -y libgeos-c1v5 libgeos-dev libgeos-doc
+
+# Clone Seshat
+git clone https://github.com/edwardchalstrey1/seshat /home/webadmin/seshat
+cd /home/webadmin/seshat
+python3.8 -m venv venv
+source venv/bin/activate
+pip install -r requirements.txt
+pip install "django-geojson [field]"
+
+
+## TODO: Get the pulumi script to run the full setup
+# # Create .env file with database configuration
+# echo "NAME=
+# USER=postgres
+# HOST=localhost
+# PORT=5432
+# PASSWORD=" > /home/webadmin/seshat/seshat/settings/.env
+
+# # Run django
+# export DJANGO_SETTINGS_MODULE=seshat.settings.local
+# gunicorn seshat.wsgi:application --config gunicorn.conf.py &
+'''
+
+# Create a VM
+vm = compute.LinuxVirtualMachine('vm',
+ resource_group_name=resource_group.name,
+ network_interface_ids=[network_interface.id],
+ size='Standard_D2s_v3',
+ source_image_reference={
+ 'publisher': 'Canonical',
+ 'offer': '0001-com-ubuntu-server-jammy',
+ 'sku': '22_04-lts',
+ 'version': 'latest',
+ },
+ os_disk={
+ 'caching': 'ReadWrite',
+ 'storage_account_type': 'Premium_LRS',
+ },
+ computer_name='webserver',
+ admin_username='webadmin',
+ disable_password_authentication=True,
+ admin_ssh_keys=[{
+ 'username': 'webadmin',
+ 'public_key': pulumi.Config().require_secret('sshPublicKey'),
+ }],
+ custom_data=base64.b64encode(custom_data_script.encode('ascii')).decode('ascii'),
+)
+
+# Export the public IP address of the VM
+pulumi.export('publicIp', public_ip.ip_address)
+
+## TODO: Get the pulumi script to run the full setup
+# # Create a config object
+# config = pulumi.Config()
+
+# # Get the dump file path from the config
+# dump_file = config.require('dumpFile')
+
+# # Get the private key path from the config
+# private_key_path = expanduser(config.require('privateKey'))
+
+# # Copy database dump file to the VM
+# cmd = pulumi.Output.all(private_key_path, dump_file, public_ip.ip_address).apply(
+# lambda args: f"scp -i {args[0]} {args[1]} webadmin@{args[2]}:~/seshat.dump"
+# )
+# cmd_result = cmd.apply(lambda cmd: subprocess.run(cmd, shell=True, check=True))
diff --git a/pulumi/requirements.txt b/pulumi/requirements.txt
new file mode 100644
index 000000000..97bda9ba4
--- /dev/null
+++ b/pulumi/requirements.txt
@@ -0,0 +1,6 @@
+pulumi>=3.0.0,<4.0.0
+pulumi-azure-native>=2.0.0,<3.0.0
+pulumi-azure>=4.0.0,<5.0.0
+pulumi-azuread>=5.0.0,<6.0.0
+pulumi-random>=4.0.0,<5.0.0
+pulumi-command==0.9.2
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 87b623776..4d56c2607 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,11 @@
asgiref==3.5.0
-backports.zoneinfo==0.2.1
+backports.zoneinfo==0.2.1;python_version<"3.9"
bibtexparser==1.3.0
certifi==2021.10.8
cffi==1.15.1
charset-normalizer==2.0.12
cryptography==38.0.1
+distinctipy==1.2.3
defusedxml==0.7.1
dj-database-url==0.5.0
Django==4.0.3
@@ -12,13 +13,18 @@ django-allauth==0.51.0
django-cors-headers==3.11.0
django-crispy-forms==1.14.0
django-debug-toolbar==3.2.4
+django-environ==0.11.2
django-filter==21.1
+django_geojson==4.0.0
django-heroku==0.3.1
django-mathfilters==1.0.0
djangorestframework==3.13.1
+django-recaptcha==4.0.0
feedparser==6.0.10
+geopandas==0.13.2
gunicorn==20.1.0
idna==3.3
+matplotlib==3.7.4
MarkupSafe==2.1.1
oauthlib==3.2.1
psycopg2==2.9.3
diff --git a/seshat/__init__.py b/seshat/__init__.py
index e69de29bb..a68927d6c 100644
--- a/seshat/__init__.py
+++ b/seshat/__init__.py
@@ -0,0 +1 @@
+__version__ = "0.1.0"
\ No newline at end of file
diff --git a/seshat/apps/accounts/custom_validators.py b/seshat/apps/accounts/custom_validators.py
index a370ed352..d33e7f937 100644
--- a/seshat/apps/accounts/custom_validators.py
+++ b/seshat/apps/accounts/custom_validators.py
@@ -5,7 +5,18 @@
def validate_email_with_dots(value):
"""
- Custom validator to reject email addresses with more than four dots in their domain part.
+ Custom validator to reject email addresses with more than four dots in
+ their domain part.
+
+ Args:
+ value (str): The email address to validate.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the email address contains more than four dots in
+ the domain part.
"""
# Split the email address into local and domain parts
local_part, domain_part = value.split('@')
@@ -15,4 +26,3 @@ def validate_email_with_dots(value):
raise ValidationError("Email address contains too many dots in the domain part.")
# You can add more checks if needed
-
diff --git a/seshat/apps/accounts/forms.py b/seshat/apps/accounts/forms.py
index a6800226e..5edc1e1c6 100644
--- a/seshat/apps/accounts/forms.py
+++ b/seshat/apps/accounts/forms.py
@@ -8,13 +8,20 @@
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.template.defaulttags import register
-from .models import Seshat_Task, Seshat_Expert, Profile, User
+from .models import Seshat_Task, Seshat_Expert, Profile
+from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class Seshat_TaskForm(forms.ModelForm):
+ """
+ Form for adding or updating a task.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Seshat_Task
fields = ["giver", "taker", "task_description", "task_url"]
labels = {
@@ -48,9 +55,16 @@ class Meta:
# }
class ProfileForm(forms.ModelForm):
+ """
+ Form for adding or updating a profile.
+ """
first_name = forms.CharField(max_length=32)
last_name = forms.CharField(max_length=32)
+
class Meta:
+ """
+ :noindex:
+ """
model = Profile
fields = ["first_name", "last_name", "role", "location", "bio", ]
labels = {
@@ -62,20 +76,32 @@ class Meta:
}
widgets = {
- 'bio': forms.Textarea(attrs={'class': 'form-control mb-3', }),
-# 'role': forms.TextInput(attrs={'class': 'form-control mb-3', }),
-# 'location': forms.TextInput(attrs={'class': 'form-control mb-3', }),
-# 'last_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
-# 'first_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
-
+ 'bio': forms.Textarea(attrs={'class': 'form-control mb-3', }),
+# 'role': forms.TextInput(attrs={'class': 'form-control mb-3', }),
+# 'location': forms.TextInput(attrs={'class': 'form-control mb-3', }),
+# 'last_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
+# 'first_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
}
class CustomSignUpForm(UserCreationForm):
- # Your other form fields
+ """
+ Form for signing up a user.
+ """
def clean_email(self):
+ """
+ A method to clean the email field and check if it contains too many
+ dots in the username part.
+
+ Returns:
+ str: The email address if it is valid.
+
+ Raises:
+ ValidationError: If the email address contains too many dots in the
+ username part.
+ """
email = self.cleaned_data.get('email')
if email:
username, domain = email.split('@')
diff --git a/seshat/apps/accounts/models.py b/seshat/apps/accounts/models.py
index 9f86fe581..5c48dd467 100644
--- a/seshat/apps/accounts/models.py
+++ b/seshat/apps/accounts/models.py
@@ -16,6 +16,9 @@
# )
class Profile(models.Model):
+ """
+ Model representing a user profile.
+ """
SESHATADMIN = 1
RA = 2
SESHATEXPERT = 3
@@ -28,13 +31,21 @@ class Profile(models.Model):
)
user = models.OneToOneField(User, on_delete=models.CASCADE)
email_confirmed = models.BooleanField(default=False, null=True, blank=True)
- #avatar = models.ImageField(default='default.jpg', upload_to='profile_images')
+ # avatar = models.ImageField(default='default.jpg', upload_to='profile_images')
bio = models.TextField( null=True, blank=True)
location = models.CharField(max_length=30, blank=True)
role = models.PositiveSmallIntegerField(
choices=ROLE_CHOICES, null=True, blank=True)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('user-profile')
def __str__(self): # __unicode__ for Python 2
@@ -43,6 +54,9 @@ def __str__(self): # __unicode__ for Python 2
@receiver(post_save, sender=User)
def create_or_update_user_profile(sender, instance, created, **kwargs):
+ """
+ Signal handler for creating or updating a user profile.
+ """
if created:
Profile.objects.create(user=instance)
instance.profile.save()
@@ -51,6 +65,9 @@ def create_or_update_user_profile(sender, instance, created, **kwargs):
class Seshat_Expert(models.Model):
+ """
+ Model representing a Seshat Expert.
+ """
SESHATADMIN = 'Seshat Admin'
RA = 'RA'
SESHATEXPERT = 'Seshat Expert'
@@ -70,6 +87,9 @@ def __str__(self): # __unicode__ for Python 2
return self.user.username + " (" + self.role + ")"
class Seshat_Task(models.Model):
+ """
+ Model representing a Seshat Task.
+ """
giver = models.ForeignKey(Seshat_Expert, on_delete=models.CASCADE)
taker = models.ManyToManyField(Seshat_Expert, related_name="%(app_label)s_%(class)s_related", related_query_name="%(app_label)s_%(class)ss", blank=True,)
task_description = models.TextField( null=True, blank=True)
@@ -77,10 +97,24 @@ class Seshat_Task(models.Model):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('seshat_task-detail', args=[str(self.id)])
-
+
@property
def display_takers(self):
+ """
+ Returns a string of all takers of the task.
+
+ Returns:
+ str: A string of all takers of the task, joined with a HTML tag (" ").
+ """
all_takers = []
for taker in self.taker.all():
all_takers.append(taker.__str__())
@@ -88,6 +122,12 @@ def display_takers(self):
@property
def clickable_url(self):
+ """
+ Returns a clickable URL.
+
+ Returns:
+ str: A string of a clickable URL.
+ """
return f'{self.task_url}'
def __str__(self): # __unicode__ for Python 2
diff --git a/seshat/apps/accounts/tests.py b/seshat/apps/accounts/tests.py
index 7ce503c2d..e69de29bb 100644
--- a/seshat/apps/accounts/tests.py
+++ b/seshat/apps/accounts/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/accounts/views.py b/seshat/apps/accounts/views.py
index a4deb0224..965beb468 100644
--- a/seshat/apps/accounts/views.py
+++ b/seshat/apps/accounts/views.py
@@ -21,13 +21,50 @@
def accounts(request):
+ """
+ View function for the accounts page.
+
+ Note:
+ TODO: This seems like an unused function and it should be removed.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponse('
Hello Accounts.
')
def accounts_new(request):
+ """
+ View function for the accounts page.
+
+ Note:
+ TODO: This seems like an unused function and it should be removed.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponse('
Hello Aiiiiiiiccounts.
')
def has_add_scp_prv_permission(user):
+ """
+ Function to check if a user has the 'core.add_seshatprivatecommentpart' permission.
+
+ Note:
+ TODO: Investigate whether this function doubles with the functionality
+ of the 'permission_required' decorator.
+
+ Args:
+ user (User): The user object.
+
+ Returns:
+ bool: True if the user has the permission, False otherwise.
+ """
return user.has_perm('core.add_seshatprivatecommentpart')
@@ -54,6 +91,9 @@ def has_add_scp_prv_permission(user):
class ProfileUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ Generic class-based view for updating a user's profile.
+ """
model = Profile
context_object_name = 'user'
form_class = ProfileForm
@@ -62,6 +102,17 @@ class ProfileUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'core.add_seshatprivatecommentpart'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super(ProfileUpdate, self).get_context_data(**kwargs)
user = self.request.user
context['profile_form'] = ProfileForm(
@@ -69,8 +120,17 @@ def get_context_data(self, **kwargs):
initial={'first_name': user.first_name, 'last_name': user.last_name},
)
return context
-
+
def form_valid(self, form):
+ """
+ Method for saving the form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponseRedirect: The response object.
+ """
profile = form.save()
user = profile.user
user.last_name = form.cleaned_data['last_name']
@@ -87,6 +147,19 @@ def form_valid(self, form):
@login_required
@permission_required('core.add_seshatprivatecommentpart', raise_exception=True)
def profile(request):
+ """
+ View function for displaying a user's profile.
+
+ Note:
+ This view requires that the user be logged in.
+ This view requires that the user have the 'core.add_seshatprivatecommentpart' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
# all_vars = []
# a_huge_context_data_dic = {}
#my_data = m.objects.filter(polity = polity_id)
@@ -150,6 +223,9 @@ def profile(request):
return render(request, 'registration/profile.html', context=context)
class Seshat_taskCreate(PermissionRequiredMixin, CreateView):
+ """
+ Generic class-based view for creating a task.
+ """
model = Seshat_Task
form_class = Seshat_TaskForm
template_name = "registration/seshat_task/seshat_task_form.html"
@@ -169,6 +245,9 @@ class Seshat_taskCreate(PermissionRequiredMixin, CreateView):
# paginate_by = 10
class Seshat_taskDetailView(generic.DetailView):
+ """
+ Generic class-based detail view for a task.
+ """
model = Seshat_Task
template_name = "registration/seshat_task/seshat_task_detail.html"
@@ -187,9 +266,21 @@ class Seshat_taskDetailView(generic.DetailView):
# return response
-from .forms import CustomSignUpForm # Import your custom form
+from .forms import CustomSignUpForm
def signup(request):
+ """
+ View function for signing up a new user.
+
+ Note:
+ This view function handles both GET and POST requests.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if request.method == 'POST':
form = CustomSignUpForm(request.POST)
if form.is_valid():
diff --git a/seshat/apps/core/context_processors.py b/seshat/apps/core/context_processors.py
index 38d16d5da..37f56b276 100644
--- a/seshat/apps/core/context_processors.py
+++ b/seshat/apps/core/context_processors.py
@@ -1,7 +1,23 @@
from .models import SeshatPrivateCommentPart, Polity
from ..accounts.models import Seshat_Expert
+
def notifications(request):
+ """
+ Handle the notifications logic for authenticated users and fetch necessary
+ data.
+
+ Args:
+ request (HttpRequest): The HTTP request object.
+
+ Returns:
+ dict: A dictionary containing:
+ - 'notifications_count' (int): The number of private comments for
+ the authenticated user.
+ - 'all_polities' (QuerySet): A queryset of all polities.
+ - 'search_term' (str): The search term submitted in the request,
+ if any.
+ """
# Fetch the data you need
#print("Halooooooooooooooooo")
if request.user.is_authenticated:
@@ -26,4 +42,3 @@ def notifications(request):
'all_polities': all_polities,
'search_term': search_term,
}
-
diff --git a/seshat/apps/core/custom_filters.py b/seshat/apps/core/custom_filters.py
index 2b63e64a5..adf25b7f3 100644
--- a/seshat/apps/core/custom_filters.py
+++ b/seshat/apps/core/custom_filters.py
@@ -4,9 +4,28 @@
@register.filter
def get_attributes(obj):
+ """
+ A custom filter to get all attributes of an object in a template.
+
+ Args:
+ obj (object): The object to get attributes from.
+
+ Returns:
+ dict: A dictionary of the object's attributes.
+ """
return vars(obj)
@register.filter
def zip_lists(a, b):
+ """
+ A custom filter to zip two lists together in a template.
+
+ Args:
+ a (list): The first list to zip.
+ b (list): The second list to zip.
+
+ Returns:
+ zip: A zip object of the two lists.
+ """
return zip(a, b)
diff --git a/seshat/apps/core/forms.py b/seshat/apps/core/forms.py
index 8e8f8ee8c..d0a46ae11 100644
--- a/seshat/apps/core/forms.py
+++ b/seshat/apps/core/forms.py
@@ -19,7 +19,13 @@
#from .models import Religion
class ReligionForm(forms.ModelForm):
+ """
+ Form for adding or updating a new religion in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Religion
fields = ['religion_name',]
@@ -29,7 +35,13 @@ class Meta:
class ReferenceForm(forms.ModelForm):
+ """
+ Form for adding or updating a new reference in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Reference
fields = ('title', 'year', 'creator', 'zotero_link', 'long_name')
labels = {
@@ -54,8 +66,13 @@ class Meta:
class CitationForm(forms.ModelForm):
-
+ """
+ Form for adding or updating a new citation in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Citation
fields = ('ref', 'page_from', 'page_to', )
labels = {
@@ -71,6 +88,15 @@ class Meta:
attrs={'class': 'form-control mb-3 fw-bold', })
}
def clean(self):
+ """
+ Check if the citation is a duplicate.
+
+ Returns:
+ dict: The cleaned data.
+
+ Raises:
+ ValidationError: If the citation is a duplicate.
+ """
cleaned_data = super(CitationForm, self).clean()
cleaned_page_from = cleaned_data.get("page_from")
cleaned_page_to = cleaned_data.get("page_to")
@@ -87,7 +113,13 @@ def clean(self):
class PolityForm(forms.ModelForm):
+ """
+ Form for adding or updating a new polity in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity
fields = ('name', 'new_name', 'long_name', 'start_year', 'end_year','home_seshat_region', 'polity_tag' , 'shapefile_name', 'private_comment','general_description')
labels = {
@@ -117,13 +149,19 @@ class Meta:
'home_seshat_region': forms.Select(attrs={'class': 'form-control js-example-basic-single form-select mb-3',}),
'polity_tag': forms.Select(attrs={'class': 'form-control form-select mb-3',}),
'shapefile_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
- 'private_comment': forms.Textarea(attrs={'class': 'form-control', 'style': 'height: 100px', 'placeholder':'Add a private comment that will only be visible to Seshat experts and RAs.'}),
+ 'private_comment': forms.Textarea(attrs={'class': 'form-control', 'style': 'height: 100px', 'placeholder':'Add a private comment that will only be visible to Seshat experts and RAs.\nUse this box to request edits to the polity map data.'}),
'general_description': forms.Textarea(attrs={'class': 'form-control mb-3', 'style': 'height: 265px', 'placeholder':'Add a general description (optional)'}),
}
class PolityUpdateForm(forms.ModelForm):
+ """
+ Form for adding or updating an existing polity in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity
fields = ('name', 'new_name', 'long_name', 'start_year', 'end_year','home_seshat_region', 'polity_tag', 'shapefile_name', 'private_comment','general_description')
labels = {
@@ -153,14 +191,20 @@ class Meta:
'home_seshat_region': forms.Select(attrs={'class': 'form-control js-example-basic-single form-select mb-3',}),
'polity_tag': forms.Select(attrs={'class': 'form-control form-select mb-3',}),
'shapefile_name': forms.TextInput(attrs={'class': 'form-control mb-3', }),
- 'private_comment': forms.Textarea(attrs={'class': 'form-control', 'style': 'height: 100px', 'placeholder':'Add a private comment that will only be visible to seshat experts and RAs.'}),
+ 'private_comment': forms.Textarea(attrs={'class': 'form-control', 'style': 'height: 100px', 'placeholder':'Add a private comment that will only be visible to seshat experts and RAs.\nUse this box to request edits to the polity map data.'}),
'general_description': forms.Textarea(attrs={'class': 'form-control mb-3', 'style': 'height: 265px', 'placeholder':'Add a general description (optional)'}),
}
class NgaForm(forms.ModelForm):
+ """
+ Form for adding or updating a new NGA in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Nga
fields = ('name', 'world_region', 'subregion', 'fao_country')
labels = {
@@ -181,7 +225,13 @@ class Meta:
class CapitalForm(forms.ModelForm):
+ """
+ Form for adding or updating a new capital in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Capital
fields = ('name', 'latitude', 'longitude', 'current_country', 'alternative_names','is_verified', 'url_on_the_map', 'note')
labels = {
@@ -214,7 +264,13 @@ class Meta:
class SeshatCommentForm(forms.ModelForm):
+ """
+ Form for adding or updating a new comment in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = SeshatComment
fields = ('text',)
labels = {
@@ -225,7 +281,13 @@ class Meta:
}
class SeshatCommentPartForm(forms.ModelForm):
+ """
+ Form for adding or updating a new comment part in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = SeshatCommentPart
fields = ('comment', 'comment_part_text', 'comment_citations', 'comment_order', 'comment_curator')
labels = {
@@ -247,7 +309,13 @@ class Meta:
class SeshatPrivateCommentPartForm(forms.ModelForm):
+ """
+ Form for adding or updating a new private comment part in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = SeshatPrivateCommentPart
fields = ('private_comment', 'private_comment_part_text', 'private_comment_owner', 'private_comment_reader')
labels = {
@@ -267,7 +335,13 @@ class Meta:
class SeshatPrivateCommentForm(forms.ModelForm):
+ """
+ Form for adding or updating a new private comment in the database.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = SeshatPrivateComment
fields = ('text',)
labels = {
@@ -278,6 +352,9 @@ class Meta:
}
class ReferenceWithPageForm(forms.Form):
+ """
+ Form for adding or updating a new reference with page numbers in the database.
+ """
ref = forms.ModelChoiceField(
queryset=Reference.objects.all(),
widget=forms.Select(attrs={'class': 'form-control form-select mb-1 js-example-basic-single', 'text':'ref',}),
@@ -308,7 +385,20 @@ def __init__(self, *args, **kwargs):
self.helper.add_input(Submit('submit', 'Submit'))
class BaseReferenceFormSet(BaseFormSet):
+ """
+ Base formset for adding or updating multiple references to a comment.
+ """
def add_fields(self, form, index):
+ """
+ Add fields to the form.
+
+ Args:
+ form (Form): The form to add fields to.
+ index (int): The index of the form.
+
+ Returns:
+ None
+ """
super().add_fields(form, index)
form.fields['ref'].widget.attrs['class'] = 'form-control form-select mb-1 p-1 js-example-basic-single'
form.fields['page_from'].widget.attrs['class'] = 'form-control mb-1 p-1'
@@ -389,6 +479,9 @@ def clean_email(self):
return email
class Meta:
+ """
+ :noindex:
+ """
model = User
fields = ('username', 'first_name', 'last_name',
'email', 'password1', 'password2', 'captcha')
@@ -443,6 +536,9 @@ class VariablehierarchyFormNew(forms.Form):
label=" Verified?", required=False, widget=forms.CheckboxInput(attrs={'type': 'checkbox', 'class': 'form-control form-check-input align-middle'}))
class Meta:
+ """
+ :noindex:
+ """
unique_together = ("variable_name", "section_name", "subsection_name")
# VarHierFormSet = formset_factory(VariablehierarchyForm, extra=10)
diff --git a/seshat/apps/crisisdb/mycodes/__init__.py b/seshat/apps/core/management/__init__.py
similarity index 100%
rename from seshat/apps/crisisdb/mycodes/__init__.py
rename to seshat/apps/core/management/__init__.py
diff --git a/seshat/apps/core/management/commands/__init__.py b/seshat/apps/core/management/commands/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/seshat/apps/core/management/commands/populate_gadm.py b/seshat/apps/core/management/commands/populate_gadm.py
new file mode 100644
index 000000000..d96eb5e4b
--- /dev/null
+++ b/seshat/apps/core/management/commands/populate_gadm.py
@@ -0,0 +1,130 @@
+from django.db import connection
+from django.contrib.gis.gdal import DataSource
+from django.core.management.base import BaseCommand
+from seshat.apps.core.models import GADMShapefile, GADMCountries, GADMProvinces
+
+class Command(BaseCommand):
+ help = 'Populates the GADMShapefile table with features from a GeoPackage'
+
+ def add_arguments(self, parser):
+ parser.add_argument('gpkg_file', type=str, help='Path to the GeoPackage file')
+
+ def handle(self, *args, **options):
+
+ # Clear the GADMShapefile table
+ self.stdout.write(self.style.SUCCESS('Clearing GADMShapefile table...'))
+ GADMShapefile.objects.all().delete()
+ self.stdout.write(self.style.SUCCESS('GADMShapefile table cleared'))
+ # Clear the core_gadmcountries table
+ self.stdout.write(self.style.SUCCESS('Clearing core_gadmcountries table...'))
+ GADMCountries.objects.all().delete()
+ self.stdout.write(self.style.SUCCESS('core_gadmcountries table cleared'))
+ # Clear the core_gadmprovinces table
+ self.stdout.write(self.style.SUCCESS('Clearing core_gadmprovinces table...'))
+ GADMProvinces.objects.all().delete()
+
+ gpkg_file = options['gpkg_file']
+
+ data_source = DataSource(gpkg_file)
+ layer = data_source[0] # Access the first layer in the GeoPackage
+
+ for feature in layer:
+ geom = feature.geom # Retrieve the geometry of the feature
+ # Creating a GEOSGeometry object from the feature's geometry
+ geom_gis = geom.geos
+
+ # Create an entry in the GADMShapefile model for each feature in the layer
+ self.stdout.write(self.style.SUCCESS(f"Inserting features into the GADMShapefile table for {feature.get('COUNTRY')}..."))
+ GADMShapefile.objects.create(
+ geom=geom_gis,
+ UID=feature.get('UID'),
+ GID_0=feature.get('GID_0'),
+ NAME_0=feature.get('NAME_0'),
+ VARNAME_0=feature.get('VARNAME_0'),
+ GID_1=feature.get('GID_1'),
+ NAME_1=feature.get('NAME_1'),
+ VARNAME_1=feature.get('VARNAME_1'),
+ NL_NAME_1=feature.get('NL_NAME_1'),
+ ISO_1=feature.get('ISO_1'),
+ HASC_1=feature.get('HASC_1'),
+ CC_1=feature.get('CC_1'),
+ TYPE_1=feature.get('TYPE_1'),
+ ENGTYPE_1=feature.get('ENGTYPE_1'),
+ VALIDFR_1=feature.get('VALIDFR_1'),
+ GID_2=feature.get('GID_2'),
+ NAME_2=feature.get('NAME_2'),
+ VARNAME_2=feature.get('VARNAME_2'),
+ NL_NAME_2=feature.get('NL_NAME_2'),
+ HASC_2=feature.get('HASC_2'),
+ CC_2=feature.get('CC_2'),
+ TYPE_2=feature.get('TYPE_2'),
+ ENGTYPE_2=feature.get('ENGTYPE_2'),
+ VALIDFR_2=feature.get('VALIDFR_2'),
+ GID_3=feature.get('GID_3'),
+ NAME_3=feature.get('NAME_3'),
+ VARNAME_3=feature.get('VARNAME_3'),
+ NL_NAME_3=feature.get('NL_NAME_3'),
+ HASC_3=feature.get('HASC_3'),
+ CC_3=feature.get('CC_3'),
+ TYPE_3=feature.get('TYPE_3'),
+ ENGTYPE_3=feature.get('ENGTYPE_3'),
+ VALIDFR_3=feature.get('VALIDFR_3'),
+ GID_4=feature.get('GID_4'),
+ NAME_4=feature.get('NAME_4'),
+ VARNAME_4=feature.get('VARNAME_4'),
+ CC_4=feature.get('CC_4'),
+ TYPE_4=feature.get('TYPE_4'),
+ ENGTYPE_4=feature.get('ENGTYPE_4'),
+ VALIDFR_4=feature.get('VALIDFR_4'),
+ GID_5=feature.get('GID_5'),
+ NAME_5=feature.get('NAME_5'),
+ CC_5=feature.get('CC_5'),
+ TYPE_5=feature.get('TYPE_5'),
+ ENGTYPE_5=feature.get('ENGTYPE_5'),
+ GOVERNEDBY=feature.get('GOVERNEDBY'),
+ SOVEREIGN=feature.get('SOVEREIGN'),
+ DISPUTEDBY=feature.get('DISPUTEDBY'),
+ REGION=feature.get('REGION'),
+ VARREGION=feature.get('VARREGION'),
+ COUNTRY=feature.get('COUNTRY'),
+ CONTINENT=feature.get('CONTINENT'),
+ SUBCONT=feature.get('SUBCONT')
+ )
+
+ self.stdout.write(self.style.SUCCESS(f"Inserted feature into the GADMShapefile table."))
+
+ self.stdout.write(self.style.SUCCESS(f"Successfully populated the GADMShapefile table."))
+
+ # Populate the core_gadmcountries and core_gadmprovinces table
+ # The 0.01 value is the simplification tolerance.
+ # Using a lower value will increase the resolution of the shapes used, but result in slower loading in the django app.
+ # Some smaller countries/provinces cannot be simplified with 0.01, so try 0.001.
+ self.stdout.write(self.style.SUCCESS(f"Populating the core_gadmcountries table..."))
+ with connection.cursor() as cursor:
+ cursor.execute("""
+ INSERT INTO core_gadmcountries (geom, "COUNTRY")
+ SELECT
+ COALESCE(ST_Simplify(ST_Union(geom), 0.01), ST_Simplify(ST_Union(geom), 0.001)) AS geom,
+ "COUNTRY"
+ FROM
+ core_gadmshapefile
+ GROUP BY
+ "COUNTRY";
+ """)
+ self.stdout.write(self.style.SUCCESS(f"Successfully populated the core_gadmcountries table."))
+
+ self.stdout.write(self.style.SUCCESS(f"Populating the core_gadmprovinces table..."))
+ with connection.cursor() as cursor:
+ cursor.execute("""
+ INSERT INTO core_gadmprovinces (geom, "COUNTRY", "NAME_1", "ENGTYPE_1")
+ SELECT
+ COALESCE(ST_Simplify(ST_Union(geom), 0.01), ST_Simplify(ST_Union(geom), 0.001)) AS geom,
+ "COUNTRY",
+ "NAME_1",
+ "ENGTYPE_1"
+ FROM
+ core_gadmshapefile
+ GROUP BY
+ "COUNTRY", "NAME_1", "ENGTYPE_1";
+ """)
+ self.stdout.write(self.style.SUCCESS(f"Successfully populated the core_gadmprovinces table."))
\ No newline at end of file
diff --git a/seshat/apps/core/management/commands/populate_videodata.py b/seshat/apps/core/management/commands/populate_videodata.py
new file mode 100644
index 000000000..495333312
--- /dev/null
+++ b/seshat/apps/core/management/commands/populate_videodata.py
@@ -0,0 +1,192 @@
+import os
+import json
+import fnmatch
+from distinctipy import get_colors, get_hex
+from django.contrib.gis.geos import GEOSGeometry, MultiPolygon
+from django.core.management.base import BaseCommand
+from django.db import connection
+from seshat.apps.core.models import VideoShapefile
+
+class Command(BaseCommand):
+ help = 'Populates the database with Shapefiles'
+
+ def add_arguments(self, parser):
+ parser.add_argument('dir', type=str, help='Directory containing geojson files')
+
+ def handle(self, *args, **options):
+ dir = options['dir']
+
+ # Clear the VideoShapefile table
+ self.stdout.write(self.style.SUCCESS('Clearing VideoShapefile table...'))
+ VideoShapefile.objects.all().delete()
+ self.stdout.write(self.style.SUCCESS('VideoShapefile table cleared'))
+
+ # Get the start and end years for each shape
+ # Load a file with 'name_years.json' in the filename kept in the same dir as the geojson files.
+ # Loads a dict of polity names and their start and end years.
+ # The values are lists of the form [[first_start_year, first_end_year], [second_start_year, second_end_year], ...]
+
+ # List all files in the directory
+ files = os.listdir(dir)
+
+ # Find the first file that includes 'name_years.json' in the filename
+ name_years_file = next((f for f in files if fnmatch.fnmatch(f, '*name_years.json*')), None)
+
+ if name_years_file:
+ name_years_path = os.path.join(dir, name_years_file)
+ with open(name_years_path, 'r') as f:
+ name_years = json.load(f)
+ else:
+ self.stdout.write(self.style.ERROR("No file found with 'name_years.json' in the filename"))
+
+ # Dict of all the shape years for a given polity
+ polity_years = {}
+ # Set of all polities, for generating colour mapping
+ all_polities = set()
+ # Dict of all the polities found and the shapes they include
+ polity_shapes = {}
+ # Iterate over files in the directory
+ for filename in os.listdir(dir):
+ if filename.endswith('.geojson'):
+ file_path = os.path.join(dir, filename)
+
+ # Read and parse the GeoJSON file
+ with open(file_path, 'r') as geojson_file:
+ geojson_data = json.load(geojson_file)
+
+ # Extract data and create VideoShapefile instances
+ for feature in geojson_data['features']:
+ properties = feature['properties']
+ polity_name = properties['Name'].replace('(', '').replace(')', '') # Remove spaces and brackets from name
+ polity_colour_key = polity_name
+ try:
+ # If a shape has components we'll load the components instead
+ # ... unless the components have their own components, then load the top level shape
+ # ... or the shape is a personal union, then load the personal union shape
+ if properties['Components']:
+ if ';' not in properties['SeshatID']:
+ if len(properties['Components']) > 0 and '(' not in properties['Components']:
+ polity_name = None
+ except KeyError:
+ pass
+ try:
+ if properties['Member_of']:
+ # If a shape is a component, get the parent polity to use as the polity_colour_key
+ if len(properties['Member_of']) > 0:
+ polity_colour_key = properties['Member_of'].replace('(', '').replace(')', '')
+ except KeyError:
+ pass
+ if polity_name:
+ if properties['Type'] != 'POLITY':
+ polity_name = properties['Type'] + ': ' + polity_name
+ if polity_name not in polity_years:
+ polity_years[polity_name] = []
+ polity_years[polity_name].append(properties['Year'])
+ if polity_colour_key not in polity_shapes:
+ polity_shapes[polity_colour_key] = []
+ polity_shapes[polity_colour_key].append(feature)
+
+ all_polities.add(polity_colour_key)
+
+ self.stdout.write(self.style.SUCCESS(f'Found shape for {polity_name} ({properties["Year"]})'))
+
+ # Sort the polities and generate a colour mapping
+ unique_polities = sorted(all_polities)
+ self.stdout.write(self.style.SUCCESS(f'Generating colour mapping for {len(unique_polities)} polities'))
+ pol_col_map = polity_colour_mapping(unique_polities)
+ self.stdout.write(self.style.SUCCESS(f'Colour mapping generated'))
+
+ # Iterate through polity_shapes and create VideoShapefile instances
+ for polity_colour_key, features in polity_shapes.items():
+ for feature in features:
+ properties = feature['properties']
+ polity_name = properties["Name"].replace('(', '').replace(')', '')
+ if properties['Type'] != 'POLITY':
+ polity_name = properties['Type'] + ': ' + polity_name
+ self.stdout.write(self.style.SUCCESS(f'Importing shape for {polity_name} ({properties["Year"]})'))
+
+ # Get a sorted list of the shape years this polity
+ this_polity_years = sorted(polity_years[polity_name])
+
+ # Get the end year for a shape
+ # Most of the time, the shape end year is the year of the next shape
+ # Some polities have a gap in their active years
+ # For a shape year at the start of a gap, set the end year to be the shape year, so it doesn't cover the inactive period
+ start_end_years = name_years[properties['Name']]
+ end_years = [x[1] for x in start_end_years]
+
+ polity_start_year = start_end_years[0][0]
+ polity_end_year = end_years[-1]
+
+ # Raise an error if the shape year is not the start year of the polity
+ if this_polity_years[0] != polity_start_year:
+ raise ValueError(f'First shape year for {polity_name} is not the start year of the polity')
+
+ # Find the closest higher value from end_years to the shape year
+ next_end_year = min(end_years, key=lambda x: x if x >= properties['Year'] else float('inf'))
+
+ if properties['Year'] in end_years: # If the shape year is in the list of polity end years, the start year is the end year
+ end_year = properties['Year']
+ else:
+ this_year_index = this_polity_years.index(properties['Year'])
+ try: # Try to use the next shape year minus one as the end year if possible, unless it's higher than the next_end_year
+ next_shape_year_minus_one = this_polity_years[this_year_index + 1] - 1
+ end_year = next_shape_year_minus_one if next_shape_year_minus_one < next_end_year else next_end_year
+ except IndexError: # Otherwise assume the end year of the shape is the end year of the polity
+ end_year = polity_end_year
+
+ # Save geom and convert Polygon to MultiPolygon if necessary
+ geom = GEOSGeometry(json.dumps(feature['geometry']))
+ if geom.geom_type == 'Polygon':
+ geom = MultiPolygon(geom)
+
+ self.stdout.write(self.style.SUCCESS(f'Creating VideoShapefile instance for {polity_name} ({properties["Year"]} - {end_year})'))
+
+ VideoShapefile.objects.create(
+ geom=geom,
+ name=polity_name,
+ polity=polity_colour_key,
+ wikipedia_name=properties['Wikipedia'],
+ seshat_id=properties['SeshatID'],
+ area=properties['Area'],
+ start_year=properties['Year'],
+ end_year=end_year,
+ polity_start_year=polity_start_year,
+ polity_end_year=polity_end_year,
+ colour=pol_col_map[polity_colour_key]
+ )
+
+ self.stdout.write(self.style.SUCCESS(f'Successfully imported shape for {polity_name} ({properties["Year"]})'))
+
+ self.stdout.write(self.style.SUCCESS(f'Successfully imported all shapes for {polity_name}'))
+
+ self.stdout.write(self.style.SUCCESS(f'Successfully imported all data from {filename}'))
+
+ ###########################################################
+ ### Adjust the tolerance param of ST_Simplify as needed ###
+ ###########################################################
+
+ self.stdout.write(self.style.SUCCESS('Adding simplified geometries for faster loading...'))
+
+ ## Use this code if you want to simplify the geometries
+ # with connection.cursor() as cursor:
+ # cursor.execute("""
+ # UPDATE core_videoshapefile
+ # SET simplified_geom = ST_Simplify(geom, 0.07);
+ # """)
+
+ ## Use this code if you don't need to simplify the geometries
+ with connection.cursor() as cursor:
+ cursor.execute("""
+ UPDATE core_videoshapefile
+ SET simplified_geom = geom;
+ """)
+ self.stdout.write(self.style.SUCCESS('Simplified geometries added'))
+
+
+def polity_colour_mapping(polities):
+ """Use DistinctiPy package to assign a colour to each polity"""
+ colours = []
+ for col in get_colors(len(polities)):
+ colours.append(get_hex(col))
+ return dict(zip(polities, colours))
diff --git a/seshat/apps/core/migrations/0064_gadmcountries_gadmprovinces_gadmshapefile_and_more.py b/seshat/apps/core/migrations/0064_gadmcountries_gadmprovinces_gadmshapefile_and_more.py
new file mode 100644
index 000000000..4ebcdce09
--- /dev/null
+++ b/seshat/apps/core/migrations/0064_gadmcountries_gadmprovinces_gadmshapefile_and_more.py
@@ -0,0 +1,109 @@
+# Generated by Django 4.0.3 on 2024-05-13 10:41
+
+import django.contrib.gis.db.models.fields
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0063_seshatprivatecommentpart_private_comment_reader'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='GADMCountries',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
+ ('COUNTRY', models.CharField(max_length=100, null=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='GADMProvinces',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
+ ('COUNTRY', models.CharField(max_length=100, null=True)),
+ ('NAME_1', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_1', models.CharField(max_length=100, null=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='GADMShapefile',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
+ ('UID', models.BigIntegerField()),
+ ('GID_0', models.CharField(max_length=100, null=True)),
+ ('NAME_0', models.CharField(max_length=100, null=True)),
+ ('VARNAME_0', models.CharField(max_length=100, null=True)),
+ ('GID_1', models.CharField(max_length=100, null=True)),
+ ('NAME_1', models.CharField(max_length=100, null=True)),
+ ('VARNAME_1', models.CharField(max_length=100, null=True)),
+ ('NL_NAME_1', models.CharField(max_length=100, null=True)),
+ ('ISO_1', models.CharField(max_length=100, null=True)),
+ ('HASC_1', models.CharField(max_length=100, null=True)),
+ ('CC_1', models.CharField(max_length=100, null=True)),
+ ('TYPE_1', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_1', models.CharField(max_length=100, null=True)),
+ ('VALIDFR_1', models.CharField(max_length=100, null=True)),
+ ('GID_2', models.CharField(max_length=100, null=True)),
+ ('NAME_2', models.CharField(max_length=100, null=True)),
+ ('VARNAME_2', models.CharField(max_length=100, null=True)),
+ ('NL_NAME_2', models.CharField(max_length=100, null=True)),
+ ('HASC_2', models.CharField(max_length=100, null=True)),
+ ('CC_2', models.CharField(max_length=100, null=True)),
+ ('TYPE_2', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_2', models.CharField(max_length=100, null=True)),
+ ('VALIDFR_2', models.CharField(max_length=100, null=True)),
+ ('GID_3', models.CharField(max_length=100, null=True)),
+ ('NAME_3', models.CharField(max_length=100, null=True)),
+ ('VARNAME_3', models.CharField(max_length=100, null=True)),
+ ('NL_NAME_3', models.CharField(max_length=100, null=True)),
+ ('HASC_3', models.CharField(max_length=100, null=True)),
+ ('CC_3', models.CharField(max_length=100, null=True)),
+ ('TYPE_3', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_3', models.CharField(max_length=100, null=True)),
+ ('VALIDFR_3', models.CharField(max_length=100, null=True)),
+ ('GID_4', models.CharField(max_length=100, null=True)),
+ ('NAME_4', models.CharField(max_length=100, null=True)),
+ ('VARNAME_4', models.CharField(max_length=100, null=True)),
+ ('CC_4', models.CharField(max_length=100, null=True)),
+ ('TYPE_4', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_4', models.CharField(max_length=100, null=True)),
+ ('VALIDFR_4', models.CharField(max_length=100, null=True)),
+ ('GID_5', models.CharField(max_length=100, null=True)),
+ ('NAME_5', models.CharField(max_length=100, null=True)),
+ ('CC_5', models.CharField(max_length=100, null=True)),
+ ('TYPE_5', models.CharField(max_length=100, null=True)),
+ ('ENGTYPE_5', models.CharField(max_length=100, null=True)),
+ ('GOVERNEDBY', models.CharField(max_length=100, null=True)),
+ ('SOVEREIGN', models.CharField(max_length=100, null=True)),
+ ('DISPUTEDBY', models.CharField(max_length=100, null=True)),
+ ('REGION', models.CharField(max_length=100, null=True)),
+ ('VARREGION', models.CharField(max_length=100, null=True)),
+ ('COUNTRY', models.CharField(max_length=100, null=True)),
+ ('CONTINENT', models.CharField(max_length=100, null=True)),
+ ('SUBCONT', models.CharField(max_length=100, null=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='VideoShapefile',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('geom', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
+ ('simplified_geom', django.contrib.gis.db.models.fields.MultiPolygonField(null=True, srid=4326)),
+ ('name', models.CharField(max_length=100)),
+ ('polity', models.CharField(max_length=100)),
+ ('wikipedia_name', models.CharField(max_length=100, null=True)),
+ ('seshat_id', models.CharField(max_length=100)),
+ ('area', models.FloatField()),
+ ('start_year', models.IntegerField()),
+ ('end_year', models.IntegerField()),
+ ('polity_start_year', models.IntegerField()),
+ ('polity_end_year', models.IntegerField()),
+ ('colour', models.CharField(max_length=7)),
+ ],
+ ),
+ ]
diff --git a/seshat/apps/core/migrations/0065_alter_videoshapefile_id.py b/seshat/apps/core/migrations/0065_alter_videoshapefile_id.py
new file mode 100644
index 000000000..eb3c28094
--- /dev/null
+++ b/seshat/apps/core/migrations/0065_alter_videoshapefile_id.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.0.3 on 2024-05-22 14:14
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('core', '0064_gadmcountries_gadmprovinces_gadmshapefile_and_more'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='videoshapefile',
+ name='id',
+ field=models.AutoField(primary_key=True, serialize=False),
+ ),
+ ]
diff --git a/seshat/apps/core/models.py b/seshat/apps/core/models.py
index 6c0b11deb..5aa8cf3d9 100644
--- a/seshat/apps/core/models.py
+++ b/seshat/apps/core/models.py
@@ -1,4 +1,4 @@
-from django.db import models
+from django.contrib.gis.db import models
from django.db.models.fields.related import ManyToManyField
from django.contrib.auth.models import User
from django.utils.safestring import mark_safe
@@ -26,6 +26,15 @@
from django.core.validators import URLValidator
def give_me_a_color_for_expert(value):
+ """
+ Returns a color for a given expert.
+
+ Args:
+ value (int): The id of the expert.
+
+ Returns:
+ str: A color for the expert.
+ """
light_colors = [
'#e6b8af',
'#f4cccc',
@@ -143,20 +152,56 @@ def give_me_a_color_for_expert(value):
)
def return_citations_for_comments(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
if self.comment_citations.all():
return ', '.join([' ' + citation.citation_short_title + '' for citation in self.comment_citations.all()])
def return_number_of_citations_for_comments(self):
+ """
+ Returns the number of citations for a comment.
+
+ Returns:
+ int: The number of citations for a comment.
+ """
if self.comment_citations.all():
return len(self.comment_citations.all())
return 0
def return_citations_plus_for_comments(self):
+ """
+ Returns a string of all the citations for a comment.
+
+ Returns:
+ str: A string of all the citations for a comment.
+ """
get_scp_tr = ScpThroughCtn.objects.filter(seshatcommentpart=self.id)
if get_scp_tr:
return ', '.join([' ' + x.citation.citation_short_title + '' for x in get_scp_tr])
def return_number_of_citations_plus_for_comments(self):
+ """
+ Returns the number of citations for a comment.
+
+ Returns:
+ int: The number of citations for a comment.
+ """
get_scp_tr = ScpThroughCtn.objects.filter(seshatcommentpart=self.id)
if get_scp_tr:
return len(get_scp_tr)
@@ -166,6 +211,9 @@ def return_number_of_citations_plus_for_comments(self):
class SeshatPrivateComment(models.Model):
+ """
+ Model representing a private comment.
+ """
text = models.TextField(blank=True, null=True,)
def __str__(self) -> str:
@@ -187,9 +235,20 @@ def __str__(self) -> str:
return f'{to_be_shown}'
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('seshatprivatecomments')
class SeshatPrivateCommentPart(models.Model):
+ """
+ Model representing a part of a private comment.
+ """
private_comment = models.ForeignKey(SeshatPrivateComment, on_delete=models.SET_NULL, related_name="inner_private_comments_related",
related_query_name="inner_private_comments_related", null=True, blank=True)
private_comment_part_text = models.TextField(blank=True, null=True,)
@@ -202,13 +261,23 @@ class SeshatPrivateCommentPart(models.Model):
last_modified_date = models.DateTimeField(auto_now=True, blank=True, null=True)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('seshatprivatecomment-update', args=[str(self.private_comment.id)])
class Meta:
+ """
+ :noindex:
+ """
ordering = ["created_date", "last_modified_date"]
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.private_comment_part_text:
return self.private_comment_part_text
else:
@@ -216,20 +285,32 @@ def __str__(self) -> str:
class Macro_region(models.Model):
+ """
+ Model representing a macro region.
+ """
name = models.CharField(max_length=100)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['name',]
def __str__(self):
return self.name
class Seshat_region(models.Model):
+ """
+ Model representing a Seshat region.
+ """
name = models.CharField(max_length=100)
mac_region = models.ForeignKey(Macro_region, on_delete=models.SET_NULL, null=True, blank=True, related_name="mac_region")
subregions_list = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['mac_region__name', 'name']
def __str__(self):
@@ -239,6 +320,9 @@ def __str__(self):
class Nga(models.Model):
+ """
+ Model representing a NGA.
+ """
name = models.CharField(max_length=100)
subregion = models.CharField(max_length=100, blank=True, null=True)
longitude = models.DecimalField(max_digits= 16, decimal_places = 12, blank=True, null=True)
@@ -249,18 +333,31 @@ class Nga(models.Model):
world_region = models.CharField(max_length=100, choices=WORLD_REGION_CHOICES, default="Europe", null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['name']
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('ngas')
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
return self.name
class Polity(models.Model):
+ """
+ Model representing a polity.
+ """
name = models.CharField(max_length=100)
start_year = models.IntegerField(blank=True, null=True)
end_year = models.IntegerField(blank=True, null=True)
@@ -279,10 +376,26 @@ class Polity(models.Model):
modified_date = models.DateTimeField(auto_now=True, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'polity'
verbose_name_plural = 'polities'
+ unique_together = ("name",)
+ ordering = ['long_name']
def clean(self):
+ """
+ Verifies a number of conditions on the start and end years of the polity.
+
+ Raises:
+ ValidationError: If the start year is greater than the end year.
+ ValidationError: If the end year is greater than the current year.
+ ValidationError: If the start year is greater than the current year.
+
+ Returns:
+ None
+ """
current_year = date.today().year
if self.start_year is not None and self.end_year is not None and self.start_year > self.end_year:
raise ValidationError("Start year cannot be greater than end year.")
@@ -292,18 +405,16 @@ def clean(self):
raise ValidationError("Start year cannot be greater than the current year")
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.long_name and self.new_name:
return f"{self.long_name} ({self.new_name})"
else:
return self.name
-
- class Meta:
- unique_together = ("name",)
- ordering = ['long_name']
class Capital(models.Model):
+ """
+ Model representing a capital.
+ """
name = models.CharField(max_length=100)
alternative_names = models.CharField(max_length=300, blank=True, null=True)
current_country = models.CharField(max_length=100, blank=True, null=True)
@@ -319,19 +430,33 @@ class Capital(models.Model):
blank=True, null=True,)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('capitals')
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.name and self.alternative_names:
return str(self.name) + " [" + str(self.alternative_names) + "]"
return self.name
class Meta:
- #ordering = ['-year']
- ordering = ['is_verified']
+ """
+ :noindex:
+ """
+
+ #ordering = ['-year']
+ ordering = ['is_verified']
class Ngapolityrel(models.Model):
+ """
+ Model representing a relationship between a NGA and a polity.
+ """
name = models.CharField(max_length=200, blank=True, null=True)
polity_party = models.ForeignKey(Polity, on_delete=models.SET_NULL, null=True, related_name="polity_sides")
nga_party = models.ForeignKey(Nga, on_delete=models.SET_NULL, null=True, related_name="nga_sides")
@@ -340,7 +465,6 @@ class Ngapolityrel(models.Model):
is_home_nga = models.BooleanField(default=False, blank=True, null=True)
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.name:
return self.name
elif self.polity_party and self.nga_party:
@@ -349,43 +473,56 @@ def __str__(self) -> str:
return str(self.id)
class Country(models.Model):
+ """
+ Model representing a country.
+ """
name = models.CharField(max_length=200)
polity = models.ForeignKey(
Polity, on_delete=models.SET_NULL, null=True, related_name="countries")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'country'
verbose_name_plural = 'countries'
+ unique_together = ("name",)
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
return self.name
-
- class Meta:
- unique_together = ("name",)
class Section(models.Model):
+ """
+ Model representing a section.
+ """
name = models.CharField(max_length=200)
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
return self.name
class Meta:
+ """
+ :noindex:
+ """
unique_together = ("name",)
class Subsection(models.Model):
+ """
+ Model representing a subsection.
+ """
name = models.CharField(max_length=200)
section = models.ForeignKey(
Section, on_delete=models.SET_NULL, null=True, related_name="subsections")
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
return self.name
-
+
class Meta:
+ """
+ :noindex:
+ """
unique_together = ("name", "section")
@@ -422,6 +559,9 @@ class Meta:
class Variablehierarchy(models.Model):
+ """
+ Model representing a variable hierarchy.
+ """
name = models.CharField(
max_length=200)
section = models.ForeignKey(
@@ -432,15 +572,19 @@ class Variablehierarchy(models.Model):
explanation = models.TextField(blank=True, null=True,)
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
return self.name
class Meta:
+ """
+ :noindex:
+ """
unique_together = ("name", "section", "subsection")
class Reference(models.Model):
- """Model Representing a Reference"""
+ """
+ Model Representing a reference.
+ """
title = models.CharField(max_length=500,)
year = models.IntegerField(blank=True, null=True, )
creator = models.CharField(max_length=500, )
@@ -451,7 +595,6 @@ class Reference(models.Model):
modified_date = models.DateTimeField(auto_now=True, blank=True, null=True)
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
original_title = self.title
if len(original_title) > 60:
shorter_title = original_title[0:60] + original_title[60:].split(" ")[0] + " ..."
@@ -462,10 +605,16 @@ def __str__(self) -> str:
else:
return "(%s_XXXX): %s" % (self.creator, shorter_title,)
-
@property
def reference_short_title(self):
- """Second String for representing the Model Object"""
+ """
+ Returns a short title for the reference. If the title is longer than
+ 60 characters, it is truncated. If the title is not provided, a default
+ title is returned.
+
+ Returns:
+ str: A short title for the reference.
+ """
original_long_name = self.long_name
if original_long_name and len(original_long_name) > 60:
@@ -483,17 +632,30 @@ def reference_short_title(self):
return "NO_TITLES_PROVIDED"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('references')
class Meta:
- #ordering = ['-year']
- unique_together = ("zotero_link",)
- ordering = ['-created_date', 'title']
-
+ """
+ :noindex:
+ """
+ # ordering = ['-year']
+ unique_together = ("zotero_link",)
+ ordering = ['-created_date', 'title']
class Citation(models.Model):
- """Model representing a specific citation."""
+ """
+ Model representing a specific citation.
+ """
+
id = models.UUIDField(primary_key=True, default=uuid.uuid4,
help_text="Unique Id for this particular citation")
ref = models.ForeignKey(
@@ -509,6 +671,12 @@ class Citation(models.Model):
# ("can_renew", "Can Renew A Book"),)
def zoteroer(self):
+ """
+ Returns the Zotero link for the citation.
+
+ Returns:
+ str: The Zotero link for the citation.
+ """
if self.ref.zotero_link and "NOZOTERO_LINK" not in self.ref.zotero_link:
my_zotero_link = "https://www.zotero.org/groups/1051264/seshat_databank/items/" + \
str(self.ref.zotero_link)
@@ -522,7 +690,6 @@ def zoteroer(self):
# return(str(self.page_to))
def __str__(self) -> str:
- """String for representing the Model Object"""
if self.ref and self.ref.title:
original_title = self.ref.title
else:
@@ -539,12 +706,12 @@ def __str__(self) -> str:
else:
original_long_name = "REFERENCE_WITH_NO_LONG_NAME"
if original_long_name and len(original_long_name) > 50:
- shorter_name = original_long_name[0:50] + original_long_name[50:].split(" ")[0] + "..."
+ shorter_name = original_long_name[0:50] + original_long_name[50:].split(" ")[0] + "..."
elif original_long_name:
- shorter_name = original_long_name
+ shorter_name = original_long_name
else:
shorter_name = "BlaBla"
-
+
if self.ref and self.ref.zotero_link and "NOZOTERO_LINK" in self.ref.zotero_link:
return f'(NOZOTERO: {shorter_name})'
if self.ref and self.ref.creator:
@@ -563,11 +730,19 @@ def __str__(self) -> str:
print(self.id)
print(self.modified_date)
-
return "BADBADREFERENCE"
-
+
def full_citation_display(self) -> str:
- """String for representing the Model Object"""
+ """
+ Returns a string of the full citation. If the citation has a title, it
+ is included in the string. If the citation has a creator, it is
+ included in the string. If the citation has a year, it is included in
+ the string. If the citation has a page_from, it is included in the
+ string. If the citation has a page_to, it is included in the string.
+
+ Returns:
+ str: A string of the full citation.
+ """
if self.ref and self.ref.title:
original_title = self.ref.title
else:
@@ -582,10 +757,10 @@ def full_citation_display(self) -> str:
else:
original_long_name = "REFERENCE_WITH_NO_LONG_NAME"
if original_long_name:
- shorter_name = original_long_name
+ shorter_name = original_long_name
else:
shorter_name = "BlaBla"
-
+
if self.ref and self.ref.zotero_link and "NOZOTERO_LINK" in self.ref.zotero_link:
return f'(NOZOTERO: {shorter_name})'
if self.ref and self.ref.creator:
@@ -604,13 +779,15 @@ def full_citation_display(self) -> str:
print(self.id)
print(self.modified_date)
-
return "BADBADREFERENCE"
-
+
class Meta:
- #ordering = ['-year']
- ordering = ['-modified_date']
- constraints = [
+ """
+ :noindex:
+ """
+ #ordering = ['-year']
+ ordering = ['-modified_date']
+ constraints = [
models.UniqueConstraint(
name="No_PAGE_TO_AND_FROM",
fields=("ref",),
@@ -626,18 +803,25 @@ class Meta:
fields=("ref", "page_to"),
condition=Q(page_from__isnull=True)
),
- ]
- #unique_together = ["ref", "page_from", "page_to"]
-
+ ]
+ #unique_together = ["ref", "page_from", "page_to"]
+
@property
def citation_short_title(self):
- """Second String for representing the Model Object"""
+ """
+ Returns a short title for the citation. If the title is longer than
+ 40 characters, it is truncated. If the title is not provided, a default
+ title is returned.
+
+ Returns:
+ str: A short title for the citation.
+ """
original_long_name = self.ref.long_name
if original_long_name and len(original_long_name) > 40:
- shorter_name = original_long_name[0:40] + original_long_name[40:].split(" ")[0] + "..."
+ shorter_name = original_long_name[0:40] + original_long_name[40:].split(" ")[0] + "..."
elif original_long_name:
- shorter_name = original_long_name
+ shorter_name = original_long_name
else:
shorter_name = "BlaBla"
@@ -656,25 +840,54 @@ def citation_short_title(self):
return '[{0} {1}]'.format(self.ref.creator, self.ref.year)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('citations')
def save(self, *args, **kwargs):
+ """
+ Saves the citation to the database.
+
+ Args:
+ *args: Additional arguments.
+ **kwargs: Additional keyword arguments.
+
+ Raises:
+ IntegrityError: If the citation cannot be saved to the database.
+
+ Returns:
+ None
+ """
try:
super(Citation, self).save(*args, **kwargs)
except IntegrityError as e:
print(e)
class SeshatComment(models.Model):
+ """
+ Model representing a comment.
+ """
text = models.TextField(blank=True, null=True,)
def zoteroer(self):
+ """
+ Returns the Zotero link for the comment.
+
+ Returns:
+ str: The Zotero link for the comment.
+ """
if self.ref.zotero_link and "NOZOTERO_LINK" not in self.ref.zotero_link:
my_zotero_link = "https://www.zotero.org/groups/1051264/seshat_databank/items/" + \
str(self.ref.zotero_link)
else:
my_zotero_link = "#"
return my_zotero_link
-
def __str__(self) -> str:
all_comment_parts = self.inner_comments_related.all().order_by('comment_order')
@@ -712,10 +925,21 @@ def __str__(self) -> str:
return f'{to_be_shown}'
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('seshatcomments')
class SeshatCommentPart(models.Model):
+ """
+ Model representing a part of a comment.
+ """
comment = models.ForeignKey(SeshatComment, on_delete=models.SET_NULL, related_name="inner_comments_related",
related_query_name="inner_comments_related", null=True, blank=True)
comment_part_text = models.TextField(blank=True, null=True,)
@@ -730,17 +954,46 @@ class SeshatCommentPart(models.Model):
citation_index = models.IntegerField(blank=True, null=True)
modified_date = models.DateTimeField(auto_now=True, blank=True, null=True)
-
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the
+ return_citations_for_comments function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations_for_comments(self)
-
+
@property
def citations_count(self):
+ """
+ Returns the number of citations for a comment.
+
+ Returns:
+ int: The number of citations for a comment.
+ """
return return_number_of_citations_for_comments(self)
@property
def display_citations_plus(self):
+ """
+ Returns a string of all the citations for a comment.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the
+ return_citations_for_comments function.
+
+ Returns:
+ str: A string of all the citations for a comment.
+ """
if return_citations_plus_for_comments(self) and return_citations_for_comments(self):
return return_citations_plus_for_comments(self) + return_citations_for_comments(self)
elif return_citations_plus_for_comments(self):
@@ -750,17 +1003,33 @@ def display_citations_plus(self):
@property
def citations_count_plus(self):
+ """
+ Returns the number of citations for a comment.
+
+ Returns:
+ int: The number of citations for a comment.
+ """
return return_number_of_citations_plus_for_comments(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('seshatcomment-update', args=[str(self.comment.id)])
class Meta:
+ """
+ :noindex:
+ """
ordering = ['comment_order', "modified_date"]
#ordering = ["modified_date"]
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.comment_part_text and self.display_citations_plus:
return self.comment_part_text + ' ' + self.display_citations_plus
elif self.comment_part_text and self.display_citations:
@@ -772,6 +1041,10 @@ def __str__(self) -> str:
class ScpThroughCtn(models.Model):
+ """
+ Model representing a through model for the many-to-many relationship between
+ a comment part and a citation.
+ """
seshatcommentpart = models.ForeignKey(SeshatCommentPart, on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s_related",
related_query_name="%(app_label)s_%(class)s", null=True, blank=True)
citation = models.ForeignKey(Citation, on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s_related",
@@ -780,6 +1053,9 @@ class ScpThroughCtn(models.Model):
class SeshatCommon(models.Model):
+ """
+ Model representing a common Seshat model.
+ """
polity = models.ForeignKey(Polity, on_delete=models.SET_NULL, related_name="%(app_label)s_%(class)s_related",
related_query_name="%(app_label)s_%(class)s", null=True, blank=True)
name = models.CharField(
@@ -809,6 +1085,9 @@ class SeshatCommon(models.Model):
private_comment = models.ForeignKey(SeshatPrivateComment, on_delete=models.DO_NOTHING, related_name="%(app_label)s_%(class)s_related", related_query_name="%(app_label)s_%(class)s", null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
abstract = True
ordering = ['polity']
@@ -819,19 +1098,129 @@ class Meta:
# job_category = models.CharField(choices=job_category_annual_wages_choices)
# job_description = models.CharField(
# choices=job_description_annual_wages_choices)
-
-
+
class Religion(models.Model):
+ """
+ Model representing a religion.
+ """
name = models.CharField(max_length=100, default="Religion")
religion_name = models.CharField(max_length=100, null=True, blank=True)
religion_family = models.CharField(max_length=100, blank=True, null=True)
religion_genus = models.CharField(max_length=100, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['name']
def __str__(self) -> str:
- """string for epresenting the model obj in Admin Site"""
if self.religion_name:
return self.religion_name
- return self.name
\ No newline at end of file
+ return self.name
+
+# Shapefile models
+
+class VideoShapefile(models.Model):
+ """
+ Model representing a video shapefile.
+ """
+ id = models.AutoField(primary_key=True)
+ geom = models.MultiPolygonField()
+ simplified_geom = models.MultiPolygonField(null=True)
+ name=models.CharField(max_length=100)
+ polity=models.CharField(max_length=100)
+ wikipedia_name=models.CharField(max_length=100, null=True)
+ seshat_id=models.CharField(max_length=100)
+ area=models.FloatField()
+ start_year=models.IntegerField()
+ end_year=models.IntegerField()
+ polity_start_year=models.IntegerField()
+ polity_end_year=models.IntegerField()
+ colour=models.CharField(max_length=7)
+
+ def __str__(self):
+ return "Name: %s" % self.name
+
+class GADMShapefile(models.Model):
+ """
+
+ """
+ geom = models.MultiPolygonField()
+ UID=models.BigIntegerField()
+ GID_0=models.CharField(max_length=100, null=True)
+ NAME_0=models.CharField(max_length=100, null=True)
+ VARNAME_0=models.CharField(max_length=100, null=True)
+ GID_1=models.CharField(max_length=100, null=True)
+ NAME_1=models.CharField(max_length=100, null=True)
+ VARNAME_1=models.CharField(max_length=100, null=True)
+ NL_NAME_1=models.CharField(max_length=100, null=True)
+ ISO_1=models.CharField(max_length=100, null=True)
+ HASC_1=models.CharField(max_length=100, null=True)
+ CC_1=models.CharField(max_length=100, null=True)
+ TYPE_1=models.CharField(max_length=100, null=True)
+ ENGTYPE_1=models.CharField(max_length=100, null=True)
+ VALIDFR_1=models.CharField(max_length=100, null=True)
+ GID_2=models.CharField(max_length=100, null=True)
+ NAME_2=models.CharField(max_length=100, null=True)
+ VARNAME_2=models.CharField(max_length=100, null=True)
+ NL_NAME_2=models.CharField(max_length=100, null=True)
+ HASC_2=models.CharField(max_length=100, null=True)
+ CC_2=models.CharField(max_length=100, null=True)
+ TYPE_2=models.CharField(max_length=100, null=True)
+ ENGTYPE_2=models.CharField(max_length=100, null=True)
+ VALIDFR_2=models.CharField(max_length=100, null=True)
+ GID_3=models.CharField(max_length=100, null=True)
+ NAME_3=models.CharField(max_length=100, null=True)
+ VARNAME_3=models.CharField(max_length=100, null=True)
+ NL_NAME_3=models.CharField(max_length=100, null=True)
+ HASC_3=models.CharField(max_length=100, null=True)
+ CC_3=models.CharField(max_length=100, null=True)
+ TYPE_3=models.CharField(max_length=100, null=True)
+ ENGTYPE_3=models.CharField(max_length=100, null=True)
+ VALIDFR_3=models.CharField(max_length=100, null=True)
+ GID_4=models.CharField(max_length=100, null=True)
+ NAME_4=models.CharField(max_length=100, null=True)
+ VARNAME_4=models.CharField(max_length=100, null=True)
+ CC_4=models.CharField(max_length=100, null=True)
+ TYPE_4=models.CharField(max_length=100, null=True)
+ ENGTYPE_4=models.CharField(max_length=100, null=True)
+ VALIDFR_4=models.CharField(max_length=100, null=True)
+ GID_5=models.CharField(max_length=100, null=True)
+ NAME_5=models.CharField(max_length=100, null=True)
+ CC_5=models.CharField(max_length=100, null=True)
+ TYPE_5=models.CharField(max_length=100, null=True)
+ ENGTYPE_5=models.CharField(max_length=100, null=True)
+ GOVERNEDBY=models.CharField(max_length=100, null=True)
+ SOVEREIGN=models.CharField(max_length=100, null=True)
+ DISPUTEDBY=models.CharField(max_length=100, null=True)
+ REGION=models.CharField(max_length=100, null=True)
+ VARREGION=models.CharField(max_length=100, null=True)
+ COUNTRY=models.CharField(max_length=100, null=True)
+ CONTINENT=models.CharField(max_length=100, null=True)
+ SUBCONT=models.CharField(max_length=100, null=True)
+
+ def __str__(self):
+ return "Name: %s" % self.name
+
+class GADMCountries(models.Model):
+ """
+ Model representing a country (GADM).
+ """
+ geom = models.MultiPolygonField()
+ COUNTRY=models.CharField(max_length=100, null=True)
+
+ def __str__(self):
+ return "Name: %s" % self.name
+
+class GADMProvinces(models.Model):
+ """
+ Model representing a province (GADM).
+ """
+ geom = models.MultiPolygonField()
+ COUNTRY=models.CharField(max_length=100, null=True)
+ NAME_1=models.CharField(max_length=100, null=True)
+ ENGTYPE_1=models.CharField(max_length=100, null=True)
+
+ def __str__(self):
+ return "Name: %s" % self.name
diff --git a/seshat/apps/core/signals.py b/seshat/apps/core/signals.py
index 01afa2746..96a217484 100644
--- a/seshat/apps/core/signals.py
+++ b/seshat/apps/core/signals.py
@@ -6,6 +6,18 @@
@receiver(post_save, sender=SeshatCommentPart)
def update_subcomment_ordering(sender, instance, **kwargs):
+ """
+ A signal to update the ordering of subcomments when a new subcomment is
+ created or an existing subcomment is updated.
+
+ Args:
+ sender (SeshatCommentPart): The sender of the signal.
+ instance (SeshatCommentPart): The instance of the subcomment.
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ None
+ """
if not instance.pk:
last_subcomment = instance.comment.inner_comments_related.last()
instance.comment_order = last_subcomment.comment_order + 1 if last_subcomment else 0
diff --git a/seshat/apps/core/static/core/js/map_functions.js b/seshat/apps/core/static/core/js/map_functions.js
new file mode 100644
index 000000000..f6a9b00b1
--- /dev/null
+++ b/seshat/apps/core/static/core/js/map_functions.js
@@ -0,0 +1,407 @@
+function updateSliderOutput() {
+ if (slider.value < 0) {
+ output.innerHTML = Math.abs(slider.value) + ' BCE';
+ } else {
+ output.innerHTML = slider.value + ' CE';
+ }
+}
+
+function adjustSliderUp() {
+ slider.value = Number(slider.value) + 1;
+ enterYearInput.value = slider.value; // Sync enterYear input with dateSlide value
+ updateSliderOutput(); // Update the displayed year
+ plotPolities(); // This function is defined differently in the world_map and polity_map templates
+}
+
+function adjustSliderDown() {
+ slider.value = Number(slider.value) - 1;
+ enterYearInput.value = slider.value; // Sync enterYear input with dateSlide value
+ updateSliderOutput(); // Update the displayed year
+ plotPolities(); // This function is defined differently in the world_map and polity_map templates
+}
+
+function updateSliderValue(value) {
+ var sliderValue = document.getElementById('sliderValue');
+ switch (value) {
+ case '1':
+ sliderValue.textContent = '1 y/s'; // See the values in the startPlay function below
+ break;
+ case '2':
+ sliderValue.textContent = '5 y/s';
+ break;
+ case '3':
+ sliderValue.textContent = '20 y/s';
+ break;
+ case '4':
+ sliderValue.textContent = '50 y/s';
+ break;
+ case '5':
+ sliderValue.textContent = '100 y/s';
+ break;
+ }
+ plotPolities();
+}
+
+function setSliderTicks (tickYears) {
+ var datalist = document.getElementById('yearTickmarks');
+ var tickmarkValuesDiv = document.getElementById('yearTickmarkValues');
+
+ // If the data list already has options, remove them
+ while (datalist.firstChild) {
+ datalist.removeChild(datalist.firstChild);
+ };
+ // If the tickmark values div already has spans, remove them
+ while (tickmarkValuesDiv.firstChild) {
+ tickmarkValuesDiv.removeChild(tickmarkValuesDiv.firstChild);
+ };
+
+ // Loop to add tickmarks
+ i = 0;
+ for (const tickValue of tickYears) {
+ var option = document.createElement('option');
+ option.value = tickValue;
+ datalist.appendChild(option);
+
+ // Create and add corresponding span for tickmark labels
+ var span = document.createElement('span');
+ span.textContent = tickValue;
+ span.style.position = 'absolute';
+ span.style.textAlign = 'center';
+
+ // Use transform to center the span over the tickmark, with special handling for the first and last span
+ var leftPercentage = (i / (tickYears.length - 1) * 100);
+ span.style.left = `${leftPercentage}%`;
+ if (i === 0) {
+ span.style.transform = 'translateX(0%)'; // No translation for the first span
+ span.style.textAlign = 'left'; // Align text to the left for the first span
+ } else if (i === (tickYears.length - 1)) {
+ span.style.transform = 'translateX(-100%)'; // Adjust the last span to prevent overflow
+ } else {
+ span.style.transform = 'translateX(-50%)'; // Center all other spans
+ }
+ tickmarkValuesDiv.appendChild(span);
+ i++;
+ }
+};
+
+function startPlay() {
+ stopPlay(); // Clear existing interval before starting a new one
+
+ var animationSpeed = parseFloat(playRateInput.value);
+ if (animationSpeed == 1) {
+ var yearsPerSecond = 1;
+ } else if (animationSpeed == 2) {
+ var yearsPerSecond = 5;
+ } else if (animationSpeed == 3) {
+ var yearsPerSecond = 20;
+ } else if (animationSpeed == 4) {
+ var yearsPerSecond = 50;
+ } else if (animationSpeed == 5) {
+ var yearsPerSecond = 100;
+ }
+
+ var milliseconds = 1 / (yearsPerSecond / 1000);
+
+ playInterval = setInterval(function () {
+ // Increment the slider value by 1
+ slider.value = Number(slider.value) + 1;
+ enterYearInput.value = slider.value; // Sync enterYear input with dateSlide value
+ updateSliderOutput(); // Update the displayed year
+ plotPolities(); // This function is defined differently in the world_map and polity_map templates
+
+ // Stop playing when the slider reaches its maximum value
+ if (slider.value >= parseInt(slider.max)) {
+ stopPlay();
+ }
+ }, milliseconds); // Interval based on user input
+}
+
+function stopPlay() {
+ clearInterval(playInterval);
+}
+
+function storeYear() {
+ var year = document.getElementById('enterYear').value;
+ history.pushState(null, '', '/core/world_map/?year=' + year);
+ if (!allPolitiesLoaded) {
+ document.getElementById('loadingIndicator').style.display = 'block';
+ }
+}
+
+function switchBaseMap() {
+ var selectedMap = document.querySelector('input[name="baseMap"]:checked').value;
+ var base = document.getElementById("baseMapGADM").value
+
+ if (base == 'province') {
+ var baseShapeData = provinceShapeData;
+ } else if (base == 'country') {
+ var baseShapeData = countryShapeData;
+ }
+
+ // Only show "Current borders" select for GADM
+ var baseMapGADMFieldset = document.getElementById("baseMapGADMFieldset");
+ if (selectedMap == 'gadm') {
+ baseMapGADMFieldset.style.display = "block"
+ } else {
+ baseMapGADMFieldset.style.display = "none"
+ }
+
+ // Remove all province layers
+ provinceLayers.forEach(function (layer) {
+ map.removeLayer(layer);
+ });
+
+ // Clear the provinceLayers array
+ provinceLayers = [];
+
+ map.removeLayer(currentLayer);
+
+ if (selectedMap === 'osm') {
+ currentLayer = baseLayers.osm.addTo(map);
+ } else {
+ currentLayer = baseLayers.carto.addTo(map);
+ }
+
+ if (selectedMap === 'gadm') {
+ // Add countries or provinces to the base map
+ baseShapeData.forEach(function (shape) {
+ // Ensure the geometry is not empty
+ if (shape.geometry && shape.geometry.type) {
+ gadmFillColour = 'white'; // Default fill colour
+ if (shape.country.toLowerCase().includes('sea')) {
+ gadmFillColour = 'lightblue';
+ }
+ // Loop through each polygon and add it to the map
+ for (var i = 0; i < shape.geometry.coordinates.length; i++) {
+ var coordinates = shape.geometry.coordinates[i][0];
+ // Swap latitude and longitude for each coordinate
+ coordinates = coordinates.map(function (coord) {
+ return [coord[1], coord[0]];
+ });
+ var polygon = L.polygon(coordinates).addTo(map);
+ if (!shape.country.toLowerCase().includes('sea')) {
+ if (base == 'province') {
+ var popupContent = `
+
+
+
${shape.province}
+
+
+
+
Type
+
${shape.provinceType}
+
+
+
Country
+
Modern ${shape.country}
+
+
+ `;
+ } else if (base == 'country') {
+ var popupContent = `
+
+
+
Modern ${shape.country}
+
+
+ `;
+ }
+ polygon.bindPopup(popupContent);
+ };
+ // Set the style using the style method
+ polygon.setStyle({
+ fillColor: gadmFillColour, // Set the fill color based on the "colour" field
+ color: 'black', // Set the border color
+ weight: 1, // Set the border weight
+ fillOpacity: 0.5 // Set the fill opacity
+ });
+ polygon.bringToBack(); // Move the province layers to back so they are always behind polity shapes
+ provinceLayers.push(polygon); // Add the layer to the array
+ }
+ }
+ });
+ }
+}
+
+function updateLegend() {
+ var variable = document.getElementById('chooseVariable').value;
+ var legendDiv = document.getElementById('variableLegend');
+ var selectedYear1 = document.getElementById('dateSlide').value; // Giving it the same name as a var used in the templated JS caused an error
+ var selectedYearInt1 = parseInt(selectedYear1);
+
+ // Clear the current legend
+ legendDiv.innerHTML = '';
+
+ if (variable == 'polity') {
+ var addedPolities = [];
+ var addedPolityNames = [];
+ shapesData.forEach(function (shape) {
+ // If the polity shape is part of a personal union or meta-polity active in the selected year, don't add it to the legend
+ var ignore = false;
+ if (shape.union_name) {
+ if ((parseInt(shape.union_start_year) <= selectedYearInt1 && parseInt(shape.union_end_year) >= selectedYearInt1)) {
+ ignore = true;
+ };
+ };
+ if (!ignore) {
+ shape_name_col_dict = {};
+ shape_name_col_dict['polity'] = shape.polity;
+ shape_name_col_dict['colour'] = shape.colour;
+ if (shape.weight > 0 && !addedPolityNames.includes(shape_name_col_dict['polity'])) {
+ // If the shape spans the selected year
+ if ((parseInt(shape.start_year) <= selectedYearInt1 && parseInt(shape.end_year) >= selectedYearInt1)) {
+ // Add the polity to the list of added polities
+ addedPolities.push(shape_name_col_dict);
+ addedPolityNames.push(shape_name_col_dict['polity']);
+ };
+ };
+ };
+ });
+
+ // Sort the polities by name
+ addedPolities.sort(function (a, b) {
+ return a.polity.localeCompare(b.polity);
+ });
+
+ // Add a legend for highlighted polities
+ if (addedPolities.length > 0) {
+ var legendTitle = document.createElement('h3');
+ legendTitle.textContent = 'Selected Polities';
+ legendDiv.appendChild(legendTitle);
+ for (var i = 0; i < addedPolities.length; i++) {
+ var legendItem = document.createElement('p');
+ var colorBox = document.createElement('span');
+ colorBox.style.display = 'inline-block';
+ colorBox.style.width = '20px';
+ colorBox.style.height = '20px';
+ colorBox.style.backgroundColor = addedPolities[i].colour;
+ colorBox.style.border = '1px solid black';
+ colorBox.style.marginRight = '10px';
+ legendItem.appendChild(colorBox);
+ legendItem.appendChild(document.createTextNode(addedPolities[i].polity));
+ legendDiv.appendChild(legendItem);
+ }
+ };
+
+ } else if (variable in categorical_variables) {
+
+ var legendTitle = document.createElement('h3');
+ legendTitle.textContent = document.getElementById('chooseCategoricalVariableSelection').value;
+ legendDiv.appendChild(legendTitle);
+
+ for (var key in oneLanguageColourMapping) {
+ if (key === 'No Seshat page') { // Skip the "No Seshat page" key as it's the same colour as "Uncoded" (see world_map.html)
+ continue;
+ }
+ var legendItem = document.createElement('p');
+
+ var colorBox = document.createElement('span');
+ colorBox.style.display = 'inline-block';
+ colorBox.style.width = '20px';
+ colorBox.style.height = '20px';
+ colorBox.style.backgroundColor = oneLanguageColourMapping[key];
+ colorBox.style.marginRight = '10px';
+ legendItem.appendChild(colorBox);
+
+ if (key === 'Unknown') {
+ colorBox.style.border = '1px solid black';
+ }
+ if (key === 'Unknown') {
+ legendItem.appendChild(document.createTextNode('Coded unknown'));
+ } else {
+ legendItem.appendChild(document.createTextNode(`${key}`));
+ }
+
+ legendDiv.appendChild(legendItem);
+ };
+
+ } else { // Absent-present variables
+ var legendTitle = document.createElement('h3');
+ legendTitle.textContent = variable;
+ legendDiv.appendChild(legendTitle);
+
+ for (var key in variableColourMapping) {
+ if (key === 'no seshat page') { // Skip the "No Seshat page" key as it's the same colour as "Uncoded" (see world_map.html)
+ continue;
+ }
+ var legendItem = document.createElement('p');
+
+ var colorBox = document.createElement('span');
+ colorBox.style.display = 'inline-block';
+ colorBox.style.width = '20px';
+ colorBox.style.height = '20px';
+ colorBox.style.backgroundColor = variableColourMapping[key];
+ colorBox.style.marginRight = '10px';
+ legendItem.appendChild(colorBox);
+
+ if (key === 'unknown') {
+ colorBox.style.border = '1px solid black';
+ }
+
+ legendItem.appendChild(document.createTextNode(longAbsentPresentVarName(key)));
+
+ legendDiv.appendChild(legendItem);
+ }
+ }
+
+ if (document.querySelector('input[name="baseMap"]:checked').value == 'gadm') {
+ var legendItem = document.createElement('p');
+
+ var colorBox = document.createElement('span');
+ colorBox.style.display = 'inline-block';
+ colorBox.style.width = '20px';
+ colorBox.style.height = '20px';
+ colorBox.style.backgroundColor = 'white';
+ colorBox.style.border = '1px solid black';
+ colorBox.style.marginRight = '10px';
+
+ legendItem.appendChild(colorBox);
+ legendItem.appendChild(document.createTextNode('Base map'));
+
+ legendDiv.appendChild(legendItem);
+ }
+}
+
+function updateCategoricalVariableSelection(variable){
+ var dropdown = document.getElementById('chooseCategoricalVariableSelection');
+ dropdown.innerHTML = '';
+ if (localStorage.getItem(variable)) {
+ document.getElementById('chooseCategoricalVariableSelection').value = localStorage.getItem(variable);
+ }
+ categorical_variables[variable].forEach(function (choice) {
+ var option = document.createElement('option');
+ option.value = choice;
+ option.text = choice;
+
+ // Set some default selections if no selection has been made
+ if (localStorage.getItem(variable)) {
+ if (localStorage.getItem(variable) === choice) {
+ option.selected = true;
+ }
+ } else {
+ if (choice === 'Greek' || choice === 'Indo-European') {
+ option.selected = true;
+ }
+ }
+
+ dropdown.appendChild(option);
+ });
+ var varSelectElement = document.getElementById('chooseVariable');
+ var varText = varSelectElement.options[varSelectElement.selectedIndex].text;
+ document.querySelector('label[for="chooseCategoricalVariableSelection"]').textContent = varText + ': ';
+}
+
+function longAbsentPresentVarName(var_name){
+ if (var_name === 'A~P') {
+ var_name = 'Absent then Present';
+ } else if (var_name === 'P~A') {
+ var_name = 'Present then Absent';
+ } else if (var_name === 'unknown') {
+ var_name = 'Coded Unknown';
+ } else if (var_name === 'no seshat page') {
+ var_name = 'No Seshat Page';
+ } else {
+ var_name = `${var_name[0].toUpperCase()}${var_name.slice(1)}`;
+ }
+ return var_name;
+}
\ No newline at end of file
diff --git a/seshat/apps/core/static/core/styles.css b/seshat/apps/core/static/core/styles.css
index 89ad74c10..cf6966124 100644
--- a/seshat/apps/core/static/core/styles.css
+++ b/seshat/apps/core/static/core/styles.css
@@ -198,4 +198,23 @@ hr.bg-fading {
.text-darkorange {
color: #FF8C00;
+}
+
+.spinner {
+ border: 16px solid #f3f3f3;
+ border-radius: 50%;
+ border-top: 16px solid #782823;
+ width: 15px;
+ height: 15px;
+ animation: spin 1s linear infinite;
+}
+
+@keyframes spin {
+ 0% {
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ transform: rotate(360deg);
+ }
}
\ No newline at end of file
diff --git a/seshat/apps/core/templates/core/nlp_datapoints.html b/seshat/apps/core/templates/core/nlp_datapoints.html
index 048b5086a..ae8c56f24 100644
--- a/seshat/apps/core/templates/core/nlp_datapoints.html
+++ b/seshat/apps/core/templates/core/nlp_datapoints.html
@@ -2595,7 +2595,9 @@
* What you see below is the first draft of my analysis of all S
+ {% include "core/partials/_footer_bar.html" %}
+
+
\ No newline at end of file
diff --git a/seshat/apps/core/templatetags/__init__.py b/seshat/apps/core/templatetags/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/seshat/apps/core/templatetags/core_tags.py b/seshat/apps/core/templatetags/core_tags.py
new file mode 100644
index 000000000..027060b74
--- /dev/null
+++ b/seshat/apps/core/templatetags/core_tags.py
@@ -0,0 +1,99 @@
+from django import template
+from django.db import connection
+from django.db.models import F
+from ..models import Polity, Capital
+from ...general.models import Polity_capital, Polity_peak_years
+from ..views import get_polity_shape_content
+
+register = template.Library()
+
+@register.inclusion_tag('core/polity_map.html')
+def polity_map(pk, test=False):
+ """
+ This function is used by the polity_map template and gets the specific
+ polity shape data and capital information. Sets include_polity_map to False
+ if there is no shape data. include_polity_map is used to determine whether
+ to display the map on polity_detail.html.
+
+ Args:
+ pk (int): The primary key of the polity.
+
+ Returns:
+ dict: The content dictionary containing the polity shape data and
+ capital information.
+ """
+ page_id = str(pk)
+ polity = Polity.objects.get(id=page_id)
+ try:
+ if test:
+ content = get_polity_shape_content(seshat_id=polity.new_name, tick_number=3)
+ else:
+ content = get_polity_shape_content(seshat_id=polity.new_name, tick_number=10)
+ capitals_info = get_polity_capitals(pk)
+ # Set the start and end years to be the same as the polity where missing
+ modified_caps = capitals_info
+ i = 0
+ for capital_info in capitals_info:
+ if capital_info['year_from'] == None:
+ modified_caps[i]['year_from'] = polity.start_year
+ if capital_info['year_to'] == None:
+ modified_caps[i]['year_to'] = polity.end_year
+ i+=1
+ content['capitals_info'] = modified_caps
+ content['include_polity_map'] = True
+ except:
+ content = {}
+ content['include_polity_map'] = False
+
+ if content['include_polity_map']:
+ # Update the default display year to be the peak year (if it exists)
+ try:
+ peak_years = Polity_peak_years.objects.get(polity_id=page_id)
+ content['display_year'] = peak_years.peak_year_from
+ except:
+ pass
+
+ return {'content': content}
+
+def get_polity_capitals(pk):
+ """
+ Get all the capitals for a polity and coordinates.
+
+ Args:
+ pk (int): The primary key of the polity.
+
+ Returns:
+ list: A list of dictionaries containing the capital name, latitude,
+ longitude, start year (or 0 or None if they aren't present in the
+ database), and end year (or 0 or None if they aren't present in
+ the database).
+ """
+ capitals_info = []
+ polity_capitals = Polity_capital.objects.filter(polity_id=pk)
+
+ for polity_capital in polity_capitals:
+ capitals = Capital.objects.filter(name=polity_capital.capital)
+ for capital in capitals:
+ capital_info = {}
+ if capital.name and capital.latitude and capital.longitude:
+ capital_info['capital'] = capital.name
+ capital_info['latitude'] = float(capital.latitude)
+ capital_info['longitude'] = float(capital.longitude)
+
+ if polity_capital.year_from == 0:
+ capital_info['year_from'] = 0
+ elif polity_capital.year_from is not None:
+ capital_info['year_from'] = polity_capital.year_from
+ else:
+ capital_info['year_from'] = None
+
+ if polity_capital.year_to == 0:
+ capital_info['year_to'] = 0
+ elif polity_capital.year_to is not None:
+ capital_info['year_to'] = polity_capital.year_to
+ else:
+ capital_info['year_to'] = None
+
+ capitals_info.append(capital_info)
+
+ return capitals_info
diff --git a/seshat/apps/core/tests.py b/seshat/apps/core/tests.py
deleted file mode 100644
index 7ce503c2d..000000000
--- a/seshat/apps/core/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/core/tests/tests.py b/seshat/apps/core/tests/tests.py
new file mode 100644
index 000000000..c8ffc415b
--- /dev/null
+++ b/seshat/apps/core/tests/tests.py
@@ -0,0 +1,496 @@
+import json
+from django.contrib.gis.geos import MultiPolygon, Polygon, GEOSGeometry
+from django.test import TestCase, Client
+from django.urls import reverse
+from ..models import VideoShapefile, GADMShapefile, GADMCountries, GADMProvinces, Polity, Capital
+from ...general.models import Polity_capital, Polity_peak_years, Polity_language
+from ...sc.models import Judge
+from ...rt.models import Gov_res_pub_pros
+from ..views import get_provinces, get_polity_shape_content, get_all_polity_capitals, assign_variables_to_shapes, assign_categorical_variables_to_shapes
+from ..templatetags.core_tags import get_polity_capitals, polity_map
+
+
+class ShapesTest(TestCase):
+ """Test case for the shape models and views."""
+
+ def setUp(self):
+ """Set up the test client and Polity entry for the view functions."""
+ self.maxDiff = None
+ self.client = Client()
+ self.pk = 1
+ # Simple square polygon to use in geospatial data table tests
+ self.square = MultiPolygon(Polygon(((0, 0), (0, 1), (1, 1), (0, 0))))
+ self.geo_square = '{"type":"MultiPolygon","coordinates":[[[[0,0],[0,1],[1,1],[0,0]]]]}'
+ self.geo_square_for_gadm = GEOSGeometry(self.square).geojson
+ self.polity = Polity.objects.create(
+ name='TestPolity',
+ id=self.pk,
+ long_name='TestPolity',
+ new_name='Test seshat_id'
+ )
+ Polity.objects.create(
+ name='TestPolity2',
+ id=2,
+ long_name='TestPolity2',
+ new_name='Test seshat_id 2',
+ start_year=-100,
+ end_year=1100
+ )
+ Polity.objects.create(
+ name='TestPolity3',
+ id=3,
+ long_name='TestPolity3',
+ new_name='Test seshat_id 3',
+ start_year=-100,
+ end_year=1100
+ )
+ self.video_shapefile = VideoShapefile.objects.create(
+ id=1,
+ geom=self.square,
+ simplified_geom=self.square,
+ name="Test shape",
+ polity="Testpolityname",
+ seshat_id="Test seshat_id",
+ area=100.0,
+ start_year=2000,
+ end_year=2020,
+ polity_start_year=2000,
+ polity_end_year=2020,
+ colour="#FFFFFF"
+ )
+ VideoShapefile.objects.create(
+ id=2,
+ geom=self.square,
+ simplified_geom=self.square,
+ name="Test shape 2",
+ polity="Testpolityname2",
+ seshat_id="Test seshat_id 2",
+ area=100.0,
+ start_year=0,
+ end_year=1000,
+ polity_start_year=0,
+ polity_end_year=1000,
+ colour="#FFFFFF"
+ )
+ self.gadm_shapefile = GADMShapefile.objects.create(
+ geom=self.square,
+ UID=123456789,
+ NAME_0="Test shape"
+ )
+ self.province = GADMProvinces.objects.create(
+ geom=self.square,
+ COUNTRY="Test Country",
+ NAME_1="Test Province",
+ ENGTYPE_1="Test Type"
+ )
+ self.country = GADMCountries.objects.create(
+ geom=self.square,
+ COUNTRY="Test Country"
+ )
+ self.capital = Capital.objects.create(
+ name="Test Capital",
+ latitude=51.567522,
+ longitude=-0.1294531
+ )
+ Capital.objects.create(
+ name="Test Capital 2",
+ latitude=51.567523,
+ longitude=-0.1294532
+ )
+ Capital.objects.create(
+ name="Test Capital 2A",
+ latitude=51.567523,
+ longitude=-0.1294532
+ )
+ self.polity_capital = Polity_capital.objects.create(
+ name="TestPolity",
+ capital="Test Capital",
+ year_from=2000,
+ year_to=2020,
+ polity_id = self.pk
+ )
+ Polity_capital.objects.create(
+ name="TestPolity2",
+ capital="Test Capital 2",
+ polity_id=2
+ )
+ Polity_capital.objects.create(
+ name="TestPolity2",
+ capital="Test Capital 2A",
+ year_from=0,
+ year_to=100,
+ polity_id=2
+ )
+ Polity_peak_years.objects.create(
+ polity_id=self.pk,
+ peak_year_from=2001,
+ peak_year_to=2002
+ )
+ Judge.objects.create(
+ name='judge',
+ judge='present',
+ year_from=2003,
+ year_to=2004,
+ polity_id=2
+ )
+ Gov_res_pub_pros.objects.create(
+ name='gov_res_pub_pros',
+ coded_value='absent',
+ year_from=2002,
+ year_to=2003,
+ polity_id=2
+ )
+ Polity_language.objects.create(
+ name='language',
+ language='English',
+ polity_id=2,
+ year_from=1998,
+ year_to=2000
+ )
+ Polity_language.objects.create(
+ name='language',
+ language='French',
+ year_from=1999,
+ year_to=2007,
+ polity_id=2
+ )
+
+ # Model tests
+
+ def test_video_shapefile_creation(self):
+ """Test the creation of a VideoShapefile instance."""
+ self.assertIsInstance(self.video_shapefile, VideoShapefile)
+ self.assertEqual(self.video_shapefile.name, "Test shape")
+
+ def test_gadm_shapefile_creation(self):
+ """Test the creation of a GADMShapefile instance."""
+ self.assertIsInstance(self.gadm_shapefile, GADMShapefile)
+ self.assertEqual(self.gadm_shapefile.NAME_0, "Test shape")
+
+ def test_gadm_countries_creation(self):
+ """Test the creation of a GADMCountries instance."""
+ self.assertIsInstance(self.country, GADMCountries)
+ self.assertEqual(self.country.COUNTRY, "Test Country")
+
+ def test_gadm_provinces_creation(self):
+ """Test the creation of a GADMProvinces instance."""
+ self.assertIsInstance(self.province, GADMProvinces)
+ self.assertEqual(self.province.NAME_1, "Test Province")
+
+ # View function tests
+
+ def test_get_provinces(self):
+ """Test the get_provinces function."""
+ province_result = get_provinces(selected_base_map_gadm='province')
+ country_result = get_provinces(selected_base_map_gadm='country')
+
+ province_expected_result = [{'aggregated_geometry': self.geo_square_for_gadm,
+ 'country': 'Test Country',
+ 'province': 'Test Province',
+ 'province_type': 'Test Type'}]
+ country_expected_result = [{'aggregated_geometry': self.geo_square_for_gadm,
+ 'country': 'Test Country'}]
+
+ self.assertEqual(province_result, province_expected_result)
+ self.assertEqual(country_result, country_expected_result)
+
+ def test_get_polity_shape_content(self):
+ """Test the get_polity_shape_content function."""
+ expected_result = {
+ 'shapes': [
+ {
+ 'seshat_id': 'Test seshat_id',
+ 'name': 'Test shape',
+ 'polity': 'Testpolityname',
+ 'start_year': 2000,
+ 'end_year': 2020,
+ 'polity_start_year': 2000,
+ 'polity_end_year': 2020,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 1
+ },
+ {
+ 'seshat_id': 'Test seshat_id 2',
+ 'name': 'Test shape 2',
+ 'polity': 'Testpolityname2',
+ 'start_year': 0,
+ 'end_year': 1000,
+ 'polity_start_year': 0,
+ 'polity_end_year': 1000,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 2
+ }
+ ],
+ 'earliest_year': 0,
+ 'display_year': 0,
+ 'tick_years': json.dumps([0, 1010, 2020]),
+ 'latest_year': 2020,
+ 'seshat_id_page_id': {
+ 'Test seshat_id': {'id': 1, 'long_name': 'TestPolity'},
+ 'Test seshat_id 2': {'id': 2, 'long_name': 'TestPolity2'}
+ }
+ }
+ result = get_polity_shape_content(tick_number=3)
+
+ self.assertEqual(result, expected_result)
+
+ def test_get_polity_shape_content_single_year(self):
+ """
+ Test the get_polity_shape_content function for a single year.
+ This gets run when loading one year of the world map whilst waiting for the rest of the data to load.
+ """
+ expected_result = {
+ 'shapes': [
+ {
+ 'seshat_id': 'Test seshat_id',
+ 'name': 'Test shape',
+ 'polity': 'Testpolityname',
+ 'start_year': 2000,
+ 'end_year': 2020,
+ 'polity_start_year': 2000,
+ 'polity_end_year': 2020,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 1
+ }
+ ],
+ 'earliest_year': 0, # This is the earliest year in the database, not the earliest year of the polity
+ 'display_year': 2000,
+ 'tick_years': json.dumps([0, 1010, 2020]),
+ 'latest_year': 2020,
+ 'seshat_id_page_id': {
+ 'Test seshat_id': {'id': 1, 'long_name': 'TestPolity'}
+ }
+ }
+ result = get_polity_shape_content(displayed_year=2000, tick_number=3)
+
+ self.assertEqual(result, expected_result)
+
+ def test_get_polity_shape_content_single_seshat_id(self):
+ """
+ Test the get_polity_shape_content function for a single polity.
+ This gets run for the polity_map view.
+ """
+ expected_result = {
+ 'shapes': [
+ {
+ 'seshat_id': 'Test seshat_id',
+ 'name': 'Test shape',
+ 'polity': 'Testpolityname',
+ 'start_year': 2000,
+ 'end_year': 2020,
+ 'polity_start_year': 2000,
+ 'polity_end_year': 2020,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 1
+ }
+ ],
+ 'earliest_year': 2000, # This is the earliest year of the polity
+ 'display_year': 2000,
+ 'tick_years': json.dumps([2000, 2010, 2020]),
+ 'latest_year': 2020,
+ 'seshat_id_page_id': {
+ 'Test seshat_id': {'id': 1, 'long_name': 'TestPolity'}
+ }
+ }
+ result = get_polity_shape_content(seshat_id='Test seshat_id', tick_number=3)
+
+ self.assertEqual(result, expected_result)
+
+ def test_get_polity_shape_content_displayed_year_and_seshat_id_both_set(self):
+ """Test that a ValueError is raised if both displayed_year and seshat_id are set."""
+ self.assertRaises(ValueError, get_polity_shape_content, displayed_year=2000, seshat_id='Test seshat_id', tick_number=3)
+
+ def test_get_polity_capitals(self):
+ """Test the get_polity_capitals function."""
+ result = get_polity_capitals(self.pk)
+ self.assertEqual(result,
+ [{'capital': 'Test Capital', 'latitude': 51.567522, 'longitude': -0.1294531, 'year_from': 2000, 'year_to': 2020}]
+ )
+
+ def test_get_all_polity_capitals(self):
+ """Test the get_all_polity_capitals function."""
+ result = get_all_polity_capitals()
+ self.assertEqual(result,
+ {'Test seshat_id': [
+ {'capital': 'Test Capital', 'latitude': 51.567522, 'longitude': -0.1294531, 'year_from': 2000, 'year_to': 2020}
+ ],
+ 'Test seshat_id 2': [
+ {'capital': 'Test Capital 2A', 'latitude': 51.567523, 'longitude': -0.1294532, 'year_from': 0, 'year_to': 100},
+ {'capital': 'Test Capital 2', 'latitude': 51.567523, 'longitude': -0.1294532, 'year_from': -100, 'year_to': 1100}
+ ]
+ }
+ )
+
+ def test_polity_map(self):
+ """Test the polity_map template tag."""
+ expected_result = {
+ 'content': {
+ 'shapes': [
+ {
+ 'seshat_id': 'Test seshat_id',
+ 'name': 'Test shape',
+ 'polity': 'Testpolityname',
+ 'start_year': 2000,
+ 'end_year': 2020,
+ 'polity_start_year': 2000,
+ 'polity_end_year': 2020,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 1
+ }
+ ],
+ 'earliest_year': 2000,
+ 'display_year': 2001, # This is the peak year of the polity
+ 'latest_year': 2020,
+ 'tick_years': json.dumps([2000, 2010, 2020]),
+ 'seshat_id_page_id': {
+ 'Test seshat_id': {'id': 1, 'long_name': 'TestPolity'}
+ },
+ 'include_polity_map': True,
+ 'capitals_info': [
+ {'capital': 'Test Capital', 'latitude': 51.567522, 'longitude': -0.1294531, 'year_from': 2000, 'year_to': 2020}
+ ]
+ }
+ }
+ result = polity_map(self.pk, test=True)
+
+ self.assertEqual(result, expected_result)
+
+ def test_polity_map_no_peak_year_set(self):
+ """Test the polity_map template tag for a polity that has no peak year set."""
+ expected_result = {
+ 'content': {
+ 'shapes': [
+ {
+ 'seshat_id': 'Test seshat_id 2',
+ 'name': 'Test shape 2',
+ 'polity': 'Testpolityname2',
+ 'start_year': 0,
+ 'end_year': 1000,
+ 'polity_start_year': 0, # Note: this is taken from the shape objectm, not the polity object (they don't match in this test case)
+ 'polity_end_year': 1000,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 2
+ }
+ ],
+ 'earliest_year': 0,
+ 'display_year': 0,
+ 'latest_year': 1000,
+ 'tick_years': json.dumps([0, 500, 1000]),
+ 'seshat_id_page_id': {
+ 'Test seshat_id 2': {'id': 2, 'long_name': 'TestPolity2'}
+ },
+ 'include_polity_map': True,
+ 'capitals_info': [
+ {'capital': 'Test Capital 2A', 'latitude': 51.567523, 'longitude': -0.1294532, 'year_from': 0, 'year_to': 100},
+ {'capital': 'Test Capital 2', 'latitude': 51.567523, 'longitude': -0.1294532, 'year_from': -100, 'year_to': 1100}
+ ]
+ }
+ }
+ result = polity_map(2, test=True)
+
+ self.assertEqual(result, expected_result)
+
+ def test_polity_map_no_content(self):
+ """Test the polity_map func when polity has no shapes associated."""
+ expected_result = {
+ 'content': {
+ 'include_polity_map': False
+ }
+ }
+ result = polity_map(3, test=True)
+ self.assertEqual(result, expected_result)
+
+ def test_map_view_initial(self):
+ """Test the initial map view which whould redirect to a specific year."""
+ response = self.client.get(reverse('world_map'))
+ self.assertEqual(response.status_code, 302)
+ self.assertTrue(response.url.startswith('/core/world_map/?year='))
+
+ def test_map_view_all(self):
+ """Test the map view with all data."""
+ response = self.client.get(reverse('world_map_all'))
+ self.assertEqual(response.status_code, 200)
+
+ def test_provinces_and_countries_view(self):
+ """Test the provinces and countries view."""
+ response = self.client.get(reverse('provinces_and_countries'))
+ self.assertEqual(response.status_code, 200)
+
+ def test_assign_variables_to_shapes(self):
+ """Test the assign_variables_to_shapes function."""
+ shapes = [
+ {
+ 'seshat_id': 'Test seshat_id 2',
+ 'name': 'Test shape 2',
+ 'polity': 'Testpolityname2',
+ 'start_year': 0,
+ 'end_year': 1000,
+ 'polity_start_year': 0,
+ 'polity_end_year': 1000,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 2
+ }
+ ]
+ app_map = {
+ 'sc': 'Social Complexity Variables',
+ 'wf': 'Warfare Variables (Military Technologies)',
+ 'rt': 'Religion Tolerance'
+ }
+ result_shapes, result_variables = assign_variables_to_shapes(shapes, app_map)
+ # Choose some example variables to test
+ expected_result_variables_judge = {
+ 'formatted': 'Judge',
+ 'full_name': 'Law: Judge'
+ }
+ expected_result_variables_gov_res_pub_pros = {
+ 'formatted': 'Government Restrictions on Public Proselytizings',
+ 'full_name': 'Government Restrictions: Government Restrictions on Public Proselytizings'
+ }
+ self.assertEqual(result_variables['Social Complexity Variables']['judge'], expected_result_variables_judge)
+ self.assertEqual(result_variables['Religion Tolerance']['gov_res_pub_pros'], expected_result_variables_gov_res_pub_pros)
+ # Test that the shapes have been updated with the variables
+ self.assertEqual(result_shapes[0]['Judge'], 'present')
+ self.assertEqual(result_shapes[0]['Judge_dict'], {'present': [2003, 2004]})
+ self.assertEqual(result_shapes[0]['Government Restrictions on Public Proselytizings'], 'absent')
+ self.assertEqual(result_shapes[0]['Government Restrictions on Public Proselytizings_dict'], {'absent': [2002, 2003]})
+
+ def test_assign_categorical_variables_to_shapes(self):
+ """Test the assign_categorical_variables_to_shapes function."""
+ shapes = [
+ {
+ 'seshat_id': 'Test seshat_id 2',
+ 'name': 'Test shape 2',
+ 'polity': 'Testpolityname2',
+ 'start_year': 0,
+ 'end_year': 1000,
+ 'polity_start_year': 0,
+ 'polity_end_year': 1000,
+ 'colour': "#FFFFFF",
+ 'area': 100.0,
+ 'geom_json': self.geo_square,
+ 'id': 2
+ }
+ ]
+ result_shapes, result_variables = assign_categorical_variables_to_shapes(shapes, {})
+ expected_result_variables_language = {
+ 'formatted': 'language',
+ 'full_name': 'Language'
+ }
+ self.assertEqual(result_variables['General Variables']['polity_language'], expected_result_variables_language)
+ self.assertEqual(result_shapes[0]['language'], ['English', 'French'])
+ self.assertEqual(result_shapes[0]['language_dict']['English'], [1998, 2000])
+ self.assertEqual(result_shapes[0]['language_dict']['French'], [1999, 2007])
\ No newline at end of file
diff --git a/seshat/apps/core/tokens.py b/seshat/apps/core/tokens.py
index 123ff0587..f2fd44bb3 100644
--- a/seshat/apps/core/tokens.py
+++ b/seshat/apps/core/tokens.py
@@ -3,7 +3,23 @@
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
+ """
+ A class to generate a token for account activation.
+ """
+
def _make_hash_value(self, user, timestamp):
+ """
+ A method to make a hash value for the token. The hash value is based
+ on the user's primary key, the timestamp, and the email confirmation
+ status.
+
+ Args:
+ user (User): The user object.
+ timestamp (int): The timestamp.
+
+ Returns:
+ str: The hash value.
+ """
return (six.text_type(user.pk) + six.text_type(timestamp) + six.text_type(user.profile.email_confirmed))
diff --git a/seshat/apps/core/urls.py b/seshat/apps/core/urls.py
index 095635dcb..cacdb70eb 100644
--- a/seshat/apps/core/urls.py
+++ b/seshat/apps/core/urls.py
@@ -168,3 +168,9 @@
name="four-o-four"),
]
+
+# Map urls
+urlpatterns += [path('core/world_map/', views.map_view_initial, name='world_map'),]
+urlpatterns += [path('core/world_map_one_year/', views.map_view_one_year, name='world_map_one_year'),]
+urlpatterns += [path('core/world_map_all/', views.map_view_all, name='world_map_all'),]
+urlpatterns += [path('core/provinces_and_countries', views.provinces_and_countries_view, name='provinces_and_countries'),]
\ No newline at end of file
diff --git a/seshat/apps/core/views.py b/seshat/apps/core/views.py
index 628cdea8b..b811f7ec9 100644
--- a/seshat/apps/core/views.py
+++ b/seshat/apps/core/views.py
@@ -1,3 +1,9 @@
+import sys
+import importlib
+import random
+import numpy as np
+
+from collections import defaultdict
from seshat.utils.utils import adder, dic_of_all_vars, list_of_all_Polities, dic_of_all_vars_in_sections
from django.contrib.sites.shortcuts import get_current_site
@@ -12,14 +18,16 @@
from .tokens import account_activation_token
from django.contrib.auth.models import User
from django.views.decorators.cache import cache_page
+from django.core.cache import cache
+from django.utils.text import slugify
from django.views.decorators.csrf import csrf_protect
from django.contrib import messages
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.views.generic.edit import CreateView, UpdateView, DeleteView, FormMixin
-from django.db import IntegrityError
-from django.db.models import Prefetch, F, Value, Q, Count
+from django.db import IntegrityError, connection
+from django.db.models import Prefetch, F, Value, Q, Min, Max, Count
from django.db.models.functions import Replace
from django.views.decorators.http import require_GET
@@ -53,12 +61,11 @@
from django.contrib.messages.views import SuccessMessageMixin
-from ..general.models import Polity_research_assistant, Polity_duration
+from ..general.models import Polity_research_assistant, Polity_duration, Polity_linguistic_family, Polity_language_genus, Polity_language, POLITY_LINGUISTIC_FAMILY_CHOICES, POLITY_LANGUAGE_GENUS_CHOICES, POLITY_LANGUAGE_CHOICES
from ..crisisdb.models import Power_transition
-
-from .models import Citation, Polity, Section, Subsection, Variablehierarchy, Reference, SeshatComment, SeshatCommentPart, Nga, Ngapolityrel, Capital, Seshat_region, Macro_region, SeshatCommon, ScpThroughCtn, SeshatPrivateComment, SeshatPrivateCommentPart, Religion
+from .models import Citation, Polity, Section, Subsection, Variablehierarchy, Reference, SeshatComment, SeshatCommentPart, Nga, Ngapolityrel, Capital, Seshat_region, Macro_region, VideoShapefile, GADMCountries, GADMProvinces, SeshatCommon, ScpThroughCtn, SeshatPrivateComment, SeshatPrivateCommentPart, Religion
import pprint
import requests
from requests.structures import CaseInsensitiveDict
@@ -67,11 +74,26 @@
from django.shortcuts import HttpResponse
+from math import floor, ceil
+from django.contrib.gis.geos import GEOSGeometry
+from django.contrib.gis.db.models.functions import AsGeoJSON
from django.views.generic import ListView
@login_required
@permission_required('core.add_seshatprivatecommentpart')
def religion_create(request):
+ """
+ Create a new religion.
+
+ Note:
+ This view is only accessible to users with the 'add_seshatprivatecommentpart' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if request.method == 'POST':
form = ReligionForm(request.POST)
if form.is_valid():
@@ -84,6 +106,19 @@ def religion_create(request):
@login_required
@permission_required('core.add_seshatprivatecommentpart')
def religion_update(request, pk):
+ """
+ Update an existing religion.
+
+ Note:
+ This view is only accessible to users with the 'add_seshatprivatecommentpart' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+ pk (int): The primary key of the religion.
+
+ Returns:
+ HttpResponse: The response object.
+ """
religion = get_object_or_404(Religion, pk=pk)
if request.method == 'POST':
form = ReligionForm(request.POST, instance=religion)
@@ -95,6 +130,9 @@ def religion_update(request, pk):
return render(request, 'core/religion_update.html', {'form': form})
class ReligionListView(ListView):
+ """
+ List all religions.
+ """
model = Religion
template_name = 'core/religion_list.html'
context_object_name = 'religions'
@@ -105,10 +143,27 @@ class ReligionListView(ListView):
######
def is_ajax(request):
- return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
+ """
+ Return True if the request is an AJAX request, False otherwise.
+
+ Args:
+ request (HttpRequest): The request object.
+ Returns:
+ bool: True if the request is an AJAX request, False otherwise.
+ """
+ return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest'
def ajax_test(request):
+ """
+ Test if the request is an AJAX request.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if is_ajax(request=request):
message = "This is ajax"
else:
@@ -120,12 +175,43 @@ def ajax_test(request):
def 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.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponse('
Hello World.
')
def four_o_four(request):
+ """
+ Return a 404 error page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return render(request, 'core/not_found_404.html')
def seshatindex2(request):
+ """
+ Return the Seshat landing page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = {
'insta': "Instabilities All Over the Place..",
'trans': "Transitions All Over the Place",
@@ -135,6 +221,15 @@ def seshatindex2(request):
return render(request, 'core/seshat-index.html', context=context)
def seshatmethods(request):
+ """
+ Return the Seshat "Methods" page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = {
'insta': "Instabilities All Over the Place..",
'trans': "Transitions All Over the Place",
@@ -144,6 +239,15 @@ def seshatmethods(request):
return render(request, 'core/seshat-methods.html', context=context)
def seshatwhoweare(request):
+ """
+ Return the Seshat "Who We are" page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
#json_url_inners = "https://eric.clst.org/assets/wiki/uploads/Stuff/gz_2010_us_040_00_500k.json"
#json_url_outline = "https://eric.clst.org/assets/wiki/uploads/Stuff/gz_2010_us_outline_500k.json"
json_file_path = "/home/majid/dev/seshat/seshat/seshat/apps/core/static/geojson/us_states_geojson.json"
@@ -183,12 +287,30 @@ def seshatwhoweare(request):
return render(request, 'core/seshat-whoweare.html', context=context)
def seshatolddownloads(request):
+ """
+ Return the Seshat "Downloads" page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = {
'insta': "Instabilities All Over the Place..",
}
return render(request, 'core/old_downloads.html', context=context)
def seshatcodebookold(request):
+ """
+ Return the Seshat "Codebook" page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = {
'insta': "Instabilities All Over the Place..",
}
@@ -207,20 +329,44 @@ def seshatcodebooknew1(request):
# return render(request, 'core/new_codebook_2.html', context=context)
def seshatacknowledgements(request):
+ """
+ Return the Seshat "Acknowledgements" page.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = {
'insta': "Instabilities All Over the Place..",
}
return render(request, 'core/seshat-acknowledgements.html', context=context)
class ReferenceListView(generic.ListView):
+ """
+ List all references.
+ """
model = Reference
template_name = "core/references/reference_list.html"
paginate_by = 20
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('references')
def get_queryset(self):
+ """
+ Get the queryset of references.
+
+ Returns:
+ QuerySet: The queryset of references.
+ """
queryset = Reference.objects.exclude(creator='MAJIDBENAM').all()
return queryset
@@ -233,14 +379,29 @@ def get_queryset(self):
class NlpReferenceListView(generic.ListView):
+ """
+ List all NLP references.
+ """
model = Reference
template_name = "core/references/nlp_reference_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Return the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('nlp-references')
def get_queryset(self):
+ """
+ Return the queryset of NLP references.
+
+ Returns:
+ QuerySet: The queryset of NLP references.
+ """
# Import the list of Zotero links inside the method
from .nlp_zotero_links import NLP_ZOTERO_LINKS_TO_FILTER
@@ -273,6 +434,15 @@ def get_queryset(self):
# references without a Zotero link:
def no_zotero_refs_list(request):
+ """
+ List all references without a Zotero link.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
selected_no_zotero_refs = Reference.objects.filter(zotero_link__startswith='NOZOTERO_')
#all_refs = Reference.objects.all()
#selected_no_zotero_refs = []
@@ -295,6 +465,17 @@ def no_zotero_refs_list(request):
return render (request, 'core/references/reference_list_nozotero.html', context)
def reference_update_modal(request, pk):
+ """
+ Update a reference using a modal or a standalone page depending on the
+ request.
+
+ Args:
+ request (HttpRequest): The request object.
+ pk (int): The primary key of the reference.
+
+ Returns:
+ HttpResponse: The response object.
+ """
# Either render only the modal content, or a full standalone page
if is_ajax(request=request):
template_name = 'core/references/reference_update_modal.html'
@@ -323,15 +504,35 @@ def reference_update_modal(request, pk):
class ReferenceCreate(PermissionRequiredMixin, CreateView):
+ """
+ Create a new reference.
+ """
model = Reference
form_class = ReferenceForm
template_name = "core/references/reference_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('reference-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "xyz"
context["mysubsection"] = "abc"
@@ -342,19 +543,51 @@ def get_context_data(self, **kwargs):
return context
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
-
+
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
class ReferenceUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ Update a reference.
+ """
model = Reference
form_class = ReferenceForm
template_name = "core/references/reference_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Heeeelath"
context["mysubsection"] = "No Subsection Proeeeevided"
@@ -363,6 +596,9 @@ def get_context_data(self, **kwargs):
return context
class ReferenceDelete(PermissionRequiredMixin, DeleteView):
+ """
+ Delete a reference.
+ """
model = Reference
success_url = reverse_lazy('references')
template_name = "core/delete_general.html"
@@ -370,6 +606,9 @@ class ReferenceDelete(PermissionRequiredMixin, DeleteView):
class ReferenceDetailView(generic.DetailView):
+ """
+ Display the details of a reference.
+ """
model = Reference
template_name = "core/references/reference_detail.html"
@@ -377,6 +616,18 @@ class ReferenceDetailView(generic.DetailView):
@permission_required('core.view_capital')
def references_download(request):
+ """
+ Download all references as a CSV file.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Reference.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -393,14 +644,26 @@ def references_download(request):
# Citations
class CitationListView(generic.ListView):
+ """
+ List all citations.
+ """
model = Citation
template_name = "core/references/citation_list.html"
paginate_by = 20
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('citations')
class CitationCreate(PermissionRequiredMixin, SuccessMessageMixin, CreateView):
+ """
+ Create a new citation.
+ """
model = Citation
form_class = CitationForm
template_name = "core/references/citation_form.html"
@@ -408,14 +671,40 @@ class CitationCreate(PermissionRequiredMixin, SuccessMessageMixin, CreateView):
success_message = "Yoohoooo..."
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = self.get_context_data(form=form)
context.update({"my_message": "Soemthign went wrong"})
return self.render_to_response(context)
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('citation-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "xyz"
context["mysubsection"] = "abc"
@@ -426,6 +715,15 @@ def get_context_data(self, **kwargs):
return context
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
# def form_invalid(self, form):
@@ -433,6 +731,9 @@ def form_valid(self, form):
class CitationUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update a citation.
+ """
model = Citation
form_class = CitationForm
template_name = "core/references/citation_update.html"
@@ -440,11 +741,31 @@ class CitationUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
success_message = "Yoohoooo..."
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
context = self.get_context_data(form=form)
context.update({"my_message": "Soemthign went wrong"})
return self.render_to_response(context)
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -453,6 +774,9 @@ def get_context_data(self, **kwargs):
return context
class CitationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ Delete a citation.
+ """
model = Citation
success_url = reverse_lazy('citations')
template_name = "core/delete_general.html"
@@ -460,42 +784,94 @@ class CitationDelete(PermissionRequiredMixin, DeleteView):
class CitationDetailView(generic.DetailView):
+ """
+ Display the details of a citation.
+ """
model = Citation
template_name = "core/references/citation_detail.html"
# SeshatComment
class SeshatCommentListView(generic.ListView):
+ """
+ List all comments.
+ """
model = SeshatComment
template_name = "core/seshatcomments/seshatcomment_list.html"
paginate_by = 20
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcomments')
class SeshatCommentCreate(PermissionRequiredMixin, CreateView):
+ """
+ Create a new comment.
+ """
model = SeshatComment
form_class = SeshatCommentForm
template_name = "core/seshatcomments/seshatcomment_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcomment-create')
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
class SeshatCommentUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ Update a comment.
+ """
model = SeshatComment
form_class = SeshatCommentForm
template_name = "core/seshatcomments/seshatcomment_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
my_apps=['rt', 'general', 'sc', 'wf', 'crisisdb']
my_app_models = {name: apps.all_models[name] for name in my_apps}
@@ -561,6 +937,9 @@ def get_context_data(self, **kwargs):
# return context
class SeshatCommentDelete(PermissionRequiredMixin, DeleteView):
+ """
+ Delete a comment.
+ """
model = SeshatComment
success_url = reverse_lazy('seshatcomments')
template_name = "core/delete_general.html"
@@ -568,60 +947,146 @@ class SeshatCommentDelete(PermissionRequiredMixin, DeleteView):
class SeshatCommentDetailView(generic.DetailView):
+ """
+ Display the details of a comment.
+ """
model = SeshatComment
template_name = "core/seshatcomments/seshatcomment_detail.html"
# SeshatCommentPart
class SeshatCommentPartListView(generic.ListView):
+ """
+ List all comment parts.
+ """
model = SeshatCommentPart
template_name = "core/seshatcomments/seshatcommentpart_list.html"
paginate_by = 20
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcommentparts')
# SeshatCommentPart
class SeshatCommentPartListView3(generic.ListView):
+ """
+ List all comment parts.
+ """
model = SeshatCommentPart
template_name = "core/seshatcomments/seshatcommentpart_list3.html"
paginate_by = 20
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcommentparts3')
class SeshatCommentPartCreate(PermissionRequiredMixin, CreateView):
+ """
+ Create a new comment part.
+ """
model = SeshatCommentPart
form_class = SeshatCommentPartForm
template_name = "core/seshatcomments/seshatcommentpart_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcommentpart-create')
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
class SeshatCommentPartCreate2(PermissionRequiredMixin, CreateView):
+ """
+ Create a new comment part.
+ """
model = SeshatCommentPart
form_class = SeshatCommentPartForm
template_name = "core/seshatcomments/seshatcommentpart_form_prefilled.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatcommentpart-create2')
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
logged_in_user = self.request.user
logged_in_expert = Seshat_Expert.objects.get(user=logged_in_user)
@@ -640,21 +1105,59 @@ def get_context_data(self, **kwargs):
class SeshatPrivateCommentPartCreate2(PermissionRequiredMixin, CreateView):
+ """
+ Create a new private comment part.
+ """
model = SeshatPrivateCommentPart
form_class = SeshatPrivateCommentPartForm
template_name = "core/seshatcomments/seshatprivatecommentpart_form_prefilled.html"
permission_required = 'core.add_seshatprivatecommentpart'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('seshatprivatecommentpart-create2')
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
logged_in_user = self.request.user
logged_in_expert = Seshat_Expert.objects.get(user=logged_in_user)
@@ -675,6 +1178,21 @@ def get_context_data(self, **kwargs):
# Function based:
@permission_required('core.add_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object.
+ com_id (int): The primary key of the comment.
+ subcom_order (int): The order of the comment part.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if request.method == 'POST':
form = SeshatCommentPartForm2(request.POST)
big_father = SeshatComment.objects.get(id=com_id)
@@ -752,6 +1270,20 @@ def seshat_comment_part_create_from_null_view_OLD(request, com_id, subcom_order)
# Function based NEW:
@permission_required('core.add_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object.
+ com_id (int): The primary key of the comment.
+ subcom_order (int): The order of the comment part.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if request.method == 'POST':
form = SeshatCommentPartForm2(request.POST)
big_father = SeshatComment.objects.get(id=com_id)
@@ -953,6 +1485,19 @@ def seshat_comment_part_create_from_null_view_inline(request, app_name, model_na
# Function based NEW:
@permission_required('core.add_seshatprivatecommentpart')
def 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.
+
+ Args:
+ request (HttpRequest): The request object.
+ private_com_id (int): The primary key of the private comment.
+
+ Returns:
+ HttpResponse: The response object.
+ """
if request.method == 'POST':
form = SeshatPrivateCommentPartForm(request.POST)
big_father = SeshatPrivateComment.objects.get(id=private_com_id)
@@ -992,6 +1537,9 @@ def seshat_private_comment_part_create_from_null_view(request, private_com_id):
# return render(request, 'core/seshatcomments/seshatcommentpart_update2.html', {'form': form, 'formset': init_data, 'comm_num':pk, 'comm_part_display': comment_part})
class SeshatCommentPartUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update a comment part.
+ """
model = SeshatCommentPart
form_class = SeshatCommentPartForm
template_name = "core/seshatcomments/seshatcommentpart_update.html"
@@ -1000,6 +1548,17 @@ class SeshatCommentPartUpdate(PermissionRequiredMixin, SuccessMessageMixin, Upda
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
logged_in_user = self.request.user
logged_in_expert = Seshat_Expert.objects.get(user=logged_in_user)
@@ -1016,6 +1575,9 @@ def get_context_data(self, **kwargs):
return context
class SeshatPrivateCommentPartUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update a private comment part.
+ """
model = SeshatPrivateCommentPart
form_class = SeshatPrivateCommentPartForm
template_name = "core/seshatcomments/seshatprivatecommentpart_update2.html"
@@ -1024,6 +1586,17 @@ class SeshatPrivateCommentPartUpdate(PermissionRequiredMixin, SuccessMessageMixi
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
logged_in_user = self.request.user
logged_in_expert = Seshat_Expert.objects.get(user=logged_in_user)
@@ -1038,6 +1611,9 @@ def get_context_data(self, **kwargs):
class SeshatCommentPartDelete(PermissionRequiredMixin, DeleteView):
+ """
+ Delete a comment part.
+ """
model = SeshatCommentPart
#success_url = reverse_lazy('seshatcommentparts')
#success_url = reverse_lazy('seshatcommentparts')
@@ -1065,6 +1641,9 @@ class SeshatCommentPartDetailView(generic.DetailView):
# POLITY
class PolityCreate(PermissionRequiredMixin, CreateView):
+ """
+ Create a new Polity.
+ """
model = Polity
form_class = PolityForm
template_name = "core/polity/polity_form.html"
@@ -1072,6 +1651,15 @@ class PolityCreate(PermissionRequiredMixin, CreateView):
success_url = reverse_lazy('polities')
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
# Custom validation to check if a Polity with the same new_name already exists
new_name = form.cleaned_data['new_name']
existing_polity = Polity.objects.filter(new_name=new_name)
@@ -1091,11 +1679,30 @@ def form_invalid(self, form):
class PolityUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update a Polity.
+ """
model = Polity
form_class = PolityUpdateForm
template_name = "core/polity/polity_form.html"
permission_required = 'core.add_capital'
success_message = "You successfully updated the Polity."
+
+ def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
+ context = super().get_context_data(**kwargs)
+ context['pk'] = self.object.pk
+ return context
def get_success_url(self):
return reverse_lazy('polity-detail-main', kwargs={'pk': self.object.pk})
@@ -1143,6 +1750,12 @@ def get_success_url(self):
class PolityListView_old(PermissionRequiredMixin, SuccessMessageMixin, generic.ListView):
+ """
+ List all polities.
+
+ Note:
+ This class is not used in the current implementation.
+ """
model = Polity
template_name = "core/polity/polity_list.html"
permission_required = 'core.add_capital'
@@ -1150,9 +1763,26 @@ class PolityListView_old(PermissionRequiredMixin, SuccessMessageMixin, generic.L
#paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
all_ngas = Nga.objects.all()
all_pols = Polity.objects.all().order_by('start_year')
@@ -1200,15 +1830,38 @@ def get_context_data(self, **kwargs):
return context
class PolityListView1(SuccessMessageMixin, generic.ListView):
+ """
+ List all polities.
+
+ Note:
+ This class is not used in the current implementation.
+ """
model = Polity
template_name = "core/polity/polity_list.html"
#paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
all_ngas = Nga.objects.all()
all_pols = Polity.objects.all().order_by('start_year')
@@ -1266,15 +1919,38 @@ def get_context_data(self, **kwargs):
class PolityListViewX(SuccessMessageMixin, generic.ListView):
+ """
+ List all polities.
+
+ Note:
+ This class is not used in the current implementation.
+ """
model = Polity
template_name = "core/polity/polity_list.html"
#paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
all_ngas = Nga.objects.all()
all_pols = Polity.objects.all().order_by('start_year')
@@ -1400,13 +2076,33 @@ def get_context_data(self, **kwargs):
return context
class PolityListViewLight(SuccessMessageMixin, generic.ListView):
+ """
+ List all polities.
+ """
model = Polity
template_name = "core/polity/polity_list_light.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities-light')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
#import time
#start_time = time.time()
@@ -1467,13 +2163,33 @@ def get_context_data(self, **kwargs):
return context
class PolityListView(SuccessMessageMixin, generic.ListView):
+ """
+ List all polities.
+ """
model = Polity
template_name = "core/polity/polity_list.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
#import time
#start_time = time.time()
@@ -1616,15 +2332,35 @@ def get_context_data(self, **kwargs):
class PolityListViewCommented(PermissionRequiredMixin, SuccessMessageMixin, generic.ListView):
+ """
+ List all polities with comments.
+ """
model = Polity
template_name = "core/polity/polity_list_commented.html"
permission_required = 'core.add_seshatprivatecommentpart'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polities')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
#all_pols = Polity.objects.filter(private_comment__isnull=False).order_by('start_year')
@@ -1650,10 +2386,26 @@ def get_context_data(self, **kwargs):
class PolityDetailView(SuccessMessageMixin, generic.DetailView):
+ """
+ Show details of a polity.
+ """
model = Polity
template_name = "core/polity/polity_detail.html"
def get_object(self, queryset=None):
+ """
+ Get the object of the view.
+
+ Args:
+ queryset: The queryset to use.
+
+ Returns:
+ Polity: The object of the view.
+
+ Raises:
+ Http404: If no polity matches the given name.
+ Http404: If multiple polities are found with the same name.
+ """
if 'pk' in self.kwargs:
return get_object_or_404(Polity, pk=self.kwargs['pk'])
elif 'new_name' in self.kwargs:
@@ -1672,7 +2424,19 @@ def get_object(self, queryset=None):
return None
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
+ context['pk'] = self.kwargs['pk']
try:
context["all_data"] = get_all_data_for_a_polity(self.object.pk, "crisisdb")
context["all_general_data"], context["has_any_general_data"] = get_all_general_data_for_a_polity(self.object.pk)
@@ -1832,20 +2596,44 @@ def get_context_data(self, **kwargs):
# NGA
class NgaCreate(PermissionRequiredMixin, CreateView):
+ """
+ Create a new NGA.
+ """
model = Nga
form_class = NgaForm
template_name = "core/nga/nga_form.html"
permission_required = 'core.add_capital'
success_url = reverse_lazy('ngas')
- def form_valid(self, form):
+ def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return super().form_valid(form)
def form_invalid(self, form):
+ """
+ Handle invalid form data.
+
+ Args:
+ form (Form): The form object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
return HttpResponseRedirect(reverse('seshat-index'))
class NgaUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update an NGA.
+ """
model = Nga
form_class = NgaForm
template_name = "core/nga/nga_update.html"
@@ -1855,11 +2643,17 @@ class NgaUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
class NgaListView(generic.ListView):
+ """
+ List all NGAs.
+ """
model = Nga
template_name = "core/nga/nga_list.html"
#paginate_by = 10
class NgaDetailView(generic.DetailView):
+ """
+ Show details of an NGA.
+ """
model = Nga
template_name = "core/nga/nga_detail.html"
@@ -1867,6 +2661,9 @@ class NgaDetailView(generic.DetailView):
# Capital
class CapitalCreate(PermissionRequiredMixin, SuccessMessageMixin, CreateView):
+ """
+ Create a new Capital.
+ """
model = Capital
form_class = CapitalForm
template_name = "core/capital/capital_form_create.html"
@@ -1882,6 +2679,9 @@ class CapitalCreate(PermissionRequiredMixin, SuccessMessageMixin, CreateView):
class CapitalUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
+ """
+ Update a Capital.
+ """
model = Capital
form_class = CapitalForm
template_name = "core/capital/capital_form.html"
@@ -1891,15 +2691,27 @@ class CapitalUpdate(PermissionRequiredMixin, SuccessMessageMixin, UpdateView):
class CapitalListView(generic.ListView):
+ """
+ List all Capitals.
+ """
model = Capital
template_name = "core/capital/capital_list.html"
#paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('capitals')
class CapitalDelete(PermissionRequiredMixin, DeleteView):
+ """
+ Delete a Capital.
+ """
model = Capital
success_url = reverse_lazy('capitals')
template_name = "core/delete_general.html"
@@ -1910,6 +2722,18 @@ class CapitalDelete(PermissionRequiredMixin, DeleteView):
@permission_required('core.view_capital')
def capital_download(request):
+ """
+ Download all Capitals as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
items = Capital.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1926,6 +2750,15 @@ def capital_download(request):
def signup_traditional(request):
+ """
+ Handle user signup.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
if request.method == 'POST':
form = SignUpForm(request.POST)
if form.is_valid():
@@ -1962,11 +2795,31 @@ def signup_traditional(request):
def signupfollowup(request):
+ """
+ Handle user signup follow-up.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
print(settings.EMAIL_HOST_USER)
return render(request, 'core/signup-followup.html')
def activate(request, uidb64, token):
+ """
+ Activate user account.
+
+ Args:
+ request: The request object.
+ uidb64: The user ID encoded in base64.
+ token: The token.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
try:
uid = force_str(urlsafe_base64_decode(uidb64))
#uid = str(urlsafe_base64_decode(uidb64))
@@ -1988,21 +2841,43 @@ def activate(request, uidb64, token):
# Discussion Room
def discussion_room(request):
+ """
+ Render the discussion room page.
+ """
return render(request, 'core/discussion_room.html')
# NLP Room 1
def nlp_datapoints(request):
+ """
+ Render the NLP data points page.
+ """
return render(request, 'core/nlp_datapoints.html')
# NLP Room 2
def nlp_datapoints_2(request):
+ """
+ Render the NLP data points page.
+ """
return render(request, 'core/nlp_datapoints_2.html')
def account_activation_sent(request):
+ """
+ Render the account activation sent page.
+ """
return render(request, 'core/account_activation_sent.html')
def variablehierarchysetting(request):
+ """
+ Handle variable hierarchy setting. This is a view for the admin to set the
+ variable hierarchy.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
my_vars = dic_of_all_vars()
my_vars_keys = list(my_vars.keys())
my_vars_good_keys = []
@@ -2137,6 +3012,15 @@ def variablehierarchysetting(request):
###############
def do_zotero(results):
+ """
+ Process the results from the Zotero API.
+
+ Args:
+ results: The results from the Zotero API.
+
+ Returns:
+ list: A list of dictionaries containing the processed data.
+ """
import re
mother_ref_dic = []
for i, item in enumerate(results):
@@ -2273,6 +3157,15 @@ def do_zotero(results):
return mother_ref_dic
def do_zotero_manually(results):
+ """
+ Process the results from the Zotero API.
+
+ Args:
+ results: The results from the Zotero API.
+
+ Returns:
+ list: A list of dictionaries containing the processed data.
+ """
mother_ref_dic = []
for i, item in enumerate(results):
@@ -2309,7 +3202,13 @@ def do_zotero_manually(results):
def update_citations_from_inside_zotero_update():
"""
- this function gets all the references and build a citation for them
+ This function takes all the references and build a citation for them.
+
+ Args:
+ None
+
+ Returns:
+ None
"""
from datetime import datetime
all_refs = Reference.objects.all()
@@ -2324,6 +3223,16 @@ def update_citations_from_inside_zotero_update():
def 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.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
print("Hallo Zotero Manually")
from .manual_input_refs import manual_input_refs
@@ -2334,6 +3243,15 @@ def synczoteromanually(request):
return render (request, 'core/references/synczotero.html', context)
def synczotero(request):
+ """
+ This function is used to sync the Zotero data with the database.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
print("Hallo Zotero")
from pyzotero import zotero
@@ -2353,6 +3271,18 @@ def synczotero(request):
return render (request, 'core/references/synczotero.html', context)
def synczotero100(request):
+ """
+ This function is used to sync the Zotero data with the database.
+
+ Note:
+ This function syncs only 100 references.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
print("Hallo Zotero")
from pyzotero import zotero
@@ -2375,7 +3305,13 @@ def synczotero100(request):
def update_citations(request):
"""
- this function gets all the references and build a citation for them
+ This function takes all the references and build a citation for them.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
"""
all_refs = Reference.objects.all()
for ref in all_refs:
@@ -2387,6 +3323,19 @@ def update_citations(request):
@require_GET
def 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.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ JsonResponse: The JSON response.
+ """
search_text = request.GET.get('search_text', '')
# Filter the options based on the search text
@@ -2399,6 +3348,16 @@ def polity_filter_options_view(request):
def download_oldcsv(request, file_name):
+ """
+ Download a CSV file.
+
+ Args:
+ request: The request object.
+ file_name (str): The name of the file to download.
+
+ Returns:
+ FileResponse: The file response.
+ """
file_path = os.path.join(settings.STATIC_ROOT, 'csvfiles', file_name)
response = FileResponse(open(file_path, 'rb'))
response['Content-Disposition'] = f'attachment; filename="{file_name}"'
@@ -2407,6 +3366,15 @@ def download_oldcsv(request, file_name):
def seshatindex(request):
+ """
+ Render the Seshat landing page.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
app_names = ['general','sc', 'wf', 'crisisdb'] # Replace with your app name
context = {
'pols_data': [],
@@ -2544,6 +3512,16 @@ def seshatindex(request):
def 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).
+
+ Args:
+ polity_id: The ID of the polity.
+
+ Returns:
+ dict: The data for the polity.
+ """
from seshat.apps.crisisdb.models import Crisis_consequence, Power_transition, Human_sacrifice
from django.apps import apps
@@ -2580,6 +3558,18 @@ def get_polity_data_single(polity_id):
@permission_required('core.view_capital')
def download_csv_all_polities(request):
+ """
+ Download a CSV file containing all polities.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
# Create a response object with CSV content type
response = HttpResponse(content_type='text/csv')
current_datetime = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -2613,6 +3603,18 @@ def download_csv_all_polities(request):
def 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.
+
+ Args:
+ reference (Reference): The reference.
+ page_from (int): The starting page number.
+ page_to (int): The ending page number.
+
+ Returns:
+ Citation: The Citation instance.
+ """
# Check if a matching citation already exists
existing_citation = Citation.objects.filter(
ref=reference,
@@ -2633,6 +3635,19 @@ def get_or_create_citation(reference, page_from, page_to):
from .models import SeshatCommentPart, Citation
def 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.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
if request.method == 'POST':
form = SeshatCommentPartForm2(request.POST)
if form.is_valid():
@@ -2675,6 +3690,15 @@ def seshatcommentpart_create_view_old(request):
from .models import SeshatCommentPart, Citation, SeshatComment
def seshatcommentpart_create_view(request):
+ """
+ Create a new SeshatCommentPart instance.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
if request.method == 'POST':
form = SeshatCommentPartForm2(request.POST)
if form.is_valid():
@@ -2743,9 +3767,512 @@ def seshatcommentpart_create_view(request):
return render(request, 'core/seshatcomments/seshatcommentpart_create.html', {'form': form})
+
+
+# Shapefile views
+import time # TODO: delete
+
+def get_provinces(selected_base_map_gadm='province'):
+ """
+ Get all the province or country shapes for the map base layer.
+
+ Args:
+ selected_base_map_gadm (str): The selected base map GADM level.
+
+ Returns:
+ list: A list of dictionaries containing the province or country shapes.
+ """
+
+ # Use the appropriate Django ORM query based on the selected baseMapGADM value
+ if selected_base_map_gadm == 'country':
+ rows = GADMCountries.objects.values_list('geom', 'COUNTRY')
+ provinces = [
+ {
+ 'aggregated_geometry': GEOSGeometry(geom).geojson,
+ 'country': country
+ }
+ for geom, country in rows if geom is not None
+ ]
+ elif selected_base_map_gadm == 'province':
+ rows = GADMProvinces.objects.values_list('geom', 'COUNTRY', 'NAME_1', 'ENGTYPE_1')
+ provinces = [
+ {
+ 'aggregated_geometry': GEOSGeometry(geom).geojson,
+ 'country': country,
+ 'province': name,
+ 'province_type': engtype
+ }
+ for geom, country, name, engtype in rows if geom is not None
+ ]
+
+ return provinces
+
+def get_polity_shape_content(displayed_year="all", seshat_id="all", tick_number=20, override_earliest_year=None, override_latest_year=None):
+ """
+ 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 VideoShapefile is new_name in Polity.
+
+ Args:
+ 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:
+ dict: The content for the polity shapes.
+ """
+
+ if displayed_year != "all" and seshat_id != "all":
+ raise ValueError("Only one of displayed_year or seshat_id should be set not both.")
+
+ if displayed_year != "all":
+ rows = VideoShapefile.objects.filter(polity_start_year__lte=displayed_year, polity_end_year__gte=displayed_year)
+ elif seshat_id != "all":
+ rows = VideoShapefile.objects.filter(seshat_id=seshat_id)
+ else:
+ rows = VideoShapefile.objects.all()
+
+
+ # Convert 'geom' to GeoJSON in the database query
+ rows = rows.annotate(geom_json=AsGeoJSON('geom')).values('id', 'seshat_id', 'name', 'polity', 'start_year', 'end_year', 'polity_start_year', 'polity_end_year', 'colour', 'area', 'geom_json')
+
+ shapes = list(rows)
+
+ seshat_ids = [shape['seshat_id'] for shape in shapes if shape['seshat_id']]
+
+ polities = Polity.objects.filter(new_name__in=seshat_ids).values('new_name', 'id', 'long_name')
+
+ polity_info = [(polity['new_name'], polity['id'], polity['long_name']) for polity in polities]
+
+ seshat_id_page_id = {new_name: {'id': id, 'long_name': long_name or ""} for new_name, id, long_name in polity_info}
+
+ if 'migrate' not in sys.argv:
+ result = VideoShapefile.objects.aggregate(
+ min_year=Min('polity_start_year'),
+ max_year=Max('polity_end_year')
+ )
+ earliest_year = result['min_year']
+ latest_year = result['max_year']
+ initial_displayed_year = earliest_year
+ else:
+ earliest_year, latest_year = 2014, 2014
+ initial_displayed_year = -3400
+
+ if override_earliest_year is not None:
+ earliest_year = override_earliest_year
+ if override_latest_year is not None:
+ latest_year = override_latest_year
+
+ if displayed_year == "all":
+ displayed_year = initial_displayed_year
+
+ if seshat_id != "all": # Used in the polity pages
+ earliest_year = min([shape['start_year'] for shape in shapes])
+ displayed_year = earliest_year
+ latest_year = max([shape['end_year'] for shape in shapes])
+
+ # Get the years for the tick marks on the year slider
+ tick_years = [round(year) for year in np.linspace(earliest_year, latest_year, num=tick_number)]
+
+ content = {
+ 'shapes': shapes,
+ 'earliest_year': earliest_year,
+ 'display_year': displayed_year,
+ 'tick_years': json.dumps(tick_years),
+ 'latest_year': latest_year,
+ 'seshat_id_page_id': seshat_id_page_id
+ }
+
+ return content
+
+def get_all_polity_capitals():
+ """
+ Get capital cities for polities that have them.
+
+ Returns:
+ dict: A dictionary containing the capital cities for polities.
+ """
+ from seshat.apps.core.templatetags.core_tags import get_polity_capitals
+
+ # Try to get the capitals from the cache
+ all_capitals_info = cache.get('all_capitals_info')
+
+ if all_capitals_info is None:
+ all_capitals_info = {}
+ for polity in Polity.objects.all():
+ caps = get_polity_capitals(polity.id)
+
+ if caps:
+ # Set the start and end years to be the same as the polity where missing
+ modified_caps = caps
+ i = 0
+ for capital_info in caps:
+ if capital_info['year_from'] == None:
+ modified_caps[i]['year_from'] = polity.start_year
+ if capital_info['year_to'] == None:
+ modified_caps[i]['year_to'] = polity.end_year
+ i+=1
+ all_capitals_info[polity.new_name] = modified_caps
+ # Store the capitals in the cache for 1 hour
+ cache.set('all_capitals_info', all_capitals_info, 3600)
+
+ return all_capitals_info
+
+def assign_variables_to_shapes(shapes, app_map):
+ """
+ Assign the absent/present variables to the shapes.
+
+ Args:
+ shapes (list): The shapes to assign the variables to.
+ app_map (dict): A dictionary mapping app names to their long names.
+
+ Returns:
+ tuple: A tuple containing the shapes and the variables.
+ """
+ from seshat.apps.sc.models import ABSENT_PRESENT_CHOICES # These should be the same in the other apps
+ # Try to get the variables from the cache
+ variables = cache.get('variables')
+ if variables is None:
+ variables = {}
+ for app_name, app_name_long in app_map.items():
+ module = apps.get_app_config(app_name)
+ variables[app_name_long] = {}
+ models = list(module.get_models())
+ for model in models:
+ fields = list(model._meta.get_fields())
+ for field in fields:
+ if hasattr(field, 'choices') and field.choices == ABSENT_PRESENT_CHOICES:
+ # Get the variable name and formatted name
+ if field.name == 'coded_value': # Use the class name lower case for rt models where coded_value is used
+ var_name = model.__name__.lower()
+ var_long = getattr(model._meta, 'verbose_name_plural', model.__name__.lower())
+ if var_name == var_long:
+ variable_formatted = var_name.capitalize().replace('_', ' ')
+ else:
+ variable_formatted = var_long
+ else: # Use the field name for other models
+ var_name = field.name
+ variable_formatted = field.name.capitalize().replace('_', ' ')
+ variables[app_name_long][var_name] = {}
+ variables[app_name_long][var_name]['formatted'] = variable_formatted
+ # Get the variable subsection and subsubsection if they exist
+ variable_full_name = variable_formatted
+ instance = model()
+ if hasattr(instance, 'subsubsection'):
+ variable_full_name = instance.subsubsection() + ': ' + variable_full_name
+ if hasattr(instance, 'subsection'):
+ variable_full_name = instance.subsection() + ': ' + variable_full_name
+ variables[app_name_long][var_name]['full_name'] = variable_full_name
+
+ # Store the variables in the cache for 1 hour
+ cache.set('variables', variables, 3600)
+
+ for app_name, app_name_long in app_map.items():
+
+ app_variables_list = list(variables[app_name_long].keys())
+ module_path = 'seshat.apps.' + app_name + '.models'
+ module = __import__(module_path, fromlist=[variable.capitalize() for variable in app_variables_list])
+ variable_classes = {variable: getattr(module, variable.capitalize()) for variable in app_variables_list}
+
+ seshat_ids = [shape['seshat_id'] for shape in shapes if shape['seshat_id'] != 'none']
+ polities = {polity.new_name: polity for polity in Polity.objects.filter(new_name__in=seshat_ids)}
+
+ for variable, class_ in variable_classes.items():
+ variable_formatted = variables[app_name_long][variable]['formatted']
+ variable_objs = {obj.polity_id: obj for obj in class_.objects.filter(polity_id__in=polities.values())}
+
+ all_variable_objs = {}
+ for obj in class_.objects.filter(polity_id__in=polities.values()):
+ try:
+ variable_value = getattr(obj, variable)
+ except AttributeError: # For rt models where coded_value is used
+ variable_value = getattr(obj, 'coded_value')
+ if obj.polity_id not in all_variable_objs:
+ all_variable_objs[obj.polity_id] = {}
+ all_variable_objs[obj.polity_id][variable_value] = [obj.year_from, obj.year_to]
+
+ for shape in shapes:
+ shape[variable_formatted] = 'uncoded' # Default value
+ polity = polities.get(shape['seshat_id'])
+ if polity:
+ variable_obj = variable_objs.get(polity.id)
+ try:
+ variable_obj_dict = all_variable_objs[polity.id]
+ except KeyError:
+ pass
+ if variable_obj:
+ try:
+ shape[variable_formatted] = getattr(variable_obj, variable) # absent/present choice
+ shape[variable_formatted + '_dict'] = variable_obj_dict
+ except AttributeError: # For rt models where coded_value is used
+ shape[variable_formatted] = getattr(variable_obj, 'coded_value')
+ shape[variable_formatted + '_dict'] = variable_obj_dict
+ else:
+ shape[variable_formatted] = 'no seshat page'
+
+ return shapes, variables
+
+def assign_categorical_variables_to_shapes(shapes, variables):
+ """
+ Assign the categorical variables to the shapes.
+
+ Note:
+ Currently only language is implemented.
+
+ Args:
+ shapes (list): The shapes to assign the variables to.
+ variables (dict): The variables to assign to the shapes.
+
+ Returns:
+ tuple: A tuple containing the shapes and the variables.
+ """
+ # Add language variables to the variables
+ variables['General Variables'] = {
+ 'polity_linguistic_family': {'formatted': 'linguistic_family', 'full_name': 'Linguistic Family'},
+ 'polity_language_genus': {'formatted': 'language_genus', 'full_name': 'Language Genus'},
+ 'polity_language': {'formatted': 'language', 'full_name': 'Language'}
+ }
+
+ # Fetch all polities and store them in a dictionary for quick access
+ polities = {polity.new_name: polity for polity in Polity.objects.all()}
+
+ # Fetch all linguistic families, language genuses, and languages and store them in dictionaries for quick access
+ linguistic_families = {}
+ for lf in Polity_linguistic_family.objects.all():
+ if lf.polity_id not in linguistic_families:
+ linguistic_families[lf.polity_id] = []
+ linguistic_families[lf.polity_id].append(lf)
+
+ language_genuses = {}
+ for lg in Polity_language_genus.objects.all():
+ if lg.polity_id not in language_genuses:
+ language_genuses[lg.polity_id] = []
+ language_genuses[lg.polity_id].append(lg)
+
+ languages = {}
+ for l in Polity_language.objects.all():
+ if l.polity_id not in languages:
+ languages[l.polity_id] = []
+ languages[l.polity_id].append(l)
+
+ # Add language variable info to polity shapes
+ for shape in shapes:
+ shape['linguistic_family'] = []
+ shape['linguistic_family_dict'] = {}
+ shape['language_genus'] = []
+ shape['language_genus_dict'] = {}
+ shape['language'] = []
+ shape['language_dict'] = {}
+ if shape['seshat_id'] != 'none': # Skip shapes with no seshat_id
+ polity = polities.get(shape['seshat_id'])
+ if polity:
+ # Get the linguistic family, language genus, and language for the polity
+ shape['linguistic_family'].extend([lf.linguistic_family for lf in linguistic_families.get(polity.id, [])])
+ shape['language_genus'].extend([lg.language_genus for lg in language_genuses.get(polity.id, [])])
+ shape['language'].extend([l.language for l in languages.get(polity.id, [])])
+
+ # Get the years for the linguistic family, language genus, and language for the polity
+ shape['linguistic_family_dict'].update({lf.linguistic_family: [lf.year_from, lf.year_to] for lf in linguistic_families.get(polity.id, [])})
+ shape['language_genus_dict'].update({lg.language_genus: [lg.year_from, lg.year_to] for lg in language_genuses.get(polity.id, [])})
+ shape['language_dict'].update({l.language: [l.year_from, l.year_to] for l in languages.get(polity.id, [])})
+
+ # If no linguistic family, language genus, or language was found, append 'Uncoded'
+ polity = polities.get(shape['seshat_id'])
+ if polity:
+ if not shape['linguistic_family']:
+ shape['linguistic_family'].append('Uncoded')
+ if not shape['language_genus']:
+ shape['language_genus'].append('Uncoded')
+ if not shape['language']:
+ shape['language'].append('Uncoded')
+ else:
+ if not shape['linguistic_family']:
+ shape['linguistic_family'].append('No Seshat page')
+ if not shape['language_genus']:
+ shape['language_genus'].append('No Seshat page')
+ if not shape['language']:
+ shape['language'].append('No Seshat page')
+
+ return shapes, variables
+
+# Get all the variables used in the map view
+app_map = {
+ 'sc': 'Social Complexity Variables',
+ 'wf': 'Warfare Variables (Military Technologies)',
+ # 'rt': 'Religion Tolerance', # TODO: Implemented but temporarily restricted. Uncomment when ready.
+ # 'general': 'General Variables', # TODO: Partially implmented and hardcoded in assign_categorical_variables_to_shapes.
+}
+
+# Get sorted lists of choices for each categorical variable
+categorical_variables = {
+ 'linguistic_family': sorted([x[0] for x in POLITY_LINGUISTIC_FAMILY_CHOICES]),
+ 'language_genus': sorted([x[0] for x in POLITY_LANGUAGE_GENUS_CHOICES]),
+ 'language': sorted([x[0] for x in POLITY_LANGUAGE_CHOICES])
+}
+
+def random_polity_shape():
+ """
+ This function is used to get a random polity for the world map initial view.
+ It selects a polity with a seshat_id and a start year.
+
+ Use the VideoShapefile model to get the polity shapes.
+ Choose one that has a seshat_id.
+ Return the seshat_id and start year.
+
+ Returns:
+ tuple: A tuple containing the start year and seshat_id.
+ """
+ max_id = VideoShapefile.objects.filter(seshat_id__isnull=False).aggregate(max_id=Max("id"))['max_id']
+ while True:
+ pk = random.randint(1, max_id)
+ shape = VideoShapefile.objects.filter(seshat_id__isnull=False, id=pk).first()
+ if shape:
+ if shape.seshat_id and shape.area > 600000: # Big empires only
+ break
+ return shape.start_year, shape.seshat_id
+
+def common_map_view_content(content):
+ """
+ Set of functions that update content and run in each map view function.
+
+ Args:
+ content (dict): The content for the polity shapes.
+
+ Returns:
+ dict: The updated content for the polity shapes.
+ """
+ # start_time = time.time()
+ # Add in the present/absent variables to view for the shapes
+ content['shapes'], content['variables'] = assign_variables_to_shapes(content['shapes'], app_map)
+ # print(f"Time taken to assign absent/present variables to shapes: {time.time() - start_time} seconds")
+
+ # Add in the categorical variables to view for the shapes
+ content['shapes'], content['variables'] = assign_categorical_variables_to_shapes(content['shapes'], content['variables'])
+
+ # Load the capital cities for polities that have them
+ content['all_capitals_info'] = get_all_polity_capitals()
+
+ # Add categorical variable choices to content for dropdown selection
+ content['categorical_variables'] = categorical_variables
+
+ # Set the initial polity to highlight
+ content['world_map_initial_polity'] = world_map_initial_polity
+
+ return content
+
+# World map defalut settings
+world_map_initial_displayed_year = 117
+world_map_initial_polity = 'it_roman_principate'
+
+def map_view_initial(request):
+ global world_map_initial_displayed_year, world_map_initial_polity
+ """
+ This view is used to display a map with polities plotted on it. The initial
+ view just loads a polity with a seshat_id picked at random and sets the
+ display year to that polity start year.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
+
+ # Check if 'year' parameter is different from the world_map_initial_displayed_year or not present then redirect
+ if 'year' in request.GET:
+ if request.GET['year'] != str(world_map_initial_displayed_year):
+ return redirect('{}?year={}'.format(request.path, world_map_initial_displayed_year))
+ else:
+ # Select a random polity for the initial view
+ if 'test' not in sys.argv:
+ world_map_initial_displayed_year, world_map_initial_polity = random_polity_shape()
+ return redirect('{}?year={}'.format(request.path, world_map_initial_displayed_year))
+
+ content = get_polity_shape_content(seshat_id=world_map_initial_polity)
+
+ content = common_map_view_content(content)
+
+ # For the initial view, set the displayed year to the polity's start year
+ content['display_year'] = world_map_initial_displayed_year
+
+ return render(request,
+ 'core/world_map.html',
+ content
+ )
+
+def map_view_one_year(request):
+ """
+ This view is used to display a map with polities plotted on it. The view
+ loads all polities present in the year in the url.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ JsonResponse: The HTTP response with serialized JSON.
+ """
+ year = request.GET.get('year', world_map_initial_displayed_year)
+ content = get_polity_shape_content(displayed_year=year)
+
+ content = common_map_view_content(content)
+
+ return JsonResponse(content)
+
+def 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.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ JsonResponse: The HTTP response with serialized JSON.
+ """
+
+ # Temporary restriction on the latest year for the whole map view
+ content = get_polity_shape_content(override_latest_year=2014)
+
+ content = common_map_view_content(content)
+
+ return JsonResponse(content)
+
+def provinces_and_countries_view(request):
+ """
+ This view is used to get the provinces and countries for the map.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ JsonResponse: The HTTP response with serialized JSON.
+ """
+ provinces = get_provinces()
+ countries = get_provinces(selected_base_map_gadm='country')
+
+ content = {
+ 'provinces': provinces,
+ 'countries': countries,
+ }
+
+ return JsonResponse(content)
######################
def update_seshat_comment_part_view(request, pk):
+ """
+ View to update a SeshatCommentPart instance.
+
+ Note:
+ This view can handle POST and GET requests.
+
+ Args:
+ request: The request object.
+ pk: The primary key of the SeshatCommentPart instance.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
comment_part = SeshatCommentPart.objects.get(id=pk)
parent_comment_id = comment_part.comment.id
subcomment_order = comment_part.comment_order
@@ -2912,7 +4439,20 @@ def update_seshat_comment_part_view(request, pk):
@login_required
def create_a_comment_with_a_subcomment_new(request, app_name, model_name, instance_id):
"""
- Create a comment and assign it to a model instance.
+ 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.
+
+ Args:
+ 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:
+ HttpResponse: The HTTP response.
"""
# Get the model class dynamically using the provided model_name
#model_class = globals()[model_name]
@@ -3091,7 +4631,19 @@ def create_a_comment_with_a_subcomment_newer(request, app_name, model_name, inst
@permission_required('core.add_seshatprivatecommentpart')
def 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.
+ Create a PrivateComment and assign it to a model instance.
+
+ Note:
+ This view is only accessible to users with the 'add_seshatprivatecommentpart' permission.
+
+ Args:
+ 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:
+ HttpResponse: The HTTP response.
"""
# Get the model class dynamically using the provided model_name
#model_class = globals()[model_name]
@@ -3150,6 +4702,9 @@ def create_a_private_comment_with_a_private_subcomment_new(request, app_name, mo
return redirect('seshatprivatecomment-update', pk=private_comment_instance.id)
class SeshatPrivateCommentUpdate(PermissionRequiredMixin, UpdateView, FormMixin):
+ """
+ View to update a SeshatPrivateComment instance.
+ """
model = SeshatPrivateComment
form_class = SeshatPrivateCommentForm
template_name = "core/seshatcomments/seshatprivatecomment_update.html"
@@ -3157,6 +4712,18 @@ class SeshatPrivateCommentUpdate(PermissionRequiredMixin, UpdateView, FormMixin)
def post(self, request, *args, **kwargs):
+ """
+ Handle POST requests: instantiate a form instance with the passed
+ POST variables and then check if it's valid.
+
+ Args:
+ request: The request object.
+ *args: Variable length argument list.
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
form = self.form()
if form.is_valid():
#print('hereeeeeeeeeeeee')
@@ -3171,7 +4738,15 @@ def post(self, request, *args, **kwargs):
def get_another_form(self, request, *args, **kwargs):
"""
- Override this method to return the specific instance of another_form.
+ Return the data from another form in the SeshatPrivateCommentPartForm.
+
+ Args:
+ request: The request object.
+ *args: Variable length argument list.
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ SeshatPrivateCommentPartForm: The form instance.
"""
# Implement this method to return the specific instance of another_form
# For example:
@@ -3180,6 +4755,17 @@ def get_another_form(self, request, *args, **kwargs):
return SeshatPrivateCommentPartForm(request.POST, request.another_form)
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
my_apps=['core', 'rt', 'general', 'sc', 'wf', 'crisisdb']
my_app_models = {name: apps.all_models[name] for name in my_apps}
@@ -3251,6 +4837,18 @@ def get_context_data(self, **kwargs):
#############################
def seshatcomment_create_view(request):
+ """
+ View to create a SeshatComment instance.
+
+ Note:
+ This view can handle POST and GET requests.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
if request.method == 'POST':
form = SeshatCommentForm2(request.POST)
if form.is_valid():
@@ -3323,6 +4921,18 @@ def seshatcomment_create_view(request):
def search_view(request):
+ """
+ View to search for a polity.
+
+ Note:
+ This view can handle GET requests.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
search_term = request.GET.get('search', '')
if search_term:
try:
@@ -3338,6 +4948,18 @@ def search_view(request):
return redirect('seshat-index') # Redirect to home or any other page if no search term is provided or no match is found
def search_suggestions(request):
+ """
+ View to get search suggestions for a polity.
+
+ Note:
+ This view can handle GET requests.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The HTTP response.
+ """
search_term = request.GET.get('search', '')
polities = Polity.objects.filter(
Q(name__icontains=search_term) |
diff --git a/seshat/apps/crisisdb/_mycodes/__init__.py b/seshat/apps/crisisdb/_mycodes/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/seshat/apps/crisisdb/mycodes/myviews.py b/seshat/apps/crisisdb/_mycodes/myviews.py
similarity index 74%
rename from seshat/apps/crisisdb/mycodes/myviews.py
rename to seshat/apps/crisisdb/_mycodes/myviews.py
index 4e126702c..fc1bd8e88 100644
--- a/seshat/apps/crisisdb/mycodes/myviews.py
+++ b/seshat/apps/crisisdb/_mycodes/myviews.py
@@ -1,3 +1,7 @@
+"""
+Note: This file is currently not in use.
+"""
+
# Generated Imports
from ..models import Population, Land_taxes_collected, Land_yield, Total_tax, Total_economic_output, Total_revenue, Diding_taxes, Salt_tax, Tariff_and_transit, Misc_incomes, Total_expenditure, Balance, Lijin, Maritime_custom, Other_incomes, Revenue_official, Revenue_real
@@ -16,9 +20,26 @@ class PopulationCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('population-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -34,6 +55,17 @@ class PopulationUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -57,6 +89,17 @@ def get_absolute_url(self):
return reverse('populations')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -95,9 +138,26 @@ class Land_taxes_collectedCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('land_taxes_collected-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -113,6 +173,17 @@ class Land_taxes_collectedUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -133,9 +204,26 @@ class Land_taxes_collectedListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('land_taxes_collecteds')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -174,9 +262,26 @@ class Land_yieldCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('land_yield-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -192,6 +297,17 @@ class Land_yieldUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -212,9 +328,26 @@ class Land_yieldListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('land_yields')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -253,9 +386,26 @@ class Total_taxCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_tax-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -271,6 +421,17 @@ class Total_taxUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -291,9 +452,26 @@ class Total_taxListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_taxs')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -332,9 +510,26 @@ class Total_economic_outputCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_economic_output-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -350,6 +545,17 @@ class Total_economic_outputUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -370,9 +576,26 @@ class Total_economic_outputListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_economic_outputs')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -411,9 +634,26 @@ class Total_revenueCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_revenue-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -429,6 +669,17 @@ class Total_revenueUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -449,9 +700,26 @@ class Total_revenueListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_revenues')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "No Section Provided"
context["mysubsection"] = "No Subsection Provided"
@@ -490,9 +758,26 @@ class Diding_taxesCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('diding_taxes-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -508,6 +793,17 @@ class Diding_taxesUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -528,9 +824,26 @@ class Diding_taxesListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('diding_taxess')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -569,9 +882,26 @@ class Salt_taxCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('salt_tax-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -587,6 +917,17 @@ class Salt_taxUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -607,9 +948,26 @@ class Salt_taxListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('salt_taxs')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -648,9 +1006,26 @@ class Tariff_and_transitCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tariff_and_transit-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -666,6 +1041,17 @@ class Tariff_and_transitUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -686,9 +1072,26 @@ class Tariff_and_transitListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tariff_and_transits')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -727,9 +1130,26 @@ class Misc_incomesCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('misc_incomes-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -745,6 +1165,17 @@ class Misc_incomesUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -765,9 +1196,26 @@ class Misc_incomesListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('misc_incomess')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -806,9 +1254,26 @@ class Total_expenditureCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_expenditure-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -824,6 +1289,17 @@ class Total_expenditureUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -844,9 +1320,26 @@ class Total_expenditureListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('total_expenditures')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -885,9 +1378,26 @@ class BalanceCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('balance-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -903,6 +1413,17 @@ class BalanceUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -923,9 +1444,26 @@ class BalanceListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('balances')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -964,9 +1502,26 @@ class LijinCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('lijin-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -982,6 +1537,17 @@ class LijinUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1002,9 +1568,26 @@ class LijinListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('lijins')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1043,9 +1626,26 @@ class Maritime_customCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('maritime_custom-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1061,6 +1661,17 @@ class Maritime_customUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1081,9 +1692,26 @@ class Maritime_customListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('maritime_customs')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1122,9 +1750,26 @@ class Other_incomesCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('other_incomes-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1140,6 +1785,17 @@ class Other_incomesUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1160,9 +1816,26 @@ class Other_incomesListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('other_incomess')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1201,9 +1874,26 @@ class Revenue_officialCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('revenue_official-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1219,6 +1909,17 @@ class Revenue_officialUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1239,9 +1940,26 @@ class Revenue_officialListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('revenue_officials')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1280,9 +1998,26 @@ class Revenue_realCreate(PermissionRequiredMixin, CreateView):
permission_required = 'catalog.can_mark_returned'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('revenue_real-create')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1298,6 +2033,17 @@ class Revenue_realUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'catalog.can_mark_returned'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
@@ -1318,9 +2064,26 @@ class Revenue_realListView(generic.ListView):
paginate_by = 5
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('revenue_reals')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysection"] = "Fiscal Helath"
context["mysubsection"] = "No Subsection Provided"
diff --git a/seshat/apps/crisisdb/forms.py b/seshat/apps/crisisdb/forms.py
index da42e66d5..c6be735fb 100644
--- a/seshat/apps/crisisdb/forms.py
+++ b/seshat/apps/crisisdb/forms.py
@@ -44,22 +44,46 @@
############## American Violence
class Us_locationForm(forms.ModelForm):
+ """
+ Form for creating and updating a US location.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Us_location
fields = '__all__'
class Us_violence_subtypeForm(forms.ModelForm):
+ """
+ Form for creating and updating a US violence subtype.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Us_violence_subtype
fields = '__all__'
class Us_violence_data_sourceForm(forms.ModelForm):
+ """
+ Form for creating and updating a US violence data source.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Us_violence_data_source
fields = '__all__'
class Us_violenceForm(forms.ModelForm):
+ """
+ Form for creating and updating a US violence.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Us_violence
fields = ["violence_date", "violence_type", "violence_subtype", "fatalities",
"location", "url_address", "short_data_source", "source_details", "narrative",]
@@ -77,7 +101,13 @@ class Meta:
###########################
class Crisis_consequenceForm(forms.ModelForm):
+ """
+ Form for creating and updating a crisis consequence.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Crisis_consequence
fields = commonfields.copy()
fields.append('crisis_case_id')
@@ -172,7 +202,13 @@ class Meta:
####################################
class Power_transitionForm(forms.ModelForm):
+ """
+ Form for creating and updating a power transition.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Power_transition
fields = commonfields.copy()
fields.append('predecessor')
@@ -235,7 +271,13 @@ class Meta:
class Human_sacrificeForm(forms.ModelForm):
+ """
+ Form for creating and updating a human sacrifice.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Human_sacrifice
fields = commonfields.copy()
fields.append('human_sacrifice')
@@ -261,7 +303,13 @@ class Meta:
class External_conflictForm(forms.ModelForm):
+ """
+ Form for creating and updating an external conflict.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = External_conflict
fields = commonfields.copy()
fields.append('conflict_name')
@@ -272,7 +320,13 @@ class Meta:
class Internal_conflictForm(forms.ModelForm):
+ """
+ Form for creating and updating an internal conflict.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Internal_conflict
fields = commonfields.copy()
fields.append('conflict')
@@ -289,7 +343,13 @@ class Meta:
class External_conflict_sideForm(forms.ModelForm):
+ """
+ Side form for creating and updating an external conflict.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = External_conflict_side
fields = commonfields.copy()
fields.append('conflict_id')
@@ -306,7 +366,13 @@ class Meta:
class Agricultural_populationForm(forms.ModelForm):
+ """
+ Form for creating and updating an agricultural population.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Agricultural_population
fields = commonfields.copy()
fields.append('agricultural_population')
@@ -317,7 +383,13 @@ class Meta:
class Arable_landForm(forms.ModelForm):
+ """
+ Form for creating and updating an arable land.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Arable_land
fields = commonfields.copy()
fields.append('arable_land')
@@ -328,7 +400,13 @@ class Meta:
class Arable_land_per_farmerForm(forms.ModelForm):
+ """
+ Form for creating and updating an arable land per farmer.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Arable_land_per_farmer
fields = commonfields.copy()
fields.append('arable_land_per_farmer')
@@ -339,7 +417,13 @@ class Meta:
class Gross_grain_shared_per_agricultural_populationForm(forms.ModelForm):
+ """
+ Form for creating and updating a gross grain shared per agricultural population.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gross_grain_shared_per_agricultural_population
fields = commonfields.copy()
fields.append('gross_grain_shared_per_agricultural_population')
@@ -350,7 +434,13 @@ class Meta:
class Net_grain_shared_per_agricultural_populationForm(forms.ModelForm):
+ """
+ Form for creating and updating a net grain shared per agricultural population.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Net_grain_shared_per_agricultural_population
fields = commonfields.copy()
fields.append('net_grain_shared_per_agricultural_population')
@@ -361,7 +451,13 @@ class Meta:
class SurplusForm(forms.ModelForm):
+ """
+ Form for creating and updating a surplus.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Surplus
fields = commonfields.copy()
fields.append('surplus')
@@ -372,7 +468,13 @@ class Meta:
class Military_expenseForm(forms.ModelForm):
+ """
+ Form for creating and updating a military expense.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Military_expense
fields = commonfields.copy()
fields.append('conflict')
@@ -385,7 +487,13 @@ class Meta:
class Silver_inflowForm(forms.ModelForm):
+ """
+ Form for creating and updating a silver inflow.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Silver_inflow
fields = commonfields.copy()
fields.append('silver_inflow')
@@ -396,7 +504,13 @@ class Meta:
class Silver_stockForm(forms.ModelForm):
+ """
+ Form for creating and updating a silver stock.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Silver_stock
fields = commonfields.copy()
fields.append('silver_stock')
@@ -407,7 +521,13 @@ class Meta:
class Total_populationForm(forms.ModelForm):
+ """
+ Form for creating and updating a total population.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Total_population
fields = commonfields.copy()
fields.append('total_population')
@@ -418,7 +538,13 @@ class Meta:
class Gdp_per_capitaForm(forms.ModelForm):
+ """
+ Form for creating and updating a GDP per capita.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gdp_per_capita
fields = commonfields.copy()
fields.append('gdp_per_capita')
@@ -429,7 +555,13 @@ class Meta:
class Drought_eventForm(forms.ModelForm):
+ """
+ Form for creating and updating a drought event.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Drought_event
fields = commonfields.copy()
fields.append('drought_event')
@@ -440,7 +572,13 @@ class Meta:
class Locust_eventForm(forms.ModelForm):
+ """
+ Form for creating and updating a locust event.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Locust_event
fields = commonfields.copy()
fields.append('locust_event')
@@ -451,7 +589,13 @@ class Meta:
class Socioeconomic_turmoil_eventForm(forms.ModelForm):
+ """
+ Form for creating and updating a socioeconomic turmoil event.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Socioeconomic_turmoil_event
fields = commonfields.copy()
fields.append('socioeconomic_turmoil_event')
@@ -462,7 +606,13 @@ class Meta:
class Crop_failure_eventForm(forms.ModelForm):
+ """
+ Form for creating and updating a crop failure event.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Crop_failure_event
fields = commonfields.copy()
fields.append('crop_failure_event')
@@ -473,7 +623,13 @@ class Meta:
class Famine_eventForm(forms.ModelForm):
+ """
+ Form for creating and updating a famine event.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Famine_event
fields = commonfields.copy()
fields.append('famine_event')
@@ -484,7 +640,13 @@ class Meta:
class Disease_outbreakForm(forms.ModelForm):
+ """
+ Form for creating and updating a disease outbreak.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Disease_outbreak
fields = commonfields.copy()
fields.append('longitude')
@@ -502,4 +664,3 @@ class Meta:
widgets['sub_category'] = forms.Select(attrs={'class': 'form-control mb-3', })
widgets['magnitude'] = forms.Select(attrs={'class': 'form-control mb-3', })
widgets['duration'] = forms.Select(attrs={'class': 'form-control mb-3', })
-
\ No newline at end of file
diff --git a/seshat/apps/crisisdb/models.py b/seshat/apps/crisisdb/models.py
index 8872150f4..520eb0fa1 100644
--- a/seshat/apps/crisisdb/models.py
+++ b/seshat/apps/crisisdb/models.py
@@ -166,6 +166,23 @@ def return_beautiful_abs_pres(item):
########## Beginning of Function Definitions for CrisisDB Models
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -173,10 +190,51 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ' '.join(['' + ' ' + citation.full_citation_display() + ' ' for citation in self.citations.all()])
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': mark_safe(' The start year is bigger than the end year!'),
@@ -218,6 +276,9 @@ def has_a_polity(self):
################American Violence Models:
class Us_location(models.Model):
+ """
+ Model representing a location in the US.
+ """
city = models.CharField(max_length=300, null=True, blank=True)
county = models.CharField(max_length=300, null=True, blank=True)
special_place = models.CharField(max_length=300, null=True, blank=True)
@@ -225,6 +286,9 @@ class Us_location(models.Model):
attention_tag = models.CharField(max_length=30, choices=ATTENTION_TAGS_CHOICES, null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['us_state', '-city', '-county', '-special_place']
# def show_state(self):
@@ -265,16 +329,25 @@ def __str__(self):
class Us_violence_subtype(models.Model):
+ """
+ Model representing a subtype of violence in the US.
+ """
name = models.CharField(max_length=80, null=True, blank=True)
is_uncertain = models.BooleanField(default=False)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['name']
def __str__(self) -> str:
return f"{self.name}{' (?)' if self.is_uncertain else ''}"
class Us_violence_data_source(models.Model):
+ """
+ Model representing a data source for violence in the US.
+ """
name = models.CharField(max_length=300, null=True, blank=True)
abbreviation = models.CharField(max_length=20, null=True, blank=True)
url_address = models.URLField(max_length=500, null=True, blank=True)
@@ -282,6 +355,9 @@ class Us_violence_data_source(models.Model):
attention_tag = models.CharField(max_length=30, choices=ATTENTION_TAGS_CHOICES, null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['name']
def __str__(self) -> str:
@@ -292,6 +368,9 @@ def __str__(self) -> str:
class Us_violence(models.Model):
+ """
+ Model representing a violence event in the US.
+ """
violence_date = models.DateField(null=True, blank=True)
violence_type = models.CharField(max_length=50, choices=VIOLENCE_TYPE_CHOICES, null=True, blank=True)
violence_subtype = models.ManyToManyField(Us_violence_subtype, related_name="%(app_label)s_%(class)s_related",related_query_name="%(app_label)s_%(class)ss", blank=True,)
@@ -304,41 +383,43 @@ class Us_violence(models.Model):
narrative = models.TextField(blank=True, null=True,)
class Meta:
+ """
+ :noindex:
+ """
ordering = ['-violence_date', "-fatalities"]
def show_locations(self):
list_of_locations = list(self.location.all())
location_str = " / ".join(str(location) for location in list_of_locations)
return location_str
-
def show_narrative_without_quotes(self):
if self.narrative:
return self.narrative.replace('"', "'")
else:
return "No_Narrative"
-
+
def show_source_details_without_quotes(self):
if self.source_details:
return self.source_details.replace('"', "'")
else:
return "No_source_details"
-
+
# def show_states(self):
# list_of_locations = list(self.location.all())
# location_str = " / ".join(str(location.show_state()) for location in list_of_locations)
# return location_str
-
+
def show_violence_subtypes(self):
list_of_subtypes = list(self.violence_subtype.all())
subtype_str = ", ".join(str(subtype) for subtype in list_of_subtypes)
return subtype_str
-
+
def show_short_data_sources(self):
list_of_short_data_sources = list(self.short_data_source.all())
short_data_source_str = ", ".join(str(short_data_source) for short_data_source in list_of_short_data_sources)
return short_data_source_str
-
+
def __str__(self) -> str:
list_of_locations = list(self.location.all())
location_str = ": " + " and ".join(str(location) for location in list_of_locations)
@@ -350,6 +431,9 @@ def __str__(self) -> str:
# Beginning of Crisis Consequences Model
class Crisis_consequence(SeshatCommon):
+ """
+ Model representing a crisis consequence.
+ """
crisis_case_id = models.CharField(max_length=100)
other_polity = models.ForeignKey(Polity, on_delete=models.SET_NULL, related_name="%(app_label)s_%(class)s_related_other",
related_query_name="%(app_label)s_%(class)s_other", null=True, blank=True)
@@ -379,6 +463,9 @@ class Crisis_consequence(SeshatCommon):
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Crisis consequence'
verbose_name_plural = 'Crisis consequences'
ordering = ['year_from', 'year_to']
@@ -386,15 +473,54 @@ class Meta:
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+
+ """
clean_times_light(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "crisis_consequence"
def get_columns_with_value(self, value):
+ """
+ Return the columns with a given value.
+
+ :noindex:
+
+ Args:
+ value (str): The value to search for.
+
+ Returns:
+ list: A list of columns with the given value. If no columns have
+ the given value, the method returns None.
+ """
columns = []
fields = ['decline', 'collapse', 'epidemic', 'downward_mobility', 'extermination', 'uprising', 'revolution', 'successful_revolution', 'civil_war', 'century_plus', 'fragmentation', 'capital', 'conquest', 'assassination', 'depose', 'constitution', 'labor', 'unfree_labor', 'suffrage', 'public_goods', 'religion']
@@ -441,6 +567,14 @@ def clean_collapse(self):
return return_beautiful_abs_pres(self.collapse)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('crisis_consequence-detail', args=[str(self.id)])
def show_value(self):
@@ -453,6 +587,9 @@ def __str__(self) -> str:
class Power_transition(SeshatCommon):
+ """
+ Model representing a power transition.
+ """
predecessor = models.CharField(max_length=200, blank=True, null=True)
successor = models.CharField(max_length=200, blank=True, null=True)
reign_number_predecessor = models.IntegerField(blank=True, null=True)
@@ -471,6 +608,9 @@ class Power_transition(SeshatCommon):
external_interference = models.CharField(max_length=5, choices=CRISIS_CONSEQUENCE_CHOICES, blank=True,null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Power Transition'
verbose_name_plural = 'Power Transitions'
ordering = ['year_from', 'year_to']
@@ -478,16 +618,55 @@ class Meta:
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+
+ """
clean_times_light(self)
has_a_polity(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "power_transition"
def get_columns_with_value(self, value):
+ """
+ Return the columns with a given value.
+
+ :noindex:
+
+ Args:
+ value (str): The value to search for.
+
+ Returns:
+ list: A list of columns with the given value. If no columns have
+ the given value, the method returns None.
+ """
columns = []
fields = ['contested', 'overturn', 'predecessor_assassination', 'intra_elite', 'military_revolt', 'popular_uprising', 'separatist_rebellion', 'external_invasion', 'external_interference', ]
@@ -525,6 +704,14 @@ def show_nga(self):
return nga_rel.nga_party.name
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('power_transition-detail', args=[str(self.id)])
def show_value(self):
@@ -544,12 +731,18 @@ def __str__(self):
########## Beginning of class Definitions for CrisisDB Models
class Human_sacrifice(SeshatCommon):
+ """
+ Model representing a human sacrifice.
+ """
name = models.CharField(max_length=100, default="Human_sacrifice")
human_sacrifice = models.CharField(max_length=500, choices=HUMAN_SACRIFICE_HUMAN_SACRIFICE_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'human_sacrifice')
verbose_name = 'Human_sacrifice'
verbose_name_plural = 'Human_sacrifices'
@@ -557,12 +750,54 @@ class Meta:
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "human_sacrifice"
def show_value(self):
@@ -576,6 +811,14 @@ def show_nga(self):
return nga_rel.nga_party.name
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('human_sacrifice-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -583,22 +826,66 @@ def __str__(self) -> str:
class External_conflict(SeshatCommon):
+ """
+ Model representing an external conflict.
+ """
name = models.CharField(max_length=100, default="External_conflict")
conflict_name = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'conflict_name')
verbose_name = 'External_conflict'
verbose_name_plural = 'External_conflicts'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('external_conflict-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -606,6 +893,9 @@ def __str__(self) -> str:
class Internal_conflict(SeshatCommon):
+ """
+ Model representing an internal conflict.
+ """
name = models.CharField(max_length=100, default="Internal_conflict")
conflict = models.CharField(max_length=500, blank=True, null=True)
expenditure = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
@@ -613,18 +903,59 @@ class Internal_conflict(SeshatCommon):
casualty = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'conflict', 'expenditure', 'leader', 'casualty')
verbose_name = 'Internal_conflict'
verbose_name_plural = 'Internal_conflicts'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('internal_conflict-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -632,6 +963,9 @@ def __str__(self) -> str:
class External_conflict_side(SeshatCommon):
+ """
+ Model representing an external conflict side.
+ """
name = models.CharField(max_length=100, default="External_conflict_side")
conflict_id = models.ForeignKey(External_conflict, on_delete=models.SET_NULL, null=True, related_name="External_conflicts")
expenditure = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
@@ -639,18 +973,59 @@ class External_conflict_side(SeshatCommon):
casualty = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'conflict_id', 'expenditure', 'leader', 'casualty')
verbose_name = 'External_conflict_side'
verbose_name_plural = 'External_conflict_sides'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('external_conflict_side-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -658,22 +1033,66 @@ def __str__(self) -> str:
class Agricultural_population(SeshatCommon):
+ """
+ Model representing an agricultural population.
+ """
name = models.CharField(max_length=100, default="Agricultural_population")
agricultural_population = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'agricultural_population')
verbose_name = 'Agricultural_population'
verbose_name_plural = 'Agricultural_populations'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('agricultural_population-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -681,22 +1100,66 @@ def __str__(self) -> str:
class Arable_land(SeshatCommon):
+ """
+ Model representing an arable land.
+ """
name = models.CharField(max_length=100, default="Arable_land")
arable_land = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'arable_land')
verbose_name = 'Arable_land'
verbose_name_plural = 'Arable_lands'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('arable_land-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -704,22 +1167,66 @@ def __str__(self) -> str:
class Arable_land_per_farmer(SeshatCommon):
+ """
+ Model representing an arable land per farmer.
+ """
name = models.CharField(max_length=100, default="Arable_land_per_farmer")
arable_land_per_farmer = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'arable_land_per_farmer')
verbose_name = 'Arable_land_per_farmer'
verbose_name_plural = 'Arable_land_per_farmers'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('arable_land_per_farmer-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -727,22 +1234,66 @@ def __str__(self) -> str:
class Gross_grain_shared_per_agricultural_population(SeshatCommon):
+ """
+ Model representing a gross grain shared per agricultural population.
+ """
name = models.CharField(max_length=100, default="Gross_grain_shared_per_agricultural_population")
gross_grain_shared_per_agricultural_population = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'gross_grain_shared_per_agricultural_population')
verbose_name = 'Gross_grain_shared_per_agricultural_population'
verbose_name_plural = 'Gross_grain_shared_per_agricultural_populations'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gross_grain_shared_per_agricultural_population-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -750,22 +1301,66 @@ def __str__(self) -> str:
class Net_grain_shared_per_agricultural_population(SeshatCommon):
+ """
+ Model representing a net grain shared per agricultural population.
+ """
name = models.CharField(max_length=100, default="Net_grain_shared_per_agricultural_population")
net_grain_shared_per_agricultural_population = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'net_grain_shared_per_agricultural_population')
verbose_name = 'Net_grain_shared_per_agricultural_population'
verbose_name_plural = 'Net_grain_shared_per_agricultural_populations'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('net_grain_shared_per_agricultural_population-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -773,22 +1368,66 @@ def __str__(self) -> str:
class Surplus(SeshatCommon):
+ """
+ Model representing a surplus.
+ """
name = models.CharField(max_length=100, default="Surplus")
surplus = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'surplus')
verbose_name = 'Surplus'
verbose_name_plural = 'Surplus'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('surplus-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -796,23 +1435,67 @@ def __str__(self) -> str:
class Military_expense(SeshatCommon):
+ """
+ Model representing a military expense.
+ """
name = models.CharField(max_length=100, default="Military_expense")
conflict = models.CharField(max_length=500, blank=True, null=True)
expenditure = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'conflict', 'expenditure')
verbose_name = 'Military_expense'
verbose_name_plural = 'Military_expenses'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('military_expense-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -820,22 +1503,66 @@ def __str__(self) -> str:
class Silver_inflow(SeshatCommon):
+ """
+ Model representing a silver inflow.
+ """
name = models.CharField(max_length=100, default="Silver_inflow")
silver_inflow = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'silver_inflow')
verbose_name = 'Silver_inflow'
verbose_name_plural = 'Silver_inflows'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('silver_inflow-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -843,22 +1570,66 @@ def __str__(self) -> str:
class Silver_stock(SeshatCommon):
+ """
+ Model representing a silver stock.
+ """
name = models.CharField(max_length=100, default="Silver_stock")
silver_stock = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'silver_stock')
verbose_name = 'Silver_stock'
verbose_name_plural = 'Silver_stocks'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('silver_stock-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -866,22 +1637,66 @@ def __str__(self) -> str:
class Total_population(SeshatCommon):
+ """
+ Model representing a total population.
+ """
name = models.CharField(max_length=100, default="Total_population")
total_population = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'total_population')
verbose_name = 'Total_population'
verbose_name_plural = 'Total_populations'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('total_population-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -889,22 +1704,66 @@ def __str__(self) -> str:
class Gdp_per_capita(SeshatCommon):
+ """
+ Model representing a GDP value per capita.
+ """
name = models.CharField(max_length=100, default="Gdp_per_capita")
- gdp_per_capita = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
+ gdp_per_capita = models.DecimalField(max_digits=25, decimal_places=10, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'gdp_per_capita')
verbose_name = 'Gdp_per_capita'
verbose_name_plural = 'Gdp_per_capitas'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gdp_per_capita-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -912,22 +1771,66 @@ def __str__(self) -> str:
class Drought_event(SeshatCommon):
+ """
+ Model representing a drought event.
+ """
name = models.CharField(max_length=100, default="Drought_event")
drought_event = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'drought_event')
verbose_name = 'Drought_event'
verbose_name_plural = 'Drought_events'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('drought_event-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -935,22 +1838,66 @@ def __str__(self) -> str:
class Locust_event(SeshatCommon):
+ """
+ Model representing a locust event.
+ """
name = models.CharField(max_length=100, default="Locust_event")
locust_event = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'locust_event')
verbose_name = 'Locust_event'
verbose_name_plural = 'Locust_events'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('locust_event-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -958,22 +1905,66 @@ def __str__(self) -> str:
class Socioeconomic_turmoil_event(SeshatCommon):
+ """
+ Model representing a socioeconomic turmoil event.
+ """
name = models.CharField(max_length=100, default="Socioeconomic_turmoil_event")
socioeconomic_turmoil_event = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'socioeconomic_turmoil_event')
verbose_name = 'Socioeconomic_turmoil_event'
verbose_name_plural = 'Socioeconomic_turmoil_events'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('socioeconomic_turmoil_event-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -981,22 +1972,66 @@ def __str__(self) -> str:
class Crop_failure_event(SeshatCommon):
+ """
+ Model representing a crop failure event.
+ """
name = models.CharField(max_length=100, default="Crop_failure_event")
crop_failure_event = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'crop_failure_event')
verbose_name = 'Crop_failure_event'
verbose_name_plural = 'Crop_failure_events'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('crop_failure_event-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1004,22 +2039,66 @@ def __str__(self) -> str:
class Famine_event(SeshatCommon):
+ """
+ Model representing a famine event.
+ """
name = models.CharField(max_length=100, default="Famine_event")
famine_event = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'famine_event')
verbose_name = 'Famine_event'
verbose_name_plural = 'Famine_events'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('famine_event-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1027,6 +2106,9 @@ def __str__(self) -> str:
class Disease_outbreak(SeshatCommon):
+ """
+ Model representing a disease outbreak.
+ """
name = models.CharField(max_length=100, default="Disease_outbreak")
longitude = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
latitude = models.DecimalField(max_digits= 25, decimal_places = 10, blank=True, null=True)
@@ -1036,18 +2118,59 @@ class Disease_outbreak(SeshatCommon):
duration = models.CharField(max_length=500, choices=DURATION_DISEASE_OUTBREAK_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
# unique_together = ('polity', 'year_from', 'year_to', 'tag', 'longitude', 'latitude', 'elevation', 'sub_category', 'magnitude', 'duration')
verbose_name = 'Disease_outbreak'
verbose_name_plural = 'Disease_outbreaks'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('disease_outbreak-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/crisisdb/urls.py b/seshat/apps/crisisdb/urls.py
index 5aaca6d51..290cff930 100644
--- a/seshat/apps/crisisdb/urls.py
+++ b/seshat/apps/crisisdb/urls.py
@@ -46,6 +46,11 @@
for model_class, x_name in model_form_pairs:
+ """
+ Programmatically create the following URL patterns for each model:
+ - /model_name//confirm-delete
+ - /model_name//delete/
+ """
urlpatterns.append(
path(f'{x_name}//confirm-delete/', confirm_delete_view, {
'model_class': model_class,
diff --git a/seshat/apps/crisisdb/views.py b/seshat/apps/crisisdb/views.py
index 0bbb4f2f8..ada8aeda9 100644
--- a/seshat/apps/crisisdb/views.py
+++ b/seshat/apps/crisisdb/views.py
@@ -60,6 +60,15 @@ def remove_html_tags(text):
def get_citations_dropdown(request):
+ """
+ Get all citations as JSON.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ JsonResponse: JSON response with all citations for dropdown
+ """
# get dropdown data here
all_data = Citation.objects.all()
data = all_data #{'citations': all_data}
@@ -81,6 +90,12 @@ def get_citations_dropdown(request):
return JsonResponse({'data': citations_list})
class Crisis_consequenceCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Crisis_consequence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
form_class = Crisis_consequenceForm
success_url = reverse_lazy("crisis_consequences_all")
@@ -88,12 +103,36 @@ class Crisis_consequenceCreate(PermissionRequiredMixin, PolityIdMixin, CreateVie
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#crisis_case_var'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crisis_consequence-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
context = super().get_context_data(**kwargs)
context["mysection"] = "X"
@@ -106,6 +145,12 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Crisis_consequence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
success_url = reverse_lazy('crisis_consequences_all')
form_class = Crisis_consequenceForm
@@ -113,10 +158,27 @@ class Crisis_consequenceUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#crisis_case_var'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Z"
context["mytitle"] = "Update the crisis case below:"
@@ -126,6 +188,13 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceCreateHeavy(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Crisis_consequence instance.
+
+ Note:
+ This view is for creating a new Crisis_consequence instance with a heavy form.
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
form_class = Crisis_consequenceForm
success_url = reverse_lazy("crisis_consequences_all")
@@ -133,12 +202,36 @@ class Crisis_consequenceCreateHeavy(PermissionRequiredMixin, CreateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#crisis_case_var'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crisis_consequence-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
context = super().get_context_data(**kwargs)
context["mysection"] = "X"
@@ -150,6 +243,13 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceUpdateHeavy(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Crisis_consequence instance.
+
+ Note:
+ This view is for updating an existing Crisis_consequence instance with a heavy form.
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
success_url = reverse_lazy('crisis_consequences_all')
form_class = Crisis_consequenceForm
@@ -157,10 +257,27 @@ class Crisis_consequenceUpdateHeavy(PermissionRequiredMixin, UpdateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#crisis_case_var'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Z"
context["mytitle"] = "Update the crisis case below:"
@@ -169,12 +286,24 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Crisis_consequence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
success_url = reverse_lazy('crisis_consequences_all')
template_name = "core/delete_general.html"
permission_required = 'core.add_capital'
class Crisis_consequenceListView(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Crisis_consequence instances.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
template_name = "crisisdb/crisis_consequence/crisis_consequence_list.html"
permission_required = 'core.add_capital'
@@ -182,9 +311,21 @@ class Crisis_consequenceListView(PermissionRequiredMixin, generic.ListView):
#paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crisis_consequences')
-
+
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
order = self.request.GET.get('orderby', 'home_nga')
order2 = self.request.GET.get('orderby2', 'year_from')
@@ -196,8 +337,19 @@ def get_queryset(self):
).order_by(order, order2)
return new_context
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["fields"] = ['decline', 'collapse', 'epidemic', 'downward_mobility', 'extermination', 'uprising', 'revolution', 'successful_revolution', 'civil_war', 'century_plus', 'fragmentation', 'capital', 'conquest', 'assassination', 'depose', 'constitution', 'labor', 'unfree_labor', 'suffrage', 'public_goods', 'religion']
@@ -213,6 +365,12 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceListViewAll(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Crisis_consequence instances.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
template_name = "crisisdb/crisis_consequence/crisis_consequence_list_all.html"
permission_required = 'core.add_capital'
@@ -220,9 +378,21 @@ class Crisis_consequenceListViewAll(PermissionRequiredMixin, generic.ListView):
#paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crisis_consequences_all')
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
#order = self.request.GET.get('orderby', 'year_from')
order = self.request.GET.get('orderby', 'home_nga')
order2 = self.request.GET.get('orderby2', 'year_from')
@@ -239,6 +409,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "uu"
context["var_main_desc"] = "xx"
@@ -253,6 +434,12 @@ def get_context_data(self, **kwargs):
return context
class Crisis_consequenceDetailView(PermissionRequiredMixin, generic.DetailView):
+ """
+ View for displaying a single Crisis_consequence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crisis_consequence
template_name = "crisisdb/crisis_consequence/crisis_consequence_detail.html"
permission_required = 'core.add_capital'
@@ -260,6 +447,18 @@ class Crisis_consequenceDetailView(PermissionRequiredMixin, generic.DetailView):
@permission_required('core.view_capital')
def crisis_consequence_download(request):
+ """
+ Download all Crisis_consequence instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Crisis_consequence.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -298,6 +497,18 @@ def crisis_consequence_download(request):
@permission_required('core.view_capital')
def crisis_consequence_meta_download(request):
+ """
+ Download the metadata for Crisis_consequence instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="crisis_consequences_metadata.csv"'
@@ -318,6 +529,12 @@ def crisis_consequence_meta_download(request):
################################################
class Power_transitionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Power_transition instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
form_class = Power_transitionForm
success_url = reverse_lazy("power_transitions_all")
@@ -325,12 +542,36 @@ class Power_transitionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView)
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#power_transition_var'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('power_transition-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
context = super().get_context_data(**kwargs)
context["mysection"] = "X"
@@ -342,6 +583,12 @@ def get_context_data(self, **kwargs):
return context
class Power_transitionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Power_transition instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
success_url = reverse_lazy('power_transitions_all')
form_class = Power_transitionForm
@@ -349,10 +596,27 @@ class Power_transitionUpdate(PermissionRequiredMixin, UpdateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#power_transition_var'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Z"
context["mytitle"] = "Update the power transition below:"
@@ -361,6 +625,13 @@ def get_context_data(self, **kwargs):
return context
class Power_transitionCreateHeavy(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Power_transition instance.
+
+ Note:
+ This view is for creating a new Power_transition instance with a heavy form.
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
form_class = Power_transitionForm
success_url = reverse_lazy("power_transitions_all")
@@ -368,12 +639,36 @@ class Power_transitionCreateHeavy(PermissionRequiredMixin, CreateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#power_transition_var'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('power_transition-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
context = super().get_context_data(**kwargs)
context["mysection"] = "X"
@@ -385,6 +680,13 @@ def get_context_data(self, **kwargs):
return context
class Power_transitionUpdateHeavy(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Power_transition instance.
+
+ Note:
+ This view is for updating an existing Power_transition instance with a heavy form.
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
success_url = reverse_lazy('power_transitions_all')
form_class = Power_transitionForm
@@ -392,10 +694,27 @@ class Power_transitionUpdateHeavy(PermissionRequiredMixin, UpdateView):
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#power_transition_var'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Z"
context["mytitle"] = "Update the power transition below:"
@@ -404,6 +723,12 @@ def get_context_data(self, **kwargs):
return context
class Power_transitionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Power_transition instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
success_url = reverse_lazy('power_transitions')
template_name = "core/delete_general.html"
@@ -411,6 +736,12 @@ class Power_transitionDelete(PermissionRequiredMixin, DeleteView):
class Power_transitionListView(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Power_transition instances.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
template_name = "crisisdb/power_transition/power_transition_list.html"
permission_required = 'core.add_capital'
@@ -418,9 +749,21 @@ class Power_transitionListView(PermissionRequiredMixin, generic.ListView):
paginate_by = 500
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('power_transitions')
-
+
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
order = self.request.GET.get('orderby', 'home_nga')
order2 = self.request.GET.get('orderby2', 'year_from')
@@ -431,9 +774,19 @@ def get_queryset(self):
)
).order_by(order2, order)
return new_context
-
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["fields"] = ['contested', 'overturn', 'predecessor_assassination', 'intra_elite', 'military_revolt', 'popular_uprising', 'separatist_rebellion', 'external_invasion', 'external_interference', ]
@@ -450,15 +803,33 @@ def get_context_data(self, **kwargs):
return context
class Power_transitionListViewAll(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Power_transition instances.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
template_name = "crisisdb/power_transition/power_transition_list_all_new.html"
permission_required = 'core.add_capital'
#paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('power_transitions_all')
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
order = self.request.GET.get('orderby', 'year_to')
order2 = self.request.GET.get('orderby2', 'year_from')
@@ -509,8 +880,19 @@ def get_queryset(self):
#print(grouped_dict)
return pols_dict
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "uu"
context["var_main_desc"] = "xx"
@@ -523,8 +905,14 @@ def get_context_data(self, **kwargs):
context['orderby'] = self.request.GET.get('orderby', 'year_from')
return context
-
+
class Power_transitionDetailView(PermissionRequiredMixin, generic.DetailView):
+ """
+ View for displaying a single Power_transition instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Power_transition
template_name = "crisisdb/power_transition/power_transition_detail.html"
permission_required = 'core.add_capital'
@@ -532,6 +920,18 @@ class Power_transitionDetailView(PermissionRequiredMixin, generic.DetailView):
@permission_required('core.view_capital')
def power_transition_download(request):
+ """
+ Download all Power_transition instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Power_transition.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -558,9 +958,21 @@ def power_transition_download(request):
@permission_required('core.view_capital')
def power_transition_meta_download(request):
+ """
+ Download the metadata for Power_transition instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="power_transitions_metadata.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable power_transition are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'power_transition': {'min': None, 'max': None, 'scale': 1000, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': 'mu?', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -579,18 +991,48 @@ def power_transition_meta_download(request):
##################################
class Human_sacrificeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Human_sacrifice instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Human_sacrifice
form_class = Human_sacrificeForm
template_name = "crisisdb/human_sacrifice/human_sacrifice_form.html"
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#hs_var'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('human_sacrifice-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -626,28 +1068,66 @@ def get_context_data(self, **kwargs):
return context
def form_valid(self, form):
+ """
+ Validate the form.
+
+ Args:
+ form: Form to validate
+
+ Returns:
+ HttpResponse: HTTP response
+ """
the_mother_comment = SeshatComment.objects.get(pk=1)
form.instance.comment = the_mother_comment
return super().form_valid(form)
class Human_sacrificeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Human_sacrifice instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Human_sacrifice
form_class = Human_sacrificeForm
template_name = "crisisdb/human_sacrifice/human_sacrifice_update.html"
permission_required = 'core.add_capital'
def get_success_url(self):
+ """
+ Get the URL to redirect to after successful form submission.
+
+ Returns:
+ str: URL to redirect to
+ """
polity_id = self.object.polity.id
return reverse('polity-detail-main', kwargs={'pk': polity_id}) + '#hs_var'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Human Sacrifice"
return context
class Human_sacrificeDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Human_sacrifice instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Human_sacrifice
success_url = reverse_lazy('human_sacrifices')
template_name = "core/delete_general.html"
@@ -655,15 +1135,38 @@ class Human_sacrificeDelete(PermissionRequiredMixin, DeleteView):
class Human_sacrificeListView(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Human_sacrifice instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Human_sacrifice
template_name = "crisisdb/human_sacrifice/human_sacrifice_list.html"
paginate_by = 50
permission_required = 'core.view_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('human_sacrifices')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Human Sacrifice"
context["var_main_desc"] = "The deliberate and ritualized killing of a person to please or placate supernatural entities (including gods, spirits, and ancestors) or gain other supernatural benefits."
@@ -678,6 +1181,12 @@ def get_context_data(self, **kwargs):
class Human_sacrificeListViewAll(PermissionRequiredMixin, generic.ListView):
+ """
+ View for listing all Human_sacrifice instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Human_sacrifice
template_name = "crisisdb/human_sacrifice/human_sacrifice_list_all.html"
permission_required = 'core.view_capital'
@@ -686,9 +1195,21 @@ class Human_sacrificeListViewAll(PermissionRequiredMixin, generic.ListView):
#paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('human_sacrifices_all')
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
#order = self.request.GET.get('orderby', 'year_from')
order = self.request.GET.get('orderby', 'home_nga')
order2 = self.request.GET.get('orderby2', 'year_from')
@@ -705,6 +1226,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Human Sacrifice"
context["var_main_desc"] = "The deliberate and ritualized killing of a person to please or placate supernatural entities (including gods, spirits, and ancestors) or gain other supernatural benefits."
@@ -719,6 +1251,12 @@ def get_context_data(self, **kwargs):
return context
class Human_sacrificeDetailView(PermissionRequiredMixin, generic.DetailView):
+ """
+ View for displaying a single Human_sacrifice instance.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Human_sacrifice
template_name = "crisisdb/human_sacrifice/human_sacrifice_detail.html"
permission_required = 'core.view_capital'
@@ -727,6 +1265,18 @@ class Human_sacrificeDetailView(PermissionRequiredMixin, generic.DetailView):
@permission_required('core.view_capital')
def human_sacrifice_download(request):
+ """
+ Download all Human_sacrifice instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Human_sacrifice.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -749,6 +1299,20 @@ def human_sacrifice_download(request):
@login_required
def create_a_comment_with_a_subcomment(request, hs_instance_id):
+ """
+ Create a new comment instance with a subcomment and save them to the database.
+
+ Note:
+ This view is only accessible to authenticated users.
+
+ Args:
+ request: HttpRequest object
+ hs_instance_id: ID of the Human_sacrifice instance
+
+ Returns:
+ HttpResponse: HTTP response
+ """
+
"""
Upon calling this function, I want to create a subcomment and assign it to a comment and then assign the comment to the model_name with id=hs_instance_id.
"""
@@ -780,9 +1344,21 @@ def create_a_comment_with_a_subcomment(request, hs_instance_id):
@permission_required('core.view_capital')
def human_sacrifice_meta_download(request):
+ """
+ Download the metadata for Human_sacrifice instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="human_sacrifices.csv"'
-
+
my_meta_data_dic = {'notes': 'This is a new model definition for Human Sacrifice', 'main_desc': 'The deliberate and ritualized killing of a person to please or placate supernatural entities (including gods, spirits, and ancestors) or gain other supernatural benefits.', 'main_desc_source': 'The deliberate and ritualized killing of a person to please or placate supernatural entities (including gods, spirits, and ancestors) or gain other supernatural benefits.', 'section': 'Conflict Variables', 'subsection': 'External Conflicts Subsection', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'human_sacrifice': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The Human Sacrifce', 'units': None, 'choices': ['U', 'A;P', 'P*', 'P', 'A~P', 'A', 'A*', 'P~A']}}
writer = csv.writer(response, delimiter='|')
@@ -798,17 +1374,39 @@ def human_sacrifice_meta_download(request):
return response
-
-
class External_conflictCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new External_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict
form_class = External_conflictForm
template_name = "crisisdb/external_conflict/external_conflict_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('external_conflict-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -845,18 +1443,41 @@ def get_context_data(self, **kwargs):
class External_conflictUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing External_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict
form_class = External_conflictForm
template_name = "crisisdb/external_conflict/external_conflict_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "External Conflict"
return context
class External_conflictDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing External_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict
success_url = reverse_lazy('external_conflicts')
template_name = "core/delete_general.html"
@@ -864,14 +1485,34 @@ class External_conflictDelete(PermissionRequiredMixin, DeleteView):
class External_conflictListView(generic.ListView):
+ """
+ View for listing all External_conflict instances.
+ """
model = External_conflict
template_name = "crisisdb/external_conflict/external_conflict_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('external_conflicts')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "External Conflict"
context["var_main_desc"] = "Main descriptions for the variable external Conflict are missing!"
@@ -885,12 +1526,27 @@ def get_context_data(self, **kwargs):
return context
class External_conflictDetailView(generic.DetailView):
+ """
+ View for displaying a single External_conflict instance.
+ """
model = External_conflict
template_name = "crisisdb/external_conflict/external_conflict_detail.html"
@permission_required('core.view_capital')
def external_conflict_download(request):
+ """
+ Download all External_conflict instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = External_conflict.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -908,9 +1564,21 @@ def external_conflict_download(request):
@permission_required('core.view_capital')
def external_conflict_meta_download(request):
+ """
+ Download the metadata for External_conflict instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="external_conflicts.csv"'
-
+
my_meta_data_dic = {'notes': 'This is a new model definition for External conflicts', 'main_desc': 'Main Descriptions for the Variable external_conflict are missing!', 'main_desc_source': 'Main Descriptions for the Variable external_conflict are missing!', 'section': 'Conflict Variables', 'subsection': 'External Conflicts Subsection', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'conflict_name': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The unique name of this external conflict', 'units': None, 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -926,17 +1594,40 @@ def external_conflict_meta_download(request):
return response
-
class Internal_conflictCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Internal_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Internal_conflict
form_class = Internal_conflictForm
template_name = "crisisdb/internal_conflict/internal_conflict_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('internal_conflict-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -971,35 +1662,76 @@ def get_context_data(self, **kwargs):
context["my_exp"] = my_exp
return context
-
class Internal_conflictUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Internal_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Internal_conflict
form_class = Internal_conflictForm
template_name = "crisisdb/internal_conflict/internal_conflict_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Internal Conflict"
return context
class Internal_conflictDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Internal_conflict instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Internal_conflict
success_url = reverse_lazy('internal_conflicts')
template_name = "core/delete_general.html"
permission_required = 'core.add_capital'
-
class Internal_conflictListView(generic.ListView):
+ """
+ View for listing all Internal_conflict instances.
+ """
model = Internal_conflict
template_name = "crisisdb/internal_conflict/internal_conflict_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('internal_conflicts')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Internal Conflict"
context["var_main_desc"] = "Main descriptions for the variable internal Conflict are missing!"
@@ -1011,14 +1743,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Internal_conflictDetailView(generic.DetailView):
+ """
+ View for displaying a single Internal_conflict instance.
+ """
model = Internal_conflict
template_name = "crisisdb/internal_conflict/internal_conflict_detail.html"
@permission_required('core.view_capital')
def internal_conflict_download(request):
+ """
+ Download all Internal_conflict instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Internal_conflict.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1036,9 +1783,21 @@ def internal_conflict_download(request):
@permission_required('core.view_capital')
def internal_conflict_meta_download(request):
+ """
+ Download the metadata for Internal_conflict instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="internal_conflicts.csv"'
-
+
my_meta_data_dic = {'notes': 'This is a new model definition for internal conflicts', 'main_desc': 'Main Descriptions for the Variable internal_conflict are missing!', 'main_desc_source': 'Main Descriptions for the Variable internal_conflict are missing!', 'section': 'Conflict Variables', 'subsection': 'Internal Conflicts Subsection', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'conflict': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The name of the conflict', 'units': None, 'choices': None}, 'expenditure': {'min': None, 'max': None, 'scale': 1000000, 'var_exp_source': None, 'var_exp': 'The military expenses in millions silver taels.', 'units': 'silver taels', 'choices': None}, 'leader': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The leader of the conflict', 'units': None, 'choices': None}, 'casualty': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'The number of people who died in this conflict.', 'units': 'People', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1054,17 +1813,39 @@ def internal_conflict_meta_download(request):
return response
-
-
class External_conflict_sideCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new External_conflict_side instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict_side
form_class = External_conflict_sideForm
template_name = "crisisdb/external_conflict_side/external_conflict_side_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('external_conflict_side-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1101,18 +1882,41 @@ def get_context_data(self, **kwargs):
class External_conflict_sideUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing External_conflict_side instance (side).
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict_side
form_class = External_conflict_sideForm
template_name = "crisisdb/external_conflict_side/external_conflict_side_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "External Conflict Side"
return context
class External_conflict_sideDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing External_conflict_side instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = External_conflict_side
success_url = reverse_lazy('external_conflict_sides')
template_name = "core/delete_general.html"
@@ -1120,14 +1924,34 @@ class External_conflict_sideDelete(PermissionRequiredMixin, DeleteView):
class External_conflict_sideListView(generic.ListView):
+ """
+ View for listing all External_conflict_side instances.
+ """
model = External_conflict_side
template_name = "crisisdb/external_conflict_side/external_conflict_side_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('external_conflict_sides')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "External Conflict Side"
context["var_main_desc"] = "Main descriptions for the variable external Conflict Side are missing!"
@@ -1139,14 +1963,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class External_conflict_sideDetailView(generic.DetailView):
+ """
+ View for displaying a single External_conflict_side instance.
+ """
model = External_conflict_side
template_name = "crisisdb/external_conflict_side/external_conflict_side_detail.html"
@permission_required('core.view_capital')
def external_conflict_side_download(request):
+ """
+ Download all External_conflict_side instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = External_conflict_side.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1164,9 +2003,21 @@ def external_conflict_side_download(request):
@permission_required('core.view_capital')
def external_conflict_side_meta_download(request):
+ """
+ Download the metadata for External_conflict_side instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="external_conflict_sides.csv"'
-
+
my_meta_data_dic = {'notes': 'This is a new model definition for External conflict sides', 'main_desc': 'Main Descriptions for the Variable external_conflict_side are missing!', 'main_desc_source': 'Main Descriptions for the Variable external_conflict_side are missing!', 'section': 'Conflict Variables', 'subsection': 'External Conflicts Subsection', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'conflict_id': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The external_conflict which is the actual conflict we are talking about', 'units': None, 'choices': None}, 'expenditure': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'The military expenses (from this side) in silver taels.', 'units': 'silver taels', 'choices': None}, 'leader': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The leader of this side of conflict', 'units': None, 'choices': None}, 'casualty': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'The number of people who died (from this side) in this conflict.', 'units': 'People', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1182,17 +2033,39 @@ def external_conflict_side_meta_download(request):
return response
-
-
class Agricultural_populationCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Agricultural_population
form_class = Agricultural_populationForm
template_name = "crisisdb/agricultural_population/agricultural_population_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('agricultural_population-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1227,20 +2100,42 @@ def get_context_data(self, **kwargs):
context["my_exp"] = my_exp
return context
-
class Agricultural_populationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Agricultural_population
form_class = Agricultural_populationForm
template_name = "crisisdb/agricultural_population/agricultural_population_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Agricultural Population"
return context
class Agricultural_populationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Agricultural_population
success_url = reverse_lazy('agricultural_populations')
template_name = "core/delete_general.html"
@@ -1248,14 +2143,34 @@ class Agricultural_populationDelete(PermissionRequiredMixin, DeleteView):
class Agricultural_populationListView(generic.ListView):
+ """
+ View for listing all Agricultural_population instances.
+ """
model = Agricultural_population
template_name = "crisisdb/agricultural_population/agricultural_population_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('agricultural_populations')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Agricultural Population"
context["var_main_desc"] = "No explanations."
@@ -1267,14 +2182,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Agricultural_populationDetailView(generic.DetailView):
+ """
+ View for displaying a single Agricultural_population instance.
+ """
model = Agricultural_population
template_name = "crisisdb/agricultural_population/agricultural_population_detail.html"
@permission_required('core.view_capital')
def agricultural_population_download(request):
+ """
+ Download all Agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Agricultural_population.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1292,9 +2222,18 @@ def agricultural_population_download(request):
@permission_required('core.view_capital')
def agricultural_population_meta_download(request):
+ """
+ Download the metadata for Agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="agricultural_populations.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable agricultural_population are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'agricultural_population': {'min': 0, 'max': None, 'scale': 1000, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': 'People', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1310,17 +2249,40 @@ def agricultural_population_meta_download(request):
return response
-
class Arable_landCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Arable_land instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land
form_class = Arable_landForm
template_name = "crisisdb/arable_land/arable_land_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('arable_land-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1355,20 +2317,42 @@ def get_context_data(self, **kwargs):
context["my_exp"] = my_exp
return context
-
class Arable_landUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Arable_land instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land
form_class = Arable_landForm
template_name = "crisisdb/arable_land/arable_land_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Arable Land"
return context
class Arable_landDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Arable_land instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land
success_url = reverse_lazy('arable_lands')
template_name = "core/delete_general.html"
@@ -1376,14 +2360,34 @@ class Arable_landDelete(PermissionRequiredMixin, DeleteView):
class Arable_landListView(generic.ListView):
+ """
+ View for listing all Arable_land instances.
+ """
model = Arable_land
template_name = "crisisdb/arable_land/arable_land_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('arable_lands')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Arable Land"
context["var_main_desc"] = "No explanations."
@@ -1395,14 +2399,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Arable_landDetailView(generic.DetailView):
+ """
+ View for displaying a single Arable_land instance.
+ """
model = Arable_land
template_name = "crisisdb/arable_land/arable_land_detail.html"
@permission_required('core.view_capital')
def arable_land_download(request):
+ """
+ Download all Arable_land instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Arable_land.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1420,9 +2439,21 @@ def arable_land_download(request):
@permission_required('core.view_capital')
def arable_land_meta_download(request):
+ """
+ Download the metadata for Arable_land instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="arable_lands.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable arable_land are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'arable_land': {'min': None, 'max': None, 'scale': 1000, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': 'mu?', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1438,17 +2469,40 @@ def arable_land_meta_download(request):
return response
-
class Arable_land_per_farmerCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Arable_land_per_farmer instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land_per_farmer
form_class = Arable_land_per_farmerForm
template_name = "crisisdb/arable_land_per_farmer/arable_land_per_farmer_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('arable_land_per_farmer-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1485,18 +2539,41 @@ def get_context_data(self, **kwargs):
class Arable_land_per_farmerUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Arable_land_per_farmer instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land_per_farmer
form_class = Arable_land_per_farmerForm
template_name = "crisisdb/arable_land_per_farmer/arable_land_per_farmer_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Arable Land Per Farmer"
return context
class Arable_land_per_farmerDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Arable_land_per_farmer instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Arable_land_per_farmer
success_url = reverse_lazy('arable_land_per_farmers')
template_name = "core/delete_general.html"
@@ -1504,14 +2581,34 @@ class Arable_land_per_farmerDelete(PermissionRequiredMixin, DeleteView):
class Arable_land_per_farmerListView(generic.ListView):
+ """
+ View for listing all Arable_land_per_farmer instances.
+ """
model = Arable_land_per_farmer
template_name = "crisisdb/arable_land_per_farmer/arable_land_per_farmer_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('arable_land_per_farmers')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Arable Land Per Farmer"
context["var_main_desc"] = "No explanations."
@@ -1523,14 +2620,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Arable_land_per_farmerDetailView(generic.DetailView):
+ """
+ View for displaying a single Arable_land_per_farmer instance.
+ """
model = Arable_land_per_farmer
template_name = "crisisdb/arable_land_per_farmer/arable_land_per_farmer_detail.html"
@permission_required('core.view_capital')
def arable_land_per_farmer_download(request):
+ """
+ Download all Arable_land_per_farmer instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Arable_land_per_farmer.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1548,6 +2660,18 @@ def arable_land_per_farmer_download(request):
@permission_required('core.view_capital')
def arable_land_per_farmer_meta_download(request):
+ """
+ Download the metadata for Arable_land_per_farmer instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="arable_land_per_farmers.csv"'
@@ -1566,17 +2690,40 @@ def arable_land_per_farmer_meta_download(request):
return response
-
class Gross_grain_shared_per_agricultural_populationCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Gross_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gross_grain_shared_per_agricultural_population
form_class = Gross_grain_shared_per_agricultural_populationForm
template_name = "crisisdb/gross_grain_shared_per_agricultural_population/gross_grain_shared_per_agricultural_population_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('gross_grain_shared_per_agricultural_population-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1613,33 +2760,75 @@ def get_context_data(self, **kwargs):
class Gross_grain_shared_per_agricultural_populationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Gross_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gross_grain_shared_per_agricultural_population
form_class = Gross_grain_shared_per_agricultural_populationForm
template_name = "crisisdb/gross_grain_shared_per_agricultural_population/gross_grain_shared_per_agricultural_population_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Gross Grain Shared Per Agricultural Population"
return context
class Gross_grain_shared_per_agricultural_populationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Gross_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gross_grain_shared_per_agricultural_population
success_url = reverse_lazy('gross_grain_shared_per_agricultural_populations')
template_name = "core/delete_general.html"
permission_required = 'core.add_capital'
-
class Gross_grain_shared_per_agricultural_populationListView(generic.ListView):
+ """
+ View for listing all Gross_grain_shared_per_agricultural_population instances.
+ """
model = Gross_grain_shared_per_agricultural_population
template_name = "crisisdb/gross_grain_shared_per_agricultural_population/gross_grain_shared_per_agricultural_population_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('gross_grain_shared_per_agricultural_populations')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Gross Grain Shared Per Agricultural Population"
context["var_main_desc"] = "No explanations."
@@ -1651,14 +2840,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Gross_grain_shared_per_agricultural_populationDetailView(generic.DetailView):
+ """
+ View for displaying a single Gross_grain_shared_per_agricultural_population instance.
+ """
model = Gross_grain_shared_per_agricultural_population
template_name = "crisisdb/gross_grain_shared_per_agricultural_population/gross_grain_shared_per_agricultural_population_detail.html"
@permission_required('core.view_capital')
def gross_grain_shared_per_agricultural_population_download(request):
+ """
+ Download all Gross_grain_shared_per_agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Gross_grain_shared_per_agricultural_population.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1676,9 +2880,21 @@ def gross_grain_shared_per_agricultural_population_download(request):
@permission_required('core.view_capital')
def gross_grain_shared_per_agricultural_population_meta_download(request):
+ """
+ Download the metadata for Gross_grain_shared_per_agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="gross_grain_shared_per_agricultural_populations.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable gross_grain_shared_per_agricultural_population are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'gross_grain_shared_per_agricultural_population': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': '(catties per capita)', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1694,17 +2910,40 @@ def gross_grain_shared_per_agricultural_population_meta_download(request):
return response
-
class Net_grain_shared_per_agricultural_populationCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Net_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Net_grain_shared_per_agricultural_population
form_class = Net_grain_shared_per_agricultural_populationForm
template_name = "crisisdb/net_grain_shared_per_agricultural_population/net_grain_shared_per_agricultural_population_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('net_grain_shared_per_agricultural_population-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1741,18 +2980,41 @@ def get_context_data(self, **kwargs):
class Net_grain_shared_per_agricultural_populationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Net_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Net_grain_shared_per_agricultural_population
form_class = Net_grain_shared_per_agricultural_populationForm
template_name = "crisisdb/net_grain_shared_per_agricultural_population/net_grain_shared_per_agricultural_population_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Net Grain Shared Per Agricultural Population"
return context
class Net_grain_shared_per_agricultural_populationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Net_grain_shared_per_agricultural_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Net_grain_shared_per_agricultural_population
success_url = reverse_lazy('net_grain_shared_per_agricultural_populations')
template_name = "core/delete_general.html"
@@ -1760,14 +3022,37 @@ class Net_grain_shared_per_agricultural_populationDelete(PermissionRequiredMixin
class Net_grain_shared_per_agricultural_populationListView(generic.ListView):
+ """
+ View for listing all Net_grain_shared_per_agricultural_population instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Net_grain_shared_per_agricultural_population
template_name = "crisisdb/net_grain_shared_per_agricultural_population/net_grain_shared_per_agricultural_population_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('net_grain_shared_per_agricultural_populations')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Net Grain Shared Per Agricultural Population"
context["var_main_desc"] = "No explanations."
@@ -1779,14 +3064,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Net_grain_shared_per_agricultural_populationDetailView(generic.DetailView):
+ """
+ View for displaying a single Net_grain_shared_per_agricultural_population instance.
+ """
model = Net_grain_shared_per_agricultural_population
template_name = "crisisdb/net_grain_shared_per_agricultural_population/net_grain_shared_per_agricultural_population_detail.html"
@permission_required('core.view_capital')
def net_grain_shared_per_agricultural_population_download(request):
+ """
+ Download all Net_grain_shared_per_agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Net_grain_shared_per_agricultural_population.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1804,9 +3104,15 @@ def net_grain_shared_per_agricultural_population_download(request):
@permission_required('core.view_capital')
def net_grain_shared_per_agricultural_population_meta_download(request):
+ """
+ Download the metadata for Net_grain_shared_per_agricultural_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="net_grain_shared_per_agricultural_populations.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable net_grain_shared_per_agricultural_population are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'net_grain_shared_per_agricultural_population': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': '(catties per capita)', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1822,17 +3128,40 @@ def net_grain_shared_per_agricultural_population_meta_download(request):
return response
-
class SurplusCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Surplus instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Surplus
form_class = SurplusForm
template_name = "crisisdb/surplus/surplus_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('surplus-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1869,18 +3198,41 @@ def get_context_data(self, **kwargs):
class SurplusUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Surplus instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Surplus
form_class = SurplusForm
template_name = "crisisdb/surplus/surplus_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Surplus"
return context
class SurplusDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Surplus instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Surplus
success_url = reverse_lazy('surplus')
template_name = "core/delete_general.html"
@@ -1888,14 +3240,34 @@ class SurplusDelete(PermissionRequiredMixin, DeleteView):
class SurplusListView(generic.ListView):
+ """
+ View for listing all Surplus instances.
+ """
model = Surplus
template_name = "crisisdb/surplus/surplus_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('surplus')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Surplus"
context["var_main_desc"] = "No explanations."
@@ -1909,12 +3281,27 @@ def get_context_data(self, **kwargs):
return context
class SurplusDetailView(generic.DetailView):
+ """
+ View for displaying a single Surplus instance.
+ """
model = Surplus
template_name = "crisisdb/surplus/surplus_detail.html"
@permission_required('core.view_capital')
def surplus_download(request):
+ """
+ Download all Surplus instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Surplus.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1932,9 +3319,21 @@ def surplus_download(request):
@permission_required('core.view_capital')
def surplus_meta_download(request):
+ """
+ Download the metadata for Surplus instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="surplus.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable surplus are missing!', 'main_desc': 'No Explanations.', 'main_desc_source': 'No Explanations.', 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'surplus': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'No Explanations.', 'units': '(catties per capita)', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -1950,17 +3349,39 @@ def surplus_meta_download(request):
return response
-
-
class Military_expenseCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Military_expense instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Military_expense
form_class = Military_expenseForm
template_name = "crisisdb/military_expense/military_expense_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('military_expense-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -1997,18 +3418,41 @@ def get_context_data(self, **kwargs):
class Military_expenseUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Military_expense instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Military_expense
form_class = Military_expenseForm
template_name = "crisisdb/military_expense/military_expense_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Military Expense"
return context
class Military_expenseDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Military_expense instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Military_expense
success_url = reverse_lazy('military_expenses')
template_name = "core/delete_general.html"
@@ -2016,14 +3460,34 @@ class Military_expenseDelete(PermissionRequiredMixin, DeleteView):
class Military_expenseListView(generic.ListView):
+ """
+ View for listing all Military_expense instances.
+ """
model = Military_expense
template_name = "crisisdb/military_expense/military_expense_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('military_expenses')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Military Expense"
context["var_main_desc"] = "Main descriptions for the variable military Expense are missing!"
@@ -2035,14 +3499,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Military_expenseDetailView(generic.DetailView):
+ """
+ View for displaying a single Military_expense instance.
+ """
model = Military_expense
template_name = "crisisdb/military_expense/military_expense_detail.html"
@permission_required('core.view_capital')
def military_expense_download(request):
+ """
+ Download all Military_expense instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Military_expense.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2060,9 +3539,21 @@ def military_expense_download(request):
@permission_required('core.view_capital')
def military_expense_meta_download(request):
+ """
+ Download the metadata for Military_expense instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="military_expenses.csv"'
-
+
my_meta_data_dic = {'notes': 'Not sure about Section and Subsection.', 'main_desc': 'Main Descriptions for the Variable military_expense are missing!', 'main_desc_source': 'Main Descriptions for the Variable military_expense are missing!', 'section': 'Economy Variables', 'subsection': 'State Finances', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'conflict': {'min': None, 'max': None, 'scale': None, 'var_exp_source': None, 'var_exp': 'The name of the conflict', 'units': None, 'choices': None}, 'expenditure': {'min': None, 'max': None, 'scale': 1000000, 'var_exp_source': None, 'var_exp': 'The military expenses in millions silver taels.', 'units': 'silver taels', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2078,17 +3569,40 @@ def military_expense_meta_download(request):
return response
-
class Silver_inflowCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Silver_inflow instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_inflow
form_class = Silver_inflowForm
template_name = "crisisdb/silver_inflow/silver_inflow_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('silver_inflow-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2123,20 +3637,42 @@ def get_context_data(self, **kwargs):
context["my_exp"] = my_exp
return context
-
class Silver_inflowUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Silver_inflow instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_inflow
form_class = Silver_inflowForm
template_name = "crisisdb/silver_inflow/silver_inflow_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Silver Inflow"
return context
class Silver_inflowDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Silver_inflow instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_inflow
success_url = reverse_lazy('silver_inflows')
template_name = "core/delete_general.html"
@@ -2144,14 +3680,34 @@ class Silver_inflowDelete(PermissionRequiredMixin, DeleteView):
class Silver_inflowListView(generic.ListView):
+ """
+ View for listing all Silver_inflow instances.
+ """
model = Silver_inflow
template_name = "crisisdb/silver_inflow/silver_inflow_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('silver_inflows')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Silver Inflow"
context["var_main_desc"] = "Silver inflow in millions of silver taels??"
@@ -2163,14 +3719,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Silver_inflowDetailView(generic.DetailView):
+ """
+ View for displaying a single Silver_inflow instance.
+ """
model = Silver_inflow
template_name = "crisisdb/silver_inflow/silver_inflow_detail.html"
@permission_required('core.view_capital')
def silver_inflow_download(request):
+ """
+ Download all Silver_inflow instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Silver_inflow.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2188,9 +3759,21 @@ def silver_inflow_download(request):
@permission_required('core.view_capital')
def silver_inflow_meta_download(request):
+ """
+ Download the metadata for Silver_inflow instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="silver_inflows.csv"'
-
+
my_meta_data_dic = {'notes': 'Needs suoervision on the units and scale.', 'main_desc': 'Silver inflow in Millions of silver taels??', 'main_desc_source': 'Silver inflow in Millions of silver taels??', 'section': 'Economy Variables', 'subsection': 'State Finances', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'silver_inflow': {'min': None, 'max': None, 'scale': 1000000, 'var_exp_source': None, 'var_exp': 'Silver inflow in Millions of silver taels??', 'units': 'silver taels??', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2206,17 +3789,40 @@ def silver_inflow_meta_download(request):
return response
-
class Silver_stockCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Silver_stock instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_stock
form_class = Silver_stockForm
template_name = "crisisdb/silver_stock/silver_stock_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('silver_stock-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2253,18 +3859,41 @@ def get_context_data(self, **kwargs):
class Silver_stockUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Silver_stock instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_stock
form_class = Silver_stockForm
template_name = "crisisdb/silver_stock/silver_stock_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Silver Stock"
return context
class Silver_stockDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Silver_stock instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Silver_stock
success_url = reverse_lazy('silver_stocks')
template_name = "core/delete_general.html"
@@ -2272,14 +3901,34 @@ class Silver_stockDelete(PermissionRequiredMixin, DeleteView):
class Silver_stockListView(generic.ListView):
+ """
+ View for listing all Silver_stock instances.
+ """
model = Silver_stock
template_name = "crisisdb/silver_stock/silver_stock_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('silver_stocks')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Silver Stock"
context["var_main_desc"] = "Silver stock in millions of silver taels??"
@@ -2291,14 +3940,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Silver_stockDetailView(generic.DetailView):
+ """
+ View for displaying a single Silver_stock instance.
+ """
model = Silver_stock
template_name = "crisisdb/silver_stock/silver_stock_detail.html"
@permission_required('core.view_capital')
def silver_stock_download(request):
+ """
+ Download all Silver_stock instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Silver_stock.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2316,9 +3980,21 @@ def silver_stock_download(request):
@permission_required('core.view_capital')
def silver_stock_meta_download(request):
+ """
+ Download the metadata for Silver_stock instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="silver_stocks.csv"'
-
+
my_meta_data_dic = {'notes': 'Needs suoervision on the units and scale.', 'main_desc': 'Silver stock in Millions of silver taels??', 'main_desc_source': 'Silver stock in Millions of silver taels??', 'section': 'Economy Variables', 'subsection': 'State Finances', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'silver_stock': {'min': None, 'max': None, 'scale': 1000000, 'var_exp_source': None, 'var_exp': 'Silver stock in Millions of silver taels??', 'units': 'silver taels??', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2334,17 +4010,39 @@ def silver_stock_meta_download(request):
return response
-
-
class Total_populationCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Total_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Total_population
form_class = Total_populationForm
template_name = "crisisdb/total_population/total_population_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('total_population-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2381,18 +4079,41 @@ def get_context_data(self, **kwargs):
class Total_populationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Total_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Total_population
form_class = Total_populationForm
template_name = "crisisdb/total_population/total_population_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Total Population"
return context
class Total_populationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Total_population instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Total_population
success_url = reverse_lazy('total_populations')
template_name = "core/delete_general.html"
@@ -2400,14 +4121,37 @@ class Total_populationDelete(PermissionRequiredMixin, DeleteView):
class Total_populationListView(generic.ListView):
+ """
+ View for listing all Total_population instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Total_population
template_name = "crisisdb/total_population/total_population_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('total_populations')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Total Population"
context["var_main_desc"] = "Total population or simply population, of a given area is the total number of people in that area at a given time."
@@ -2419,14 +4163,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Total_populationDetailView(generic.DetailView):
+ """
+ View for displaying a single Total_population instance.
+ """
model = Total_population
template_name = "crisisdb/total_population/total_population_detail.html"
@permission_required('core.view_capital')
def total_population_download(request):
+ """
+ Download all Total_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Total_population.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2444,9 +4203,21 @@ def total_population_download(request):
@permission_required('core.view_capital')
def total_population_meta_download(request):
+ """
+ Download the metadata for Total_population instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="total_populations.csv"'
-
+
my_meta_data_dic = {'notes': 'Note that the population values are scaled.', 'main_desc': 'Total population or simply population, of a given area is the total number of people in that area at a given time.', 'main_desc_source': 'Total population or simply population, of a given area is the total number of people in that area at a given time.', 'section': 'Social Complexity Variables', 'subsection': 'Social Scale', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'total_population': {'min': 0, 'max': None, 'scale': 1000, 'var_exp_source': None, 'var_exp': 'The total population of a country (or a polity).', 'units': 'People', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2462,17 +4233,40 @@ def total_population_meta_download(request):
return response
-
class Gdp_per_capitaCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Gdp_per_capita instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gdp_per_capita
form_class = Gdp_per_capitaForm
template_name = "crisisdb/gdp_per_capita/gdp_per_capita_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('gdp_per_capita-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2509,18 +4303,41 @@ def get_context_data(self, **kwargs):
class Gdp_per_capitaUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Gdp_per_capita instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gdp_per_capita
form_class = Gdp_per_capitaForm
template_name = "crisisdb/gdp_per_capita/gdp_per_capita_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Gdp Per Capita"
return context
class Gdp_per_capitaDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Gdp_per_capita instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Gdp_per_capita
success_url = reverse_lazy('gdp_per_capitas')
template_name = "core/delete_general.html"
@@ -2528,14 +4345,37 @@ class Gdp_per_capitaDelete(PermissionRequiredMixin, DeleteView):
class Gdp_per_capitaListView(generic.ListView):
+ """
+ View for listing all Gdp_per_capita instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Gdp_per_capita
template_name = "crisisdb/gdp_per_capita/gdp_per_capita_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('gdp_per_capitas')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Gdp Per Capita"
context["var_main_desc"] = "The gross domestic product per capita, or gdp per capita, is a measure of a country's economic output that accounts for its number of people. it divides the country's gross domestic product by its total population."
@@ -2547,14 +4387,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Gdp_per_capitaDetailView(generic.DetailView):
+ """
+ View for displaying a single Gdp_per_capita instance.
+ """
model = Gdp_per_capita
template_name = "crisisdb/gdp_per_capita/gdp_per_capita_detail.html"
@permission_required('core.view_capital')
def gdp_per_capita_download(request):
+ """
+ Download all Gdp_per_capita instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Gdp_per_capita.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2572,9 +4427,21 @@ def gdp_per_capita_download(request):
@permission_required('core.view_capital')
def gdp_per_capita_meta_download(request):
+ """
+ Download the metadata for Gdp_per_capita instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="gdp_per_capitas.csv"'
-
+
my_meta_data_dic = {'notes': 'The exact year based on which the value of Dollar is taken into account is not clear.', 'main_desc': "The Gross Domestic Product per capita, or GDP per capita, is a measure of a country's economic output that accounts for its number of people. It divides the country's gross domestic product by its total population.", 'main_desc_source': "The Gross Domestic Product per capita, or GDP per capita, is a measure of a country's economic output that accounts for its number of people. It divides the country's gross domestic product by its total population.", 'section': 'Economy Variables', 'subsection': 'Productivity', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'gdp_per_capita': {'min': None, 'max': None, 'scale': 1, 'var_exp_source': 'https://www.thebalance.com/gdp-per-capita-formula-u-s-compared-to-highest-and-lowest-3305848', 'var_exp': "The Gross Domestic Product per capita, or GDP per capita, is a measure of a country's economic output that accounts for its number of people. It divides the country's gross domestic product by its total population.", 'units': 'Dollars (in 2009?)', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2590,17 +4457,39 @@ def gdp_per_capita_meta_download(request):
return response
-
-
class Drought_eventCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Drought_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Drought_event
form_class = Drought_eventForm
template_name = "crisisdb/drought_event/drought_event_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('drought_event-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2637,18 +4526,41 @@ def get_context_data(self, **kwargs):
class Drought_eventUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Drought_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Drought_event
form_class = Drought_eventForm
template_name = "crisisdb/drought_event/drought_event_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Drought Event"
return context
class Drought_eventDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Drought_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Drought_event
success_url = reverse_lazy('drought_events')
template_name = "core/delete_general.html"
@@ -2656,14 +4568,37 @@ class Drought_eventDelete(PermissionRequiredMixin, DeleteView):
class Drought_eventListView(generic.ListView):
+ """
+ View for listing all Drought_event instances.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
model = Drought_event
template_name = "crisisdb/drought_event/drought_event_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('drought_events')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Drought Event"
context["var_main_desc"] = "Number of geographic sites indicating drought"
@@ -2675,14 +4610,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Drought_eventDetailView(generic.DetailView):
+ """
+ View for displaying a single Drought_event instance.
+ """
model = Drought_event
template_name = "crisisdb/drought_event/drought_event_detail.html"
@permission_required('core.view_capital')
def drought_event_download(request):
+ """
+ Download all Drought_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Drought_event.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2700,9 +4650,21 @@ def drought_event_download(request):
@permission_required('core.view_capital')
def drought_event_meta_download(request):
+ """
+ Download the metadata for Drought_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="drought_events.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable drought_event are missing!', 'main_desc': 'number of geographic sites indicating drought', 'main_desc_source': 'number of geographic sites indicating drought', 'section': 'Well Being', 'subsection': 'Biological Well-Being', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'drought_event': {'min': 0, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'number of geographic sites indicating drought', 'units': 'Numbers', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2718,17 +4680,39 @@ def drought_event_meta_download(request):
return response
-
-
class Locust_eventCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Locust_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Locust_event
form_class = Locust_eventForm
template_name = "crisisdb/locust_event/locust_event_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('locust_event-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2765,18 +4749,41 @@ def get_context_data(self, **kwargs):
class Locust_eventUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Locust_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Locust_event
form_class = Locust_eventForm
template_name = "crisisdb/locust_event/locust_event_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Locust Event"
return context
class Locust_eventDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Locust_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Locust_event
success_url = reverse_lazy('locust_events')
template_name = "core/delete_general.html"
@@ -2784,14 +4791,34 @@ class Locust_eventDelete(PermissionRequiredMixin, DeleteView):
class Locust_eventListView(generic.ListView):
+ """
+ View for listing all Locust_event instances.
+ """
model = Locust_event
template_name = "crisisdb/locust_event/locust_event_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('locust_events')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Locust Event"
context["var_main_desc"] = "Number of geographic sites indicating locusts"
@@ -2803,14 +4830,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Locust_eventDetailView(generic.DetailView):
+ """
+ View for displaying a single Locust_event instance.
+ """
model = Locust_event
template_name = "crisisdb/locust_event/locust_event_detail.html"
@permission_required('core.view_capital')
def locust_event_download(request):
+ """
+ Download all Locust_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Locust_event.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2828,9 +4870,21 @@ def locust_event_download(request):
@permission_required('core.view_capital')
def locust_event_meta_download(request):
+ """
+ Download the metadata for Locust_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="locust_events.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable locust_event are missing!', 'main_desc': 'number of geographic sites indicating locusts', 'main_desc_source': 'number of geographic sites indicating locusts', 'section': 'Well Being', 'subsection': 'Biological Well-Being', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'locust_event': {'min': 0, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'number of geographic sites indicating locusts', 'units': 'Numbers', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2846,17 +4900,39 @@ def locust_event_meta_download(request):
return response
-
-
class Socioeconomic_turmoil_eventCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Socioeconomic_turmoil_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Socioeconomic_turmoil_event
form_class = Socioeconomic_turmoil_eventForm
template_name = "crisisdb/socioeconomic_turmoil_event/socioeconomic_turmoil_event_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('socioeconomic_turmoil_event-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -2893,18 +4969,41 @@ def get_context_data(self, **kwargs):
class Socioeconomic_turmoil_eventUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Socioeconomic_turmoil_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Socioeconomic_turmoil_event
form_class = Socioeconomic_turmoil_eventForm
template_name = "crisisdb/socioeconomic_turmoil_event/socioeconomic_turmoil_event_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Socioeconomic Turmoil Event"
return context
class Socioeconomic_turmoil_eventDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Socioeconomic_turmoil_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Socioeconomic_turmoil_event
success_url = reverse_lazy('socioeconomic_turmoil_events')
template_name = "core/delete_general.html"
@@ -2912,14 +5011,34 @@ class Socioeconomic_turmoil_eventDelete(PermissionRequiredMixin, DeleteView):
class Socioeconomic_turmoil_eventListView(generic.ListView):
+ """
+ View for listing all Socioeconomic_turmoil_event instances.
+ """
model = Socioeconomic_turmoil_event
template_name = "crisisdb/socioeconomic_turmoil_event/socioeconomic_turmoil_event_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('socioeconomic_turmoil_events')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Socioeconomic Turmoil Event"
context["var_main_desc"] = "Number of geographic sites indicating socioeconomic turmoil"
@@ -2931,14 +5050,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Socioeconomic_turmoil_eventDetailView(generic.DetailView):
+ """
+ View for displaying a single Socioeconomic_turmoil_event instance.
+ """
model = Socioeconomic_turmoil_event
template_name = "crisisdb/socioeconomic_turmoil_event/socioeconomic_turmoil_event_detail.html"
@permission_required('core.view_capital')
def socioeconomic_turmoil_event_download(request):
+ """
+ Download all Socioeconomic_turmoil_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Socioeconomic_turmoil_event.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2956,9 +5090,21 @@ def socioeconomic_turmoil_event_download(request):
@permission_required('core.view_capital')
def socioeconomic_turmoil_event_meta_download(request):
+ """
+ Download the metadata for Socioeconomic_turmoil_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="socioeconomic_turmoil_events.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable socioeconomic_turmoil_event are missing!', 'main_desc': 'number of geographic sites indicating socioeconomic turmoil', 'main_desc_source': 'number of geographic sites indicating socioeconomic turmoil', 'section': 'Well Being', 'subsection': 'Biological Well-Being', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'socioeconomic_turmoil_event': {'min': 0, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'number of geographic sites indicating socioeconomic turmoil', 'units': 'Numbers', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -2974,17 +5120,40 @@ def socioeconomic_turmoil_event_meta_download(request):
return response
-
class Crop_failure_eventCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Crop_failure_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crop_failure_event
form_class = Crop_failure_eventForm
template_name = "crisisdb/crop_failure_event/crop_failure_event_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crop_failure_event-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -3021,18 +5190,41 @@ def get_context_data(self, **kwargs):
class Crop_failure_eventUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Crop_failure_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crop_failure_event
form_class = Crop_failure_eventForm
template_name = "crisisdb/crop_failure_event/crop_failure_event_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Crop Failure Event"
return context
class Crop_failure_eventDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Crop_failure_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Crop_failure_event
success_url = reverse_lazy('crop_failure_events')
template_name = "core/delete_general.html"
@@ -3040,14 +5232,34 @@ class Crop_failure_eventDelete(PermissionRequiredMixin, DeleteView):
class Crop_failure_eventListView(generic.ListView):
+ """
+ View for listing all Crop_failure_event instances.
+ """
model = Crop_failure_event
template_name = "crisisdb/crop_failure_event/crop_failure_event_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('crop_failure_events')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Crop Failure Event"
context["var_main_desc"] = "Number of geographic sites indicating crop failure"
@@ -3059,14 +5271,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Crop_failure_eventDetailView(generic.DetailView):
+ """
+ View for displaying a single Crop_failure_event instance.
+ """
model = Crop_failure_event
template_name = "crisisdb/crop_failure_event/crop_failure_event_detail.html"
@permission_required('core.view_capital')
def crop_failure_event_download(request):
+ """
+ Download all Crop_failure_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Crop_failure_event.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3084,9 +5311,21 @@ def crop_failure_event_download(request):
@permission_required('core.view_capital')
def crop_failure_event_meta_download(request):
+ """
+ Download the metadata for Crop_failure_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="crop_failure_events.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable crop_failure_event are missing!', 'main_desc': 'number of geographic sites indicating crop failure', 'main_desc_source': 'number of geographic sites indicating crop failure', 'section': 'Well Being', 'subsection': 'Biological Well-Being', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'crop_failure_event': {'min': 0, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'number of geographic sites indicating crop failure', 'units': 'Numbers', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -3102,17 +5341,39 @@ def crop_failure_event_meta_download(request):
return response
-
-
class Famine_eventCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Famine_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Famine_event
form_class = Famine_eventForm
template_name = "crisisdb/famine_event/famine_event_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('famine_event-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -3147,20 +5408,42 @@ def get_context_data(self, **kwargs):
context["my_exp"] = my_exp
return context
-
class Famine_eventUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Famine_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Famine_event
form_class = Famine_eventForm
template_name = "crisisdb/famine_event/famine_event_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Famine Event"
return context
class Famine_eventDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Famine_event instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Famine_event
success_url = reverse_lazy('famine_events')
template_name = "core/delete_general.html"
@@ -3168,14 +5451,34 @@ class Famine_eventDelete(PermissionRequiredMixin, DeleteView):
class Famine_eventListView(generic.ListView):
+ """
+ View for listing all Famine_event instances.
+ """
model = Famine_event
template_name = "crisisdb/famine_event/famine_event_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('famine_events')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Famine Event"
context["var_main_desc"] = "Number of geographic sites indicating famine"
@@ -3187,14 +5490,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Scale', 'Units']
return context
-
+
class Famine_eventDetailView(generic.DetailView):
+ """
+ View for displaying a single Famine_event instance.
+ """
model = Famine_event
template_name = "crisisdb/famine_event/famine_event_detail.html"
@permission_required('core.view_capital')
def famine_event_download(request):
+ """
+ Download all Famine_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Famine_event.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3212,9 +5530,21 @@ def famine_event_download(request):
@permission_required('core.view_capital')
def famine_event_meta_download(request):
+ """
+ Download the metadata for Famine_event instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="famine_events.csv"'
-
+
my_meta_data_dic = {'notes': 'Notes for the Variable famine_event are missing!', 'main_desc': 'number of geographic sites indicating famine', 'main_desc_source': 'number of geographic sites indicating famine', 'section': 'Well Being', 'subsection': 'Biological Well-Being', 'null_meaning': 'The value is not available.'}
my_meta_data_dic_inner_vars = {'famine_event': {'min': 0, 'max': None, 'scale': 1, 'var_exp_source': None, 'var_exp': 'number of geographic sites indicating famine', 'units': 'Numbers', 'choices': None}}
writer = csv.writer(response, delimiter='|')
@@ -3230,17 +5560,39 @@ def famine_event_meta_download(request):
return response
-
-
class Disease_outbreakCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Disease_outbreak instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Disease_outbreak
form_class = Disease_outbreakForm
template_name = "crisisdb/disease_outbreak/disease_outbreak_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('disease_outbreak-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
# get the explanattion:
all_var_hiers = Variablehierarchy.objects.all()
if all_var_hiers:
@@ -3277,18 +5629,41 @@ def get_context_data(self, **kwargs):
class Disease_outbreakUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Disease_outbreak instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Disease_outbreak
form_class = Disease_outbreakForm
template_name = "crisisdb/disease_outbreak/disease_outbreak_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Disease Outbreak"
return context
class Disease_outbreakDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Disease_outbreak instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Disease_outbreak
success_url = reverse_lazy('disease_outbreaks')
template_name = "core/delete_general.html"
@@ -3296,14 +5671,34 @@ class Disease_outbreakDelete(PermissionRequiredMixin, DeleteView):
class Disease_outbreakListView(generic.ListView):
+ """
+ View for listing all Disease_outbreak instances.
+ """
model = Disease_outbreak
template_name = "crisisdb/disease_outbreak/disease_outbreak_list.html"
paginate_by = 50
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: Absolute URL of the view
+ """
return reverse('disease_outbreaks')
-
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data for the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments
+
+ Returns:
+ dict: Context data for the view
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Disease Outbreak"
context["var_main_desc"] = "A sudden increase in occurrences of a disease when cases are in excess of normal expectancy for the location or season."
@@ -3315,14 +5710,29 @@ def get_context_data(self, **kwargs):
context["potential_cols"] = ['Min', 'Units', 'Scale', 'Max']
return context
-
+
class Disease_outbreakDetailView(generic.DetailView):
+ """
+ View for displaying a single Disease_outbreak instance.
+ """
model = Disease_outbreak
template_name = "crisisdb/disease_outbreak/disease_outbreak_detail.html"
@permission_required('core.view_capital')
def disease_outbreak_download(request):
+ """
+ Download all Disease_outbreak instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
items = Disease_outbreak.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3340,6 +5750,18 @@ def disease_outbreak_download(request):
@permission_required('core.view_capital')
def disease_outbreak_meta_download(request):
+ """
+ Download the metadata for Disease_outbreak instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="disease_outbreaks.csv"'
@@ -3362,6 +5784,18 @@ def disease_outbreak_meta_download(request):
# THE temporary function for creating the my_sections_dic dic: test_for_varhier_dic inside utils
# and the qing_vars_links_creator() inside utils.py
def QingVars(request):
+ """
+ View for listing all Qing Variables.
+
+ Note:
+ This is a temporary view for testing the Qing variables.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ dict: Context data for the view
+ """
my_sections_dic = {
#'Other_Sections': {'Other_Subsections': []}, 'Conflict Variables': {'External Conflicts Subsection': [['External conflict', 'external_conflicts', 'external_conflict-create', 'external_conflict-download', 'external_conflict-metadownload'], ['External conflict side', 'external_conflict_sides', 'external_conflict_side-create', 'external_conflict_side-download', 'external_conflict_side-metadownload'], ['Human_sacrifice', 'human_sacrifices', 'human_sacrifice-create', 'human_sacrifice-download', 'human_sacrifice-metadownload']], 'Internal Conflicts Subsection': [['Internal conflict', 'internal_conflicts', 'internal_conflict-create', 'internal_conflict-download', 'internal_conflict-metadownload']]},
'Economy Variables': {'Productivity': [['Agricultural population', 'agricultural_populations', 'agricultural_population-create', 'agricultural_population-download', 'agricultural_population-metadownload'], ['Arable land', 'arable_lands', 'arable_land-create', 'arable_land-download', 'arable_land-metadownload'], ['Arable land per farmer', 'arable_land_per_farmers', 'arable_land_per_farmer-create', 'arable_land_per_farmer-download', 'arable_land_per_farmer-metadownload'], ['Gross grain shared per agricultural population', 'gross_grain_shared_per_agricultural_populations', 'gross_grain_shared_per_agricultural_population-create', 'gross_grain_shared_per_agricultural_population-download', 'gross_grain_shared_per_agricultural_population-metadownload'], ['Net grain shared per agricultural population', 'net_grain_shared_per_agricultural_populations', 'net_grain_shared_per_agricultural_population-create', 'net_grain_shared_per_agricultural_population-download', 'net_grain_shared_per_agricultural_population-metadownload'], ['Surplus', 'surplus', 'surplus-create', 'surplus-download', 'surplus-metadownload'], ['Gdp per capita', 'gdp_per_capitas', 'gdp_per_capita-create', 'gdp_per_capita-download', 'gdp_per_capita-metadownload']], 'State Finances': [['Military expense', 'military_expenses', 'military_expense-create', 'military_expense-download', 'military_expense-metadownload'], ['Silver inflow', 'silver_inflows', 'silver_inflow-create', 'silver_inflow-download', 'silver_inflow-metadownload'], ['Silver stock', 'silver_stocks', 'silver_stock-create', 'silver_stock-download', 'silver_stock-metadownload']]}, 'Social Complexity Variables': {'Social Scale': [['Total population', 'total_populations', 'total_population-create', 'total_population-download', 'total_population-metadownload']]}, 'Well Being': {'Biological Well-Being': [['Drought event', 'drought_events', 'drought_event-create', 'drought_event-download', 'drought_event-metadownload'], ['Locust event', 'locust_events', 'locust_event-create', 'locust_event-download', 'locust_event-metadownload'], ['Socioeconomic turmoil event', 'socioeconomic_turmoil_events', 'socioeconomic_turmoil_event-create', 'socioeconomic_turmoil_event-download', 'socioeconomic_turmoil_event-metadownload'], ['Crop failure event', 'crop_failure_events', 'crop_failure_event-create', 'crop_failure_event-download', 'crop_failure_event-metadownload'], ['Famine event', 'famine_events', 'famine_event-create', 'famine_event-download', 'famine_event-metadownload'], ['Disease outbreak', 'disease_outbreaks', 'disease_outbreak-create', 'disease_outbreak-download', 'disease_outbreak-metadownload']]}}
@@ -3432,6 +5866,15 @@ def QingVars(request):
def playground(request):
+ """
+ View for the playground.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ dict: Context data for the view
+ """
if request.method == "POST":
print(request.POST.get("selected_pols", 'Hallo'))
all_pols = list_of_all_Polities()
@@ -3450,6 +5893,15 @@ def playground(request):
}
def playgrounddownload(request):
+ """
+ Download the data from the playground.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
# read the data from the previous from
# make sure you collect all the data from seshat_api
# sort it out and spit it out
@@ -3532,18 +5984,30 @@ def playgrounddownload(request):
return final_response
-#def fpl_all(request):
-# return render(request, 'crisisdb/fpl_all.html')
+def fpl_all(request):
+ """
+ View for the Famine, Plague, and Locust page.
+ """
+ return render(request, 'crisisdb/fpl_all.html')
# ... Your existing imports ...
class UsLocationListView(ListView):
+ """
+ View for listing all Us_location instances.
+ """
model = Us_location
template_name = 'crisisdb/us_location/list.html'
context_object_name = 'us_locations'
class UsLocationCreateView(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Us_location instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_location
form_class = Us_locationForm
template_name = 'crisisdb/us_location/create.html'
@@ -3551,6 +6015,12 @@ class UsLocationCreateView(PermissionRequiredMixin, CreateView):
success_url = reverse_lazy('us_location_list')
class UsLocationUpdateView(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Us_location instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_location
form_class = Us_locationForm
template_name = 'crisisdb/us_location/update.html'
@@ -3558,11 +6028,20 @@ class UsLocationUpdateView(PermissionRequiredMixin, UpdateView):
success_url = reverse_lazy('us_location_list')
class UsViolenceSubtypeListView(ListView):
+ """
+ View for listing all Us_violence_subtype instances.
+ """
model = Us_violence_subtype
template_name = 'crisisdb/subtype/list.html'
context_object_name = 'subtypes'
class UsViolenceSubtypeCreateView(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Us_violence_subtype instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence_subtype
form_class = Us_violence_subtypeForm
template_name = 'crisisdb/subtype/create.html'
@@ -3570,6 +6049,12 @@ class UsViolenceSubtypeCreateView(PermissionRequiredMixin, CreateView):
success_url = reverse_lazy('subtype_list')
class UsViolenceSubtypeUpdateView(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Us_violence_subtype instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence_subtype
form_class = Us_violence_subtypeForm
template_name = 'crisisdb/subtype/update.html'
@@ -3577,11 +6062,20 @@ class UsViolenceSubtypeUpdateView(PermissionRequiredMixin, UpdateView):
success_url = reverse_lazy('subtype_list')
class UsViolenceDataSourceListView(ListView):
+ """
+ View for listing all Us_violence_data_source instances.
+ """
model = Us_violence_data_source
template_name = 'crisisdb/datasource/list.html'
context_object_name = 'datasources'
class UsViolenceDataSourceCreateView(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Us_violence_data_source instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence_data_source
form_class = Us_violence_data_sourceForm
template_name = 'crisisdb/datasource/create.html'
@@ -3589,6 +6083,12 @@ class UsViolenceDataSourceCreateView(PermissionRequiredMixin, CreateView):
success_url = reverse_lazy('datasource_list')
class UsViolenceDataSourceUpdateView(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Us_violence_data_source instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence_data_source
form_class = Us_violence_data_sourceForm
template_name = 'crisisdb/datasource/update.html'
@@ -3596,31 +6096,48 @@ class UsViolenceDataSourceUpdateView(PermissionRequiredMixin, UpdateView):
success_url = reverse_lazy('datasource_list')
class UsViolenceListView(ListView):
+ """
+ View for listing all Us_violence instances.
+ """
model = Us_violence
template_name = 'crisisdb/us_violence/list.html'
context_object_name = 'us_violences'
def get_queryset(self):
+ """
+ Get the queryset for the view.
+
+ Returns:
+ QuerySet: QuerySet for the view
+ """
# Get the query parameters from the request, if provided
order_by = self.request.GET.get('order_by', self.ordering)
-
+
# Check if the order_by parameter is valid
valid_ordering = ['violence_date', '-violence_date', 'violence_type', '-violence_type', 'fatalities', '-fatalities']
if order_by not in valid_ordering:
order_by = '-violence_date' # Use the default ordering if the parameter is invalid
-
# Get the queryset with the specified ordering
queryset = super().get_queryset().order_by(order_by)
return queryset
class UsViolenceListViewPaginated(ListView):
+ """
+ View for listing all Us_violence instances with pagination (100 per page).
+ """
model = Us_violence
template_name = 'crisisdb/us_violence/list_paginated.html'
context_object_name = 'us_violences'
paginate_by = 100
class UsViolenceCreateView(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Us_violence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence
form_class = Us_violenceForm
template_name = 'crisisdb/us_violence/create.html'
@@ -3628,6 +6145,12 @@ class UsViolenceCreateView(PermissionRequiredMixin, CreateView):
success_url = reverse_lazy('us_violence_paginated')
class UsViolenceUpdateView(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Us_violence instance.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+ """
model = Us_violence
form_class = Us_violenceForm
template_name = 'crisisdb/us_violence/update.html'
@@ -3637,6 +6160,12 @@ class UsViolenceUpdateView(PermissionRequiredMixin, UpdateView):
@permission_required('core.view_capital')
def download_csv_all_american_violence(request):
+ """
+ Download all Us_violence instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ """
#from bs4 import BeautifulSoup
response = HttpResponse(content_type='text/csv')
@@ -3667,6 +6196,19 @@ def download_csv_all_american_violence(request):
@permission_required('core.view_capital')
def download_csv_all_american_violence2(request):
+ """
+ Download all Us_violence instances as CSV.
+
+ Note:
+ This view is only accessible to users with the 'view_capital' permission.
+ This function is not currently used in the application.
+
+ Args:
+ request: HttpRequest object
+
+ Returns:
+ HttpResponse: HTTP response with CSV file
+ """
#from bs4 import BeautifulSoup
response = HttpResponse(content_type='text/csv')
@@ -3696,8 +6238,26 @@ def download_csv_all_american_violence2(request):
@permission_required('core.add_capital')
def confirm_delete_view(request, model_class, pk, var_name):
+ """
+ View for confirming the deletion of an object.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+
+ Args:
+ request: HttpRequest object
+ model_class: Model class of the object to be deleted
+ pk: Primary key of the object to be deleted
+ var_name: Name of the object to be deleted
+
+ Returns:
+ HttpResponse: HTTP response with the confirmation page
+
+ Raises:
+ Http404: If the object with the given primary key does not exist
+ """
permission_required = 'core.add_capital'
-
+
# Retrieve the object for the given model class
obj = get_object_or_404(model_class, pk=pk)
@@ -3706,7 +6266,7 @@ def confirm_delete_view(request, model_class, pk, var_name):
return HttpResponseForbidden("You don't have permission to delete this object.")
template_name = "core/confirm_delete.html"
-
+
context = {
'var_name': var_name,
'obj': obj,
@@ -3717,21 +6277,36 @@ def confirm_delete_view(request, model_class, pk, var_name):
@permission_required('core.add_capital')
def delete_object_view(request, model_class, pk, var_name):
+ """
+ View for deleting an object.
+
+ Note:
+ This view is only accessible to users with the 'add_capital' permission.
+
+ Args:
+ request: HttpRequest object
+ model_class: Model class of the object to be deleted
+ pk: Primary key of the object to be deleted
+ var_name: Name of the object to be deleted
+
+ Returns:
+ HttpResponse: HTTP response with the confirmation page
+ """
permission_required = 'core.add_capital'
# Retrieve the object for the given model class
obj = get_object_or_404(model_class, pk=pk)
if not request.user.has_perm(permission_required):
return HttpResponseForbidden("You don't have permission to delete this object.")
-
+
# Delete the object
obj.delete()
-
+
# Redirect to the success URL
success_url_name = f'{var_name}_list' # Adjust the success URL as needed
success_url = reverse(success_url_name)
-
+
# Display a success message
messages.success(request, f"{var_name} has been deleted successfully.")
-
+
return redirect(success_url)
\ No newline at end of file
diff --git a/seshat/apps/general/backup_forms_copy.py b/seshat/apps/general/backup_forms_copy.py
index 021329da4..6b4b32603 100644
--- a/seshat/apps/general/backup_forms_copy.py
+++ b/seshat/apps/general/backup_forms_copy.py
@@ -40,7 +40,13 @@
}
class Polity_research_assistantForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_research_assistant
fields = commonfields.copy()
fields.append('polity_ra')
@@ -51,7 +57,13 @@ class Meta:
class Polity_utm_zoneForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_utm_zone
fields = commonfields.copy()
fields.append('utm_zone')
@@ -62,7 +74,13 @@ class Meta:
class Polity_original_nameForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_original_name
fields = commonfields.copy()
fields.append('original_name')
@@ -73,7 +91,13 @@ class Meta:
class Polity_alternative_nameForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternative_name
fields = commonfields.copy()
fields.append('alternative_name')
@@ -84,7 +108,13 @@ class Meta:
class Polity_peak_yearsForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_peak_years
fields = commonfields.copy()
fields.append('peak_year_from')
@@ -97,7 +127,13 @@ class Meta:
class Polity_durationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_duration
fields = commonfields.copy()
fields.append('polity_year_from')
@@ -110,7 +146,13 @@ class Meta:
class Polity_degree_of_centralizationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_degree_of_centralization
fields = commonfields.copy()
fields.append('degree_of_centralization')
@@ -121,7 +163,13 @@ class Meta:
class Polity_suprapolity_relationsForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_suprapolity_relations
fields = commonfields.copy()
fields.append('supra_polity_relations')
@@ -132,7 +180,13 @@ class Meta:
class Polity_capitalForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_capital
fields = commonfields.copy()
fields.append('capital')
@@ -143,7 +197,13 @@ class Meta:
class Polity_languageForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_language
fields = commonfields.copy()
fields.append('language')
@@ -154,7 +214,13 @@ class Meta:
class Polity_linguistic_familyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_linguistic_family
fields = commonfields.copy()
fields.append('linguistic_family')
@@ -165,7 +231,13 @@ class Meta:
class Polity_language_genusForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_language_genus
fields = commonfields.copy()
fields.append('language_genus')
@@ -176,7 +248,13 @@ class Meta:
class Polity_religion_genusForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion_genus
fields = commonfields.copy()
fields.append('religion_genus')
@@ -187,7 +265,13 @@ class Meta:
class Polity_religion_familyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion_family
fields = commonfields.copy()
fields.append('religion_family')
@@ -198,7 +282,13 @@ class Meta:
class Polity_religionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion
fields = commonfields.copy()
fields.append('religion')
@@ -209,7 +299,13 @@ class Meta:
class Polity_relationship_to_preceding_entityForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_relationship_to_preceding_entity
fields = commonfields.copy()
fields.append('relationship_to_preceding_entity')
@@ -220,7 +316,13 @@ class Meta:
class Polity_preceding_entityForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_preceding_entity
fields = commonfields.copy()
fields.append('preceding_entity')
@@ -231,7 +333,13 @@ class Meta:
class Polity_succeeding_entityForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_succeeding_entity
fields = commonfields.copy()
fields.append('succeeding_entity')
@@ -242,7 +350,13 @@ class Meta:
class Polity_supracultural_entityForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_supracultural_entity
fields = commonfields.copy()
fields.append('supracultural_entity')
@@ -253,7 +367,13 @@ class Meta:
class Polity_scale_of_supracultural_interactionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_scale_of_supracultural_interaction
fields = commonfields.copy()
fields.append('scale_from')
@@ -266,7 +386,13 @@ class Meta:
class Polity_alternate_religion_genusForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion_genus
fields = commonfields.copy()
fields.append('alternate_religion_genus')
@@ -277,7 +403,13 @@ class Meta:
class Polity_alternate_religion_familyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion_family
fields = commonfields.copy()
fields.append('alternate_religion_family')
@@ -288,7 +420,13 @@ class Meta:
class Polity_alternate_religionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion
fields = commonfields.copy()
fields.append('alternate_religion')
@@ -299,7 +437,13 @@ class Meta:
class Polity_expertForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_expert
fields = commonfields.copy()
fields.append('expert')
@@ -310,7 +454,13 @@ class Meta:
class Polity_editorForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_editor
fields = commonfields.copy()
fields.append('editor')
@@ -321,7 +471,13 @@ class Meta:
class Polity_religious_traditionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religious_tradition
fields = commonfields.copy()
fields.append('religious_tradition')
diff --git a/seshat/apps/general/backup_models_copy.py b/seshat/apps/general/backup_models_copy.py
index 4292b75dd..8d1a01d55 100644
--- a/seshat/apps/general/backup_models_copy.py
+++ b/seshat/apps/general/backup_models_copy.py
@@ -371,6 +371,23 @@
########## Beginning of Function Definitions for General (Vars) Models
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -378,10 +395,51 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ', '.join(['' + citation.__str__() + ' ' for citation in self.citations.all()[:2]])
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': 'The start year is bigger than the end year!',
@@ -416,21 +474,73 @@ class Polity_research_assistant(SeshatCommon):
polity_ra = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_research_assistant")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_research_assistant'
verbose_name_plural = 'Polity_research_assistants'
ordering = ['polity_ra', 'year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_research_assistant"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Research Assistant"
def show_value(self):
@@ -440,6 +550,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_research_assistant-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -451,21 +569,73 @@ class Polity_utm_zone(SeshatCommon):
utm_zone = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_utm_zone'
verbose_name_plural = 'Polity_utm_zones'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_utm_zone"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Utm Zone"
def show_value(self):
@@ -475,6 +645,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_utm_zone-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -486,21 +664,73 @@ class Polity_original_name(SeshatCommon):
original_name = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_original_name'
verbose_name_plural = 'Polity_original_names'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_original_name"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Original Name"
def show_value(self):
@@ -510,6 +740,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_original_name-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -521,21 +759,73 @@ class Polity_alternative_name(SeshatCommon):
alternative_name = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternative_name'
verbose_name_plural = 'Polity_alternative_names'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternative_name"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternative Name"
def show_value(self):
@@ -545,6 +835,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternative_name-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -557,21 +855,73 @@ class Polity_peak_years(SeshatCommon):
peak_year_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_peak_years'
verbose_name_plural = 'Polity_peak_years'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_peak_years"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Peak Years"
def show_value(self):
@@ -596,6 +946,14 @@ def show_value(self):
return "[" + f'{abs(self.peak_year_from):,}' + " CE" + " âžś " + f'{abs(self.peak_year_to):,}' + " CE" + "]"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_peak_years-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -608,21 +966,73 @@ class Polity_duration(SeshatCommon):
polity_year_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_duration'
verbose_name_plural = 'Polity_durations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_duration"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Duration"
def show_value(self):
@@ -647,6 +1057,14 @@ def show_value(self):
return "[" + f'{abs(self.polity_year_from):,}' + " CE" + " âžś " + f'{abs(self.polity_year_to):,}' + " CE" + "]"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_duration-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -658,21 +1076,73 @@ class Polity_degree_of_centralization(SeshatCommon):
degree_of_centralization = models.CharField(max_length=500, choices=POLITY_DEGREE_OF_CENTRALIZATION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_degree_of_centralization'
verbose_name_plural = 'Polity_degree_of_centralizations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_degree_of_centralization"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Degree of Centralization"
def show_value(self):
@@ -682,6 +1152,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_degree_of_centralization-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -693,21 +1171,73 @@ class Polity_suprapolity_relations(SeshatCommon):
supra_polity_relations = models.CharField(max_length=500, choices=POLITY_SUPRAPOLITY_RELATIONS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_suprapolity_relations'
verbose_name_plural = 'Polity_suprapolity_relations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_suprapolity_relations"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Suprapolity Relations"
def show_value(self):
@@ -717,6 +1247,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_suprapolity_relations-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -728,21 +1266,73 @@ class Polity_capital(SeshatCommon):
capital = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_capital'
verbose_name_plural = 'Polity_capitals'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_capital"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Capital"
def show_value(self):
@@ -752,6 +1342,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_capital-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -763,21 +1361,73 @@ class Polity_language(SeshatCommon):
language = models.CharField(max_length=500, choices=POLITY_LANGUAGE_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_language'
verbose_name_plural = 'Polity_languages'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_language"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Language"
def show_value(self):
@@ -787,6 +1437,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_language-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -798,21 +1456,73 @@ class Polity_linguistic_family(SeshatCommon):
linguistic_family = models.CharField(max_length=500, choices=POLITY_LINGUISTIC_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_linguistic_family'
verbose_name_plural = 'Polity_linguistic_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_linguistic_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Linguistic Family"
def show_value(self):
@@ -822,6 +1532,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_linguistic_family-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -833,21 +1551,73 @@ class Polity_language_genus(SeshatCommon):
language_genus = models.CharField(max_length=500, choices=POLITY_LANGUAGE_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_language_genus'
verbose_name_plural = 'Polity_language_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_language_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Language Genus"
def show_value(self):
@@ -857,6 +1627,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_language_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -868,21 +1646,73 @@ class Polity_religion_genus(SeshatCommon):
religion_genus = models.CharField(max_length=500, choices=POLITY_RELIGION_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion_genus'
verbose_name_plural = 'Polity_religion_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion Genus"
def show_value(self):
@@ -892,6 +1722,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -903,21 +1741,73 @@ class Polity_religion_family(SeshatCommon):
religion_family = models.CharField(max_length=500, choices=POLITY_RELIGION_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion_family'
verbose_name_plural = 'Polity_religion_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion Family"
def show_value(self):
@@ -927,6 +1817,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion_family-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -938,21 +1836,73 @@ class Polity_religion(SeshatCommon):
religion = models.CharField(max_length=500, choices=POLITY_RELIGION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion'
verbose_name_plural = 'Polity_religions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion"
def show_value(self):
@@ -962,6 +1912,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -973,21 +1931,73 @@ class Polity_relationship_to_preceding_entity(SeshatCommon):
relationship_to_preceding_entity = models.CharField(max_length=500, choices=POLITY_RELATIONSHIP_TO_PRECEDING_ENTITY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_relationship_to_preceding_entity'
verbose_name_plural = 'Polity_relationship_to_preceding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_relationship_to_preceding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Relationship to Preceding Entity"
def show_value(self):
@@ -997,6 +2007,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_relationship_to_preceding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1008,21 +2026,73 @@ class Polity_preceding_entity(SeshatCommon):
preceding_entity = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_preceding_entity'
verbose_name_plural = 'Polity_preceding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_preceding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Preceding Entity"
def show_value(self):
@@ -1032,6 +2102,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_preceding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1043,21 +2121,73 @@ class Polity_succeeding_entity(SeshatCommon):
succeeding_entity = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_succeeding_entity'
verbose_name_plural = 'Polity_succeeding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_succeeding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Succeeding Entity"
def show_value(self):
@@ -1067,6 +2197,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_succeeding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1078,21 +2216,73 @@ class Polity_supracultural_entity(SeshatCommon):
supracultural_entity = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_supracultural_entity'
verbose_name_plural = 'Polity_supracultural_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_supracultural_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Supracultural Entity"
def show_value(self):
@@ -1102,6 +2292,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_supracultural_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1114,21 +2312,73 @@ class Polity_scale_of_supracultural_interaction(SeshatCommon):
scale_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_scale_of_supracultural_interaction'
verbose_name_plural = 'Polity_scale_of_supracultural_interactions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_scale_of_supracultural_interaction"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Scale of Supracultural Interaction"
def show_value(self):
@@ -1144,6 +2394,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_scale_of_supracultural_interaction-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1155,21 +2413,73 @@ class Polity_alternate_religion_genus(SeshatCommon):
alternate_religion_genus = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion_genus'
verbose_name_plural = 'Polity_alternate_religion_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion Genus"
def show_value(self):
@@ -1179,6 +2489,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1190,21 +2508,73 @@ class Polity_alternate_religion_family(SeshatCommon):
alternate_religion_family = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion_family'
verbose_name_plural = 'Polity_alternate_religion_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion Family"
def show_value(self):
@@ -1214,6 +2584,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion_family-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1225,21 +2603,73 @@ class Polity_alternate_religion(SeshatCommon):
alternate_religion = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion'
verbose_name_plural = 'Polity_alternate_religions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion"
def show_value(self):
@@ -1249,6 +2679,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1260,21 +2698,73 @@ class Polity_expert(SeshatCommon):
expert = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_expert")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_expert'
verbose_name_plural = 'Polity_experts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_expert"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Expert"
def show_value(self):
@@ -1284,6 +2774,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_expert-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1295,21 +2793,73 @@ class Polity_editor(SeshatCommon):
editor = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_editor")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_editor'
verbose_name_plural = 'Polity_editors'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_editor"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Editor"
def show_value(self):
@@ -1319,6 +2869,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_editor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1330,21 +2888,73 @@ class Polity_religious_tradition(SeshatCommon):
religious_tradition = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religious_tradition'
verbose_name_plural = 'Polity_religious_traditions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religious_tradition"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religious Tradition"
def show_value(self):
@@ -1354,6 +2964,14 @@ def show_value(self):
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religious_tradition-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/general/forms.py b/seshat/apps/general/forms.py
index 2e17862e8..ef8c41c90 100644
--- a/seshat/apps/general/forms.py
+++ b/seshat/apps/general/forms.py
@@ -42,7 +42,13 @@
}
class Polity_research_assistantForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_research_assistant model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_research_assistant
fields = commonfields.copy()
fields.append('polity_ra')
@@ -53,7 +59,13 @@ class Meta:
class Polity_utm_zoneForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_utm_zone model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_utm_zone
fields = commonfields.copy()
fields.append('utm_zone')
@@ -64,7 +76,13 @@ class Meta:
class Polity_original_nameForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_original_name model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_original_name
fields = commonfields.copy()
fields.append('original_name')
@@ -75,7 +93,13 @@ class Meta:
class Polity_alternative_nameForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_alternative_name model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternative_name
fields = commonfields.copy()
fields.append('alternative_name')
@@ -86,7 +110,13 @@ class Meta:
class Polity_peak_yearsForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_peak_years model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_peak_years
fields = commonfields.copy()
fields.append('peak_year_from')
@@ -106,7 +136,13 @@ class Meta:
class Polity_durationForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_duration model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_duration
fields = commonfields.copy()
fields.append('polity_year_from')
@@ -123,7 +159,13 @@ class Meta:
class Polity_degree_of_centralizationForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_degree_of_centralization model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_degree_of_centralization
fields = commonfields.copy()
fields.append('degree_of_centralization')
@@ -134,7 +176,13 @@ class Meta:
class Polity_suprapolity_relationsForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_suprapolity_relations model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_suprapolity_relations
fields = commonfields.copy()
fields.append('supra_polity_relations')
@@ -148,7 +196,13 @@ class Meta:
class Polity_capitalForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_capital model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_capital
fields = commonfields.copy()
fields.append('capital')
@@ -166,7 +220,13 @@ class Meta:
class Polity_languageForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_language model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_language
fields = commonfields.copy()
fields.append('language')
@@ -177,7 +237,13 @@ class Meta:
class Polity_linguistic_familyForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_linguistic_family model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_linguistic_family
fields = commonfields.copy()
fields.append('linguistic_family')
@@ -188,7 +254,13 @@ class Meta:
class Polity_language_genusForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_language_genus model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_language_genus
fields = commonfields.copy()
fields.append('language_genus')
@@ -199,7 +271,13 @@ class Meta:
class Polity_religion_genusForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_religion_genus model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion_genus
fields = commonfields.copy()
fields.append('religion_genus')
@@ -210,7 +288,13 @@ class Meta:
class Polity_religion_familyForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_religion_family model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion_family
fields = commonfields.copy()
fields.append('religion_family')
@@ -221,7 +305,13 @@ class Meta:
class Polity_religionForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_religion model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religion
fields = commonfields.copy()
fields.append('religion')
@@ -232,7 +322,13 @@ class Meta:
class Polity_relationship_to_preceding_entityForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_relationship_to_preceding_entity model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_relationship_to_preceding_entity
fields = commonfields.copy()
fields.append('relationship_to_preceding_entity')
@@ -243,7 +339,13 @@ class Meta:
class Polity_preceding_entityForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_preceding_entity model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_preceding_entity
fields = commonfields.copy()
#fields.append('preceding_entity')
@@ -264,7 +366,13 @@ class Meta:
class Polity_succeeding_entityForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_succeeding_entity model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_succeeding_entity
fields = commonfields.copy()
fields.append('succeeding_entity')
@@ -275,7 +383,13 @@ class Meta:
class Polity_supracultural_entityForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_supracultural_entity model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_supracultural_entity
fields = commonfields.copy()
fields.append('supracultural_entity')
@@ -286,7 +400,13 @@ class Meta:
class Polity_scale_of_supracultural_interactionForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_scale_of_supracultural_interaction model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_scale_of_supracultural_interaction
fields = commonfields.copy()
fields.append('scale_from')
@@ -299,7 +419,13 @@ class Meta:
class Polity_alternate_religion_genusForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_alternate_religion_genus model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion_genus
fields = commonfields.copy()
fields.append('alternate_religion_genus')
@@ -310,7 +436,13 @@ class Meta:
class Polity_alternate_religion_familyForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_alternate_religion_family model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion_family
fields = commonfields.copy()
fields.append('alternate_religion_family')
@@ -321,7 +453,13 @@ class Meta:
class Polity_alternate_religionForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_alternate_religion model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_alternate_religion
fields = commonfields.copy()
fields.append('alternate_religion')
@@ -332,7 +470,13 @@ class Meta:
class Polity_expertForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_expert model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_expert
fields = commonfields.copy()
fields.append('expert')
@@ -343,7 +487,13 @@ class Meta:
class Polity_editorForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_editor model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_editor
fields = commonfields.copy()
fields.append('editor')
@@ -354,7 +504,13 @@ class Meta:
class Polity_religious_traditionForm(forms.ModelForm):
+ """
+ Form for creating and updating Polity_religious_tradition model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_religious_tradition
fields = commonfields.copy()
fields.append('religious_tradition')
diff --git a/seshat/apps/general/mixins.py b/seshat/apps/general/mixins.py
index 126564743..2bc7e906a 100644
--- a/seshat/apps/general/mixins.py
+++ b/seshat/apps/general/mixins.py
@@ -1,7 +1,16 @@
# mixins.py
class PolityIdMixin:
+ """
+ Mixin to add the get_initial method to a view that sets the initial value of the polity field.
+ """
def get_initial(self):
+ """
+ Get the initial value of the polity field from the query string.
+
+ Returns:
+ dict: The initial value of the polity field.
+ """
initial = super().get_initial()
polity_id_x = self.request.GET.get('polity_id_x')
other_polity_id_x = self.request.GET.get('other_polity_id_x')
diff --git a/seshat/apps/general/models.py b/seshat/apps/general/models.py
index d83275385..bfaf52741 100644
--- a/seshat/apps/general/models.py
+++ b/seshat/apps/general/models.py
@@ -484,7 +484,25 @@
########## Beginning of Function Definitions for General (Vars) Models
+
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -492,9 +510,51 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ', '.join(['' + citation.__str__() + ' ' for citation in self.citations.all()[:2]])
+
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': mark_safe(' The start year is bigger than the end year!'),
@@ -521,34 +581,105 @@ def clean_times(self):
########## Beginning of class Definitions for general Models
class Polity_research_assistant(SeshatCommon):
+ """
+ This model is used to store the information about the research assistants
+ of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_research_assistant")
polity_ra = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_research_assistant")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_research_assistant'
verbose_name_plural = 'Polity_research_assistants'
ordering = ['polity_ra', 'year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_research_assistant"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Research Assistant"
def show_value(self):
+ """
+ Return the name of the research assistant (if it exists, otherwise
+ return a dash).
+
+ Returns:
+ str: The name of the research assistant (or " - " if it does not exist).
+ """
if self.polity_ra:
return self.polity_ra
else:
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_research_assistant-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -558,111 +689,354 @@ def __str__(self) -> str:
class Polity_original_name(SeshatCommon):
+ """
+ This model is used to store the information about the original names of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_original_name")
original_name = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_original_name'
verbose_name_plural = 'Polity_original_names'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_original_name"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Original Name"
-
+
def show_value(self):
+ """
+ Return the original name (if it exists, otherwise return a dash).
+
+ Returns:
+ str: The original name (or " - " if it does not exist).
+ """
if self.original_name:
return self.original_name
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Identity and Location"
def sub_subsection(self):
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
return None
-
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_original_name-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_alternative_name(SeshatCommon):
+ """
+ This model is used to store the information about the alternative names of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_alternative_name")
alternative_name = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternative_name'
verbose_name_plural = 'Polity_alternative_names'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternative_name"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternative Name"
-
+
def show_value(self):
+ """
+ Return the alternative name (if it exists, otherwise return a dash).
+
+ Returns:
+ str: The alternative name (or " - " if it does not exist).
+ """
if self.alternative_name:
return self.alternative_name
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Identity and Location"
def sub_subsection(self):
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
return None
-
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternative_name-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
+
class Polity_duration(SeshatCommon):
+ """
+ This model is used to store the information about the duration of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_duration")
polity_year_from = models.IntegerField(blank=True, null=True)
polity_year_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_duration'
verbose_name_plural = 'Polity_durations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_duration"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Duration"
-
+
def show_value(self):
+ """
+ Return the duration of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The duration of the polity (or " - " if it does not exist on the instance).
+ """
if self.polity_year_from == self.polity_year_to:
if self.polity_year_from < 0:
return f'{abs(self.polity_year_from):,}' + " BCE"
@@ -682,43 +1056,134 @@ def show_value(self):
return "[" + f'{abs(self.polity_year_from):,}' + " BCE" + " âžś " + f'{abs(self.polity_year_to):,}' + " CE" + "]"
else:
return "[" + f'{abs(self.polity_year_from):,}' + " CE" + " âžś " + f'{abs(self.polity_year_to):,}' + " CE" + "]"
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Temporal Bounds"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_duration-detail', args=[str(self.id)])
def __str__(self) -> str:
- return call_my_name(self)
+ return call_my_name(self)
class Polity_peak_years(SeshatCommon):
+ """
+ This model is used to store the information about the peak years of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_peak_years")
peak_year_from = models.IntegerField(blank=True, null=True)
peak_year_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_peak_years'
verbose_name_plural = 'Polity_peak_years'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_peak_years"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Peak Years"
-
+
def show_value(self):
+ """
+ Return the peak years of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The peak years of the polity (or " - " if it does not exist on the instance).
+ """
if self.peak_year_from == self.peak_year_to:
if self.peak_year_from < 0:
return f'{abs(self.peak_year_from):,}' + " BCE"
@@ -740,88 +1205,260 @@ def show_value(self):
return "[" + f'{abs(self.peak_year_from):,}' + " CE" + " âžś " + f'{abs(self.peak_year_to):,}' + " CE" + "]"
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Temporal Bounds"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_peak_years-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
-
-
+
class Polity_degree_of_centralization(SeshatCommon):
+ """
+ This model is used to store the information about the degree of
+ centralization of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_degree_of_centralization")
degree_of_centralization = models.CharField(max_length=500, choices=POLITY_DEGREE_OF_CENTRALIZATION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_degree_of_centralization'
verbose_name_plural = 'Polity_degree_of_centralizations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_degree_of_centralization"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Degree of Centralization"
-
+
def show_value(self):
+ """
+ Return the degree of centralisation of the polity (if it exists on the
+ instance, otherwise return a dash).
+
+ Returns:
+ str: The degree of centralisation of the polity (or " - " if it does not exist on the instance).
+ """
if self.degree_of_centralization:
return self.get_degree_of_centralization_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_degree_of_centralization-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
+
# Be aware that this variable name deviates from the name. Notice supra_polity
-
+
# a type="button" class="fs-6" data-bs-toggle="tooltip" data-bs-html="true" title="References: {{ value.display_citations }}"
class Polity_suprapolity_relations(SeshatCommon):
+ """
+ This model is used to store the information about the supra-polity
+ relations of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_suprapolity_relations")
supra_polity_relations = models.CharField(max_length=500, choices=POLITY_SUPRAPOLITY_RELATIONS_CHOICES)
other_polity = models.ForeignKey(Polity, models.SET_NULL,blank=True,null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_suprapolity_relations'
verbose_name_plural = 'Polity_suprapolity_relations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_suprapolity_relations"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Suprapolity Relations"
-
+
def display_value(self):
if self.supra_polity_relations and self.other_polity and self.polity:
polity_url = reverse('polity-detail-main', args=[self.polity.id])
@@ -833,28 +1470,62 @@ def display_value(self):
return f"{self.get_supra_polity_relations_display()} [---]"
else:
return " - "
-
def show_value(self):
+ """
+ Return the supra polity relations of the polity (if it exists on the
+ instance, otherwise return a dash).
+
+ Returns:
+ str: The supra polity relations of the polity (or " - " if it does not exist on the instance).
+ """
if self.supra_polity_relations and self.other_polity:
return self.get_supra_polity_relations_display() +f" [{self.other_polity.new_name}]"
elif self.supra_polity_relations:
return self.get_supra_polity_relations_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_suprapolity_relations-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
+
# class Polity_consecutive_entity(SeshatCommon):
# name = models.CharField(max_length=100, default="Polity_consecutive_entity")
# consecutive_polity_relations = models.CharField(max_length=500, choices=POLITY_CONSECUTIVE_ENTITY_CHOICES)
@@ -877,7 +1548,7 @@ def __str__(self) -> str:
# def clean_name_spaced(self):
# return "Polity Consecutive Entities"
-
+
# def display_value(self):
# if self.consecutive_polity_relations and self.other_polity and self.polity:
# polity_url = reverse('polity-detail-main', args=[self.polity.id])
@@ -889,7 +1560,6 @@ def __str__(self) -> str:
# return f"{self.get_consecutive_polity_relations_display()} [---]"
# else:
# return " - "
-
# def show_value(self):
# if self.consecutive_polity_relations and self.other_polity:
@@ -898,99 +1568,280 @@ def __str__(self) -> str:
# return self.get_consecutive_polity_relations_display()
# else:
# return " - "
-
+
# def subsection(self):
# return "Political and Cultural Relations"
# def sub_subsection(self):
-# return None
-
+# return None
+
# def get_absolute_url(self):
# return reverse('polity_consecutive_entity-detail', args=[str(self.id)])
# def __str__(self) -> str:
# return call_my_name(self)
-
+
class Polity_utm_zone(SeshatCommon):
+ """
+ This model is used to store the information about the UTM zone of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_utm_zone")
utm_zone = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_utm_zone'
verbose_name_plural = 'Polity_utm_zones'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_utm_zone"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Utm Zone"
-
+
def show_value(self):
+ """
+ Return the UTM zone of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The UTM zone of the polity (or " - " if it does not exist on the instance).
+ """
if self.utm_zone:
return self.utm_zone
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Identity and Location"
def sub_subsection(self):
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
return None
-
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_utm_zone-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_capital(SeshatCommon):
+ """
+ This model is used to store the information about the capitals of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_capital")
capital = models.CharField(max_length=500, blank=True, null=True)
polity_cap = models.ForeignKey(Capital, on_delete=models.SET_NULL, null=True, related_name="polity_caps")
-
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_capital'
verbose_name_plural = 'Polity_capitals'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_capital"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Capital"
-
+
def show_value(self):
+ """
+ Return the capital of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The capital of the polity (or " - " if it does not exist on the instance).
+ """
if self.polity_cap:
return self.polity_cap
elif self.capital:
return self.capital
else:
return call_my_name(self)
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Identity and Location"
def sub_subsection(self):
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
return None
-
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_capital-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1000,296 +1851,936 @@ def __str__(self) -> str:
return self.capital
else:
return call_my_name(self)
-
-
+
+
class Polity_language(SeshatCommon):
+ """
+ This model is used to store the information about the languages of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_language")
language = models.CharField(max_length=500, choices=POLITY_LANGUAGE_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_language'
verbose_name_plural = 'Polity_languages'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
- return "polity_language"
+ """
+ Return the name of the model instance.
- def clean_name_spaced(self):
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
+ return "polity_language"
+
+ def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Language"
-
+
def show_value(self):
+ """
+ Return the language of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The language of the polity (or " - " if it does not exist on the instance).
+ """
if self.language:
return self.get_language_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Language"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_language-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_linguistic_family(SeshatCommon):
+ """
+ This model is used to store the information about the linguistic family
+ of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_linguistic_family")
linguistic_family = models.CharField(max_length=500, choices=POLITY_LINGUISTIC_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_linguistic_family'
verbose_name_plural = 'Polity_linguistic_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_linguistic_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Linguistic Family"
-
+
def show_value(self):
+ """
+ Return the linguistic family of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The linguistic family of the polity (or " - " if it does not exist on the instance).
+ """
if self.linguistic_family:
return self.get_linguistic_family_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Language"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_linguistic_family-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_language_genus(SeshatCommon):
+ """
+ This model is used to store the information about the language genus of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_language_genus")
language_genus = models.CharField(max_length=500, choices=POLITY_LANGUAGE_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_language_genus'
verbose_name_plural = 'Polity_language_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_language_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Language Genus"
-
+
def show_value(self):
+ """
+ Return the language genus of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The language genus of the polity (or " - " if it does not exist on the instance).
+ """
if self.language_genus:
return self.get_language_genus_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Language"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_language_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_religion_genus(SeshatCommon):
+ """
+ This model is used to store the information about the religion genus of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_religion_genus")
religion_genus = models.CharField(max_length=500, choices=POLITY_RELIGION_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion_genus'
verbose_name_plural = 'Polity_religion_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion Genus"
-
+
def show_value(self):
+ """
+ Return the religion genus of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The religion genus of the polity (or " - " if it does not exist on the instance).
+ """
if self.religion_genus:
return self.get_religion_genus_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_religion_family(SeshatCommon):
+ """
+ This model is used to store the information about the religion family of the
+ """
name = models.CharField(max_length=100, default="Polity_religion_family")
religion_family = models.CharField(max_length=500, choices=POLITY_RELIGION_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion_family'
verbose_name_plural = 'Polity_religion_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion Family"
-
+
def show_value(self):
+ """
+ Return the religion family of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The religion family of the polity (or " - " if it does not exist on the instance).
+ """
if self.religion_family:
return self.get_religion_family_display()
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion_family-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_religion(SeshatCommon):
+ """
+ This model is used to store the information about the religion of the
+ polities.
+ """
name = models.CharField(max_length=100, default="Polity_religion")
religion = models.CharField(max_length=500, choices=POLITY_RELIGION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religion'
verbose_name_plural = 'Polity_religions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religion"
-
+
def show_value(self):
+ """
+ Return the religion of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The religion of the polity (or " - " if it does not exist on the instance).
+ """
if self.religion:
return self.get_religion_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_relationship_to_preceding_entity(SeshatCommon):
+ """
+ This model is used to store the information about the relationship of the
+ polities to their preceding entities.
+ """
name = models.CharField(max_length=100, default="Polity_relationship_to_preceding_entity")
relationship_to_preceding_entity = models.CharField(max_length=500, choices=POLITY_RELATIONSHIP_TO_PRECEDING_ENTITY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_relationship_to_preceding_entity'
verbose_name_plural = 'Polity_relationship_to_preceding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_relationship_to_preceding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Relationship to Preceding Entity"
-
+
def show_value(self):
+ """
+ Return the polity's relationship to the preceding entity (if it exists
+ on the instance, otherwise return a dash).
+
+ Returns:
+ str: The polity's relationship to the preceding entity (or " - " if it does not exist on the instance).
+ """
if self.relationship_to_preceding_entity:
return self.get_relationship_to_preceding_entity_display()
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_relationship_to_preceding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_preceding_entity(SeshatCommon):
+ """
+ This model is used to store the information about the preceding entities of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_preceding_entity")
merged_old_data = models.CharField(max_length=1000, blank=True, null=True)
relationship_to_preceding_entity = models.CharField(max_length=500, choices=POLITY_RELATIONSHIP_TO_PRECEDING_ENTITY_CHOICES, blank=True,null=True)
@@ -1298,23 +2789,75 @@ class Polity_preceding_entity(SeshatCommon):
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_preceding_entity'
verbose_name_plural = 'Polity_preceding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_preceding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Preceding Entity"
-
+
# def show_value(self):
# if self.preceding_entity:
# return self.preceding_entity
@@ -1322,6 +2865,15 @@ def clean_name_spaced(self):
# return " - "
def display_value(self):
+ """
+ Depending on the instance, return a HTML string with information about
+ the instance's other_polity attribute and its relationship to its
+ preceding entity, the preceding entity (if it exists) or a dash if the
+ preceding entity does not exist on the instance.
+
+ Returns:
+ str: A string representation of the instance's other_polity/preceding entity relationship or a dash if the preceding entity does not exist on the instance.
+ """
if self.preceding_entity and self.other_polity and self.polity:
polity_url = reverse('polity-detail-main', args=[self.polity.id])
other_polity_url = reverse('polity-detail-main', args=[self.other_polity.id])
@@ -1332,8 +2884,16 @@ def display_value(self):
return f"{self.preceding_entity} [---]"
else:
return " - "
-
+
def show_value(self):
+ """
+ Return the polity's preceding entity, its long name, and its new name
+ (if it exists on the instance, otherwise, if there's a preceding entity,
+ return its name, otherwise return a dash).
+
+ Returns:
+ str: A string representation of polity's preceding entity (or " - " if it does not exist on the instance).
+ """
if self.preceding_entity and self.polity and self.other_polity:
return self.preceding_entity +f" [{self.other_polity.new_name}]" + ' ---> ' + self.polity.long_name + f" [{self.polity.new_name}]"
elif self.preceding_entity and self.polity:
@@ -1342,126 +2902,399 @@ def show_value(self):
return self.preceding_entity
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_preceding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_succeeding_entity(SeshatCommon):
+ """
+ This model is used to store the information about the succeeding entities of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_succeeding_entity")
succeeding_entity = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_succeeding_entity'
verbose_name_plural = 'Polity_succeeding_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_succeeding_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Succeeding Entity"
-
+
def show_value(self):
+ """
+ Return the succeeding entity of the polity (if it exists on the
+ instance, otherwise return a dash).
+
+ Returns:
+ str: The succeeding entity of the polity (or " - " if it does not exist on the instance).
+ """
if self.succeeding_entity:
return self.succeeding_entity
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_succeeding_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_supracultural_entity(SeshatCommon):
+ """
+ This model is used to store the information about the supracultural entity of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_supracultural_entity")
supracultural_entity = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_supracultural_entity'
verbose_name_plural = 'Polity_supracultural_entities'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_supracultural_entity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Supracultural Entity"
-
+
def show_value(self):
+ """
+ Return the supracultural entity of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The supracultural entity of the polity (or " - " if it does not exist on the instance).
+ """
if self.supracultural_entity:
return self.supracultural_entity
else:
return " - "
-
+
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
-
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
+
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_supracultural_entity-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
-
-
+
+
class Polity_scale_of_supracultural_interaction(SeshatCommon):
+ """
+ This model is used to store the information about the scale of supracultural
+ interaction of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_scale_of_supracultural_interaction")
scale_from = models.IntegerField(blank=True, null=True)
scale_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_scale_of_supracultural_interaction'
verbose_name_plural = 'Polity_scale_of_supracultural_interactions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_scale_of_supracultural_interaction"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Scale of Supracultural Interaction"
def show_value(self):
+ """
+ Return the polity's scale of supracultural interaction (if it exists
+ on the instance, otherwise return a dash).
+
+ Returns:
+ str: The supracultural interaction of the polity (or " - " if it does not exist on the instance).
+ """
if self.scale_from and self.scale_to and self.scale_to == self.scale_from:
return mark_safe(f"{self.scale_from:,} km2")
elif self.scale_from and self.scale_to:
@@ -1474,13 +3307,41 @@ def show_value(self):
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Political and Cultural Relations"
def sub_subsection(self):
- return None
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_scale_of_supracultural_interaction-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1488,40 +3349,131 @@ def __str__(self) -> str:
class Polity_alternate_religion_genus(SeshatCommon):
+ """
+ This model is used to store the information about the alternate religion genus
+ of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_alternate_religion_genus")
alternate_religion_genus = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_GENUS_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion_genus'
verbose_name_plural = 'Polity_alternate_religion_genus'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion_genus"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion Genus"
def show_value(self):
+ """
+ Return the alternate religion genus of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The alternate religion genus of the polity (or " - " if it does not exist on the instance).
+ """
if self.alternate_religion_genus:
return self.get_alternate_religion_genus_display()
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion_genus-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1529,40 +3481,131 @@ def __str__(self) -> str:
class Polity_alternate_religion_family(SeshatCommon):
+ """
+ This model is used to store the information about the alternate religion family
+ of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_alternate_religion_family")
alternate_religion_family = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_FAMILY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion_family'
verbose_name_plural = 'Polity_alternate_religion_families'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion_family"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion Family"
def show_value(self):
+ """
+ Return the alternate religion family of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The alternate religion family of the polity (or " - " if it does not exist on the instance).
+ """
if self.alternate_religion_family:
return self.get_alternate_religion_family_display()
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion_family-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1570,40 +3613,131 @@ def __str__(self) -> str:
class Polity_alternate_religion(SeshatCommon):
+ """
+ This model is used to store the information about the alternate religion of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_alternate_religion")
alternate_religion = models.CharField(max_length=500, choices=POLITY_ALTERNATE_RELIGION_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_alternate_religion'
verbose_name_plural = 'Polity_alternate_religions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_alternate_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Alternate Religion"
def show_value(self):
+ """
+ Return the alternate religion of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The alternate religion of the polity (or " - " if it does not exist on the instance).
+ """
if self.alternate_religion:
return self.get_alternate_religion_display()
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_alternate_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1611,34 +3745,104 @@ def __str__(self) -> str:
class Polity_expert(SeshatCommon):
+ """
+ This model is used to store the information about the experts of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_expert")
expert = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_expert")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_expert'
verbose_name_plural = 'Polity_experts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_expert"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Expert"
def show_value(self):
+ """
+ Return the expert of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The expert of the polity (or " - " if it does not exist on the instance).
+ """
if self.expert:
return self.expert
else:
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_expert-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1646,34 +3850,104 @@ def __str__(self) -> str:
class Polity_editor(SeshatCommon):
+ """
+ This model is used to store the information about the editors of the polities.
+ """
name = models.CharField(max_length=100, default="Polity_editor")
editor = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="seshat_editor")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_editor'
verbose_name_plural = 'Polity_editors'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_editor"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Editor"
def show_value(self):
+ """
+ Return the editor of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The editor of the polity (or " - " if it does not exist on the instance).
+ """
if self.editor:
return self.editor
else:
return " - "
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_editor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1681,40 +3955,131 @@ def __str__(self) -> str:
class Polity_religious_tradition(SeshatCommon):
+ """
+ This model is used to store the information about the religious tradition of
+ the polities.
+ """
name = models.CharField(max_length=100, default="Polity_religious_tradition")
religious_tradition = models.CharField(max_length=500, blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_religious_tradition'
verbose_name_plural = 'Polity_religious_traditions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_religious_tradition"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Religious Tradition"
def show_value(self):
+ """
+ Return the religious tradition of the polity (if it exists on the instance,
+ otherwise return a dash).
+
+ Returns:
+ str: The religious tradition of the polity (or " - " if it does not exist on the instance).
+ """
if self.religious_tradition:
return self.religious_tradition
else:
return " - "
def subsection(self):
+ """
+ Return the subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The subsection of the model instance.
+ """
return "Religion"
def sub_subsection(self):
- return None
+ """
+ Return the subsection's subsection of the model instance.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ None
+ """
+ return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_religious_tradition-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/general/tests.py b/seshat/apps/general/tests.py
index 7ce503c2d..e69de29bb 100644
--- a/seshat/apps/general/tests.py
+++ b/seshat/apps/general/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/general/views.py b/seshat/apps/general/views.py
index 7537dcf73..1ed34e5cd 100644
--- a/seshat/apps/general/views.py
+++ b/seshat/apps/general/views.py
@@ -46,14 +46,38 @@
from .forms import Polity_research_assistantForm, Polity_utm_zoneForm, Polity_original_nameForm, Polity_alternative_nameForm, Polity_peak_yearsForm, Polity_durationForm, Polity_degree_of_centralizationForm, Polity_suprapolity_relationsForm, Polity_capitalForm, Polity_languageForm, Polity_linguistic_familyForm, Polity_language_genusForm, Polity_religion_genusForm, Polity_religion_familyForm, Polity_religionForm, Polity_relationship_to_preceding_entityForm, Polity_preceding_entityForm, Polity_succeeding_entityForm, Polity_supracultural_entityForm, Polity_scale_of_supracultural_interactionForm, Polity_alternate_religion_genusForm, Polity_alternate_religion_familyForm, Polity_alternate_religionForm, Polity_expertForm, Polity_editorForm, Polity_religious_traditionForm
class Polity_research_assistantCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Polity_research_assistant.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_research_assistant
form_class = Polity_research_assistantForm
template_name = "general/polity_research_assistant/polity_research_assistant_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_research_assistant-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -67,18 +91,41 @@ def get_context_data(self, **kwargs):
class Polity_research_assistantUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_research_assistant.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_research_assistant
form_class = Polity_research_assistantForm
template_name = "general/polity_research_assistant/polity_research_assistant_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Research Assistant"
return context
class Polity_research_assistantDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_research_assistant.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_research_assistant
success_url = reverse_lazy('polity_research_assistants')
template_name = "core/delete_general.html"
@@ -86,14 +133,34 @@ class Polity_research_assistantDelete(PermissionRequiredMixin, DeleteView):
class Polity_research_assistantListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_research_assistant instances.
+ """
model = Polity_research_assistant
template_name = "general/polity_research_assistant/polity_research_assistant_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_research_assistants')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Research Assistant"
context["var_main_desc"] = "The ra(s) who worked on a polity."
@@ -107,13 +174,28 @@ def get_context_data(self, **kwargs):
class Polity_research_assistantListViewAll(generic.ListView):
+ """
+ View for listing all Polity_research_assistant instances.
+ """
model = Polity_research_assistant
template_name = "general/polity_research_assistant/polity_research_assistant_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_research_assistants_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_research_assistant instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_research_assistant instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -121,6 +203,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Research Assistant"
context["var_main_desc"] = "The ra(s) who worked on a polity."
@@ -134,12 +227,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_research_assistantDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_research_assistant instance.
+ """
model = Polity_research_assistant
template_name = "general/polity_research_assistant/polity_research_assistant_detail.html"
@permission_required('core.view_capital')
def polity_research_assistant_download(request):
+ """
+ Download a CSV file of all Polity_research_assistant instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_research_assistant.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -158,6 +266,18 @@ def polity_research_assistant_download(request):
@permission_required('core.view_capital')
def polity_research_assistant_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_research_assistant instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_research_assistants.csv"'
@@ -179,14 +299,38 @@ def polity_research_assistant_meta_download(request):
class Polity_utm_zoneCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_utm_zone.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_utm_zone
form_class = Polity_utm_zoneForm
template_name = "general/polity_utm_zone/polity_utm_zone_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_utm_zone-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -200,18 +344,41 @@ def get_context_data(self, **kwargs):
class Polity_utm_zoneUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_utm_zone.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_utm_zone
form_class = Polity_utm_zoneForm
template_name = "general/polity_utm_zone/polity_utm_zone_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Utm Zone"
return context
class Polity_utm_zoneDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_utm_zone.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_utm_zone
success_url = reverse_lazy('polity_utm_zones')
template_name = "core/delete_general.html"
@@ -219,14 +386,34 @@ class Polity_utm_zoneDelete(PermissionRequiredMixin, DeleteView):
class Polity_utm_zoneListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_utm_zone instances.
+ """
model = Polity_utm_zone
template_name = "general/polity_utm_zone/polity_utm_zone_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_utm_zones')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Utm Zone"
context["var_main_desc"] = "The utm zone of a polity."
@@ -240,13 +427,28 @@ def get_context_data(self, **kwargs):
class Polity_utm_zoneListViewAll(generic.ListView):
+ """
+ View for listing all Polity_utm_zone instances.
+ """
model = Polity_utm_zone
template_name = "general/polity_utm_zone/polity_utm_zone_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_utm_zones_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_utm_zone instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_utm_zone instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -254,6 +456,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Utm Zone"
context["var_main_desc"] = "The utm zone of a polity."
@@ -267,12 +480,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_utm_zoneDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_utm_zone instance.
+ """
model = Polity_utm_zone
template_name = "general/polity_utm_zone/polity_utm_zone_detail.html"
@permission_required('core.view_capital')
def polity_utm_zone_download(request):
+ """
+ Download a CSV file of all Polity_utm_zone instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_utm_zone.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -291,6 +519,18 @@ def polity_utm_zone_download(request):
@permission_required('core.view_capital')
def polity_utm_zone_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_utm_zone instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_utm_zones.csv"'
@@ -312,14 +552,38 @@ def polity_utm_zone_meta_download(request):
class Polity_original_nameCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_original_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_original_name
form_class = Polity_original_nameForm
template_name = "general/polity_original_name/polity_original_name_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_original_name-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -333,18 +597,41 @@ def get_context_data(self, **kwargs):
class Polity_original_nameUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_original_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_original_name
form_class = Polity_original_nameForm
template_name = "general/polity_original_name/polity_original_name_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Original Name"
return context
class Polity_original_nameDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_original_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_original_name
success_url = reverse_lazy('polity_original_names')
template_name = "core/delete_general.html"
@@ -352,14 +639,34 @@ class Polity_original_nameDelete(PermissionRequiredMixin, DeleteView):
class Polity_original_nameListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_original_name instances.
+ """
model = Polity_original_name
template_name = "general/polity_original_name/polity_original_name_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_original_names')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Original Name"
context["var_main_desc"] = "The original name of a polity."
@@ -373,13 +680,28 @@ def get_context_data(self, **kwargs):
class Polity_original_nameListViewAll(generic.ListView):
+ """
+ View for listing all Polity_original_name instances.
+ """
model = Polity_original_name
template_name = "general/polity_original_name/polity_original_name_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_original_names_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_original_name instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_original_name instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -387,6 +709,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Original Name"
context["var_main_desc"] = "The original name of a polity."
@@ -400,12 +733,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_original_nameDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_original_name instance.
+ """
model = Polity_original_name
template_name = "general/polity_original_name/polity_original_name_detail.html"
@permission_required('core.view_capital')
def polity_original_name_download(request):
+ """
+ Download a CSV file of all Polity_original_name instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_original_name.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -424,6 +772,18 @@ def polity_original_name_download(request):
@permission_required('core.view_capital')
def polity_original_name_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_original_name instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_original_names.csv"'
@@ -445,14 +805,38 @@ def polity_original_name_meta_download(request):
class Polity_alternative_nameCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_alternative_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternative_name
form_class = Polity_alternative_nameForm
template_name = "general/polity_alternative_name/polity_alternative_name_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternative_name-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -466,18 +850,41 @@ def get_context_data(self, **kwargs):
class Polity_alternative_nameUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_alternative_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternative_name
form_class = Polity_alternative_nameForm
template_name = "general/polity_alternative_name/polity_alternative_name_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternative Name"
return context
class Polity_alternative_nameDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_alternative_name.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternative_name
success_url = reverse_lazy('polity_alternative_names')
template_name = "core/delete_general.html"
@@ -485,14 +892,34 @@ class Polity_alternative_nameDelete(PermissionRequiredMixin, DeleteView):
class Polity_alternative_nameListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_alternative_name instances.
+ """
model = Polity_alternative_name
template_name = "general/polity_alternative_name/polity_alternative_name_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternative_names')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternative Name"
context["var_main_desc"] = "The alternative name of a polity."
@@ -506,13 +933,28 @@ def get_context_data(self, **kwargs):
class Polity_alternative_nameListViewAll(generic.ListView):
+ """
+ View for listing all Polity_alternative_name instances.
+ """
model = Polity_alternative_name
template_name = "general/polity_alternative_name/polity_alternative_name_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternative_names_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_alternative_name instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_alternative_name instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -520,6 +962,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternative Name"
context["var_main_desc"] = "The alternative name of a polity."
@@ -533,12 +986,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_alternative_nameDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_alternative_name instance.
+ """
model = Polity_alternative_name
template_name = "general/polity_alternative_name/polity_alternative_name_detail.html"
@permission_required('core.view_capital')
def polity_alternative_name_download(request):
+ """
+ Download a CSV file of all Polity_alternative_name instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_alternative_name.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -557,6 +1025,18 @@ def polity_alternative_name_download(request):
@permission_required('core.view_capital')
def polity_alternative_name_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_alternative_name instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_alternative_names.csv"'
@@ -578,12 +1058,24 @@ def polity_alternative_name_meta_download(request):
class Polity_peak_yearsCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_peak_years.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_peak_years
form_class = Polity_peak_yearsForm
template_name = "general/polity_peak_years/polity_peak_years_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_peak_years-create')
# def form_valid(self, form):
@@ -597,6 +1089,15 @@ def get_absolute_url(self):
# return super().form_valid(form)
def get_initial(self):
+ """
+ Get the initial value of the polity field from the query string.
+
+ Note:
+ TODO This should already be handled by the PolityIdMixin.
+
+ Returns:
+ dict: The initial value of the polity field.
+ """
initial = super(Polity_peak_yearsCreate, self).get_initial()
polity_id_x = self.request.GET.get('polity_id_x')
initial['polity'] = polity_id_x
@@ -604,6 +1105,17 @@ def get_initial(self):
return initial
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -620,12 +1132,29 @@ def get_context_data(self, **kwargs):
class Polity_peak_yearsUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_peak_years.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_peak_years
form_class = Polity_peak_yearsForm
template_name = "general/polity_peak_years/polity_peak_years_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Peak Years"
context["mysection"] = "General Variables"
@@ -636,6 +1165,12 @@ def get_context_data(self, **kwargs):
return context
class Polity_peak_yearsDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_peak_years.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_peak_years
success_url = reverse_lazy('polity_peak_yearss')
template_name = "core/delete_general.html"
@@ -643,14 +1178,34 @@ class Polity_peak_yearsDelete(PermissionRequiredMixin, DeleteView):
class Polity_peak_yearsListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_peak_years instances.
+ """
model = Polity_peak_years
template_name = "general/polity_peak_years/polity_peak_years_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_peak_yearss')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Peak Years"
context["var_main_desc"] = "The peak years of a polity."
@@ -666,13 +1221,28 @@ def get_context_data(self, **kwargs):
class Polity_peak_yearsListViewAll(generic.ListView):
+ """
+ View for listing all Polity_peak_years instances.
+ """
model = Polity_peak_years
template_name = "general/polity_peak_years/polity_peak_years_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_peak_yearss_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_peak_years instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_peak_years instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -680,6 +1250,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Peak Years"
context["var_main_desc"] = "The peak years of a polity."
@@ -695,12 +1276,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_peak_yearsDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_peak_years instance.
+ """
model = Polity_peak_years
template_name = "general/polity_peak_years/polity_peak_years_detail.html"
@permission_required('core.view_capital')
def polity_peak_years_download(request):
+ """
+ Download a CSV file of all Polity_peak_years instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_peak_years.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -719,6 +1315,18 @@ def polity_peak_years_download(request):
@permission_required('core.view_capital')
def polity_peak_years_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_peak_years instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_peak_yearss.csv"'
@@ -740,14 +1348,38 @@ def polity_peak_years_meta_download(request):
class Polity_durationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_duration.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_duration
form_class = Polity_durationForm
template_name = "general/polity_duration/polity_duration_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_duration-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -763,12 +1395,29 @@ def get_context_data(self, **kwargs):
class Polity_durationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_duration.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_duration
form_class = Polity_durationForm
template_name = "general/polity_duration/polity_duration_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Duration"
context["mysection"] = "General Variables"
@@ -779,6 +1428,12 @@ def get_context_data(self, **kwargs):
return context
class Polity_durationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_duration.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_duration
success_url = reverse_lazy('polity_durations')
template_name = "core/delete_general.html"
@@ -786,14 +1441,34 @@ class Polity_durationDelete(PermissionRequiredMixin, DeleteView):
class Polity_durationListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_duration instances.
+ """
model = Polity_duration
template_name = "general/polity_duration/polity_duration_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_durations')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Duration"
context["var_main_desc"] = "The lifetime of a polity."
@@ -807,13 +1482,28 @@ def get_context_data(self, **kwargs):
class Polity_durationListViewAll(generic.ListView):
+ """
+ View for listing all Polity_duration instances.
+ """
model = Polity_duration
template_name = "general/polity_duration/polity_duration_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_durations_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_duration instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_duration instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -821,6 +1511,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Duration"
context["var_main_desc"] = "The lifetime of a polity."
@@ -834,12 +1535,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_durationDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_duration instance.
+ """
model = Polity_duration
template_name = "general/polity_duration/polity_duration_detail.html"
@permission_required('core.view_capital')
def polity_duration_download(request):
+ """
+ Download a CSV file of all Polity_duration instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_duration.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -858,6 +1574,18 @@ def polity_duration_download(request):
@permission_required('core.view_capital')
def polity_duration_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_duration instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_durations.csv"'
@@ -879,19 +1607,52 @@ def polity_duration_meta_download(request):
class Polity_degree_of_centralizationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_degree_of_centralization.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_degree_of_centralization
form_class = Polity_degree_of_centralizationForm
template_name = "general/polity_degree_of_centralization/polity_degree_of_centralization_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the degree_of_centralization field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['degree_of_centralization'].choices = sorted(form.fields['degree_of_centralization'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_degree_of_centralization-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -905,23 +1666,55 @@ def get_context_data(self, **kwargs):
class Polity_degree_of_centralizationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_degree_of_centralization.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_degree_of_centralization
form_class = Polity_degree_of_centralizationForm
template_name = "general/polity_degree_of_centralization/polity_degree_of_centralization_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the degree_of_centralization field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['degree_of_centralization'].choices = sorted(form.fields['degree_of_centralization'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Degree of Centralization"
return context
class Polity_degree_of_centralizationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_degree_of_centralization.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_degree_of_centralization
success_url = reverse_lazy('polity_degree_of_centralizations')
template_name = "core/delete_general.html"
@@ -929,14 +1722,34 @@ class Polity_degree_of_centralizationDelete(PermissionRequiredMixin, DeleteView)
class Polity_degree_of_centralizationListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_degree_of_centralization instances.
+ """
model = Polity_degree_of_centralization
template_name = "general/polity_degree_of_centralization/polity_degree_of_centralization_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_degree_of_centralizations')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Degree of Centralization"
context["var_main_desc"] = "The degree of centralization of a polity."
@@ -950,13 +1763,28 @@ def get_context_data(self, **kwargs):
class Polity_degree_of_centralizationListViewAll(generic.ListView):
+ """
+ View for listing all Polity_degree_of_centralization instances.
+ """
model = Polity_degree_of_centralization
template_name = "general/polity_degree_of_centralization/polity_degree_of_centralization_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_degree_of_centralizations_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_degree_of_centralization instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_degree_of_centralization instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -964,6 +1792,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Degree of Centralization"
context["var_main_desc"] = "The degree of centralization of a polity."
@@ -977,12 +1816,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_degree_of_centralizationDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_degree_of_centralization instance.
+ """
model = Polity_degree_of_centralization
template_name = "general/polity_degree_of_centralization/polity_degree_of_centralization_detail.html"
@permission_required('core.view_capital')
def polity_degree_of_centralization_download(request):
+ """
+ Download a CSV file of all Polity_degree_of_centralization instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_degree_of_centralization.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1001,6 +1855,18 @@ def polity_degree_of_centralization_download(request):
@permission_required('core.view_capital')
def polity_degree_of_centralization_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_degree_of_centralization instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_degree_of_centralizations.csv"'
@@ -1022,19 +1888,52 @@ def polity_degree_of_centralization_meta_download(request):
class Polity_suprapolity_relationsCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_suprapolity_relations.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_suprapolity_relations
form_class = Polity_suprapolity_relationsForm
template_name = "general/polity_suprapolity_relations/polity_suprapolity_relations_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the supra_polity_relations field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['supra_polity_relations'].choices = sorted(form.fields['supra_polity_relations'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_suprapolity_relations-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1054,17 +1953,43 @@ def get_context_data(self, **kwargs):
class Polity_suprapolity_relationsUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_suprapolity_relations.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_suprapolity_relations
form_class = Polity_suprapolity_relationsForm
template_name = "general/polity_suprapolity_relations/polity_suprapolity_relations_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the supra_polity_relations field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['supra_polity_relations'].choices = sorted(form.fields['supra_polity_relations'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["mysubsection"] = "General Variables"
context["var_section"] = "General Variables"
@@ -1078,6 +2003,12 @@ def get_context_data(self, **kwargs):
return context
class Polity_suprapolity_relationsDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_suprapolity_relations.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_suprapolity_relations
success_url = reverse_lazy('polity_suprapolity_relationss')
template_name = "core/delete_general.html"
@@ -1085,14 +2016,34 @@ class Polity_suprapolity_relationsDelete(PermissionRequiredMixin, DeleteView):
class Polity_suprapolity_relationsListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_suprapolity_relations instances.
+ """
model = Polity_suprapolity_relations
template_name = "general/polity_suprapolity_relations/polity_suprapolity_relations_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_suprapolity_relationss')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Suprapolity Relations"
context["var_main_desc"] = "The supra polity relations of a polity."
@@ -1106,13 +2057,28 @@ def get_context_data(self, **kwargs):
class Polity_suprapolity_relationsListViewAll(generic.ListView):
+ """
+ View for listing all Polity_suprapolity_relations instances.
+ """
model = Polity_suprapolity_relations
template_name = "general/polity_suprapolity_relations/polity_suprapolity_relations_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_suprapolity_relationss_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_suprapolity_relations instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_suprapolity_relations instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1120,6 +2086,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Suprapolity Relations"
context["var_main_desc"] = "The supra polity relations of a polity."
@@ -1133,12 +2110,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_suprapolity_relationsDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_suprapolity_relations instance.
+ """
model = Polity_suprapolity_relations
template_name = "general/polity_suprapolity_relations/polity_suprapolity_relations_detail.html"
@permission_required('core.view_capital')
def polity_suprapolity_relations_download(request):
+ """
+ Download a CSV file of all Polity_suprapolity_relations instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_suprapolity_relations.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1162,6 +2154,18 @@ def polity_suprapolity_relations_download(request):
@permission_required('core.view_capital')
def polity_suprapolity_relations_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_suprapolity_relations instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_suprapolity_relationss.csv"'
@@ -1183,14 +2187,38 @@ def polity_suprapolity_relations_meta_download(request):
class Polity_capitalCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_capital.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_capital
form_class = Polity_capitalForm
template_name = "general/polity_capital/polity_capital_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_capital-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1204,12 +2232,29 @@ def get_context_data(self, **kwargs):
class Polity_capitalUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_capital.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_capital
form_class = Polity_capitalForm
template_name = "general/polity_capital/polity_capital_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Capital"
context["my_exp"] = "The capital of a polity is connection point between an existing Polity instance and an existing Capital instance. Optionally, year range associations can be specified. If not provided, it implies that the capital remains constant throughout the entire duration of the polity's existence."
@@ -1217,6 +2262,12 @@ def get_context_data(self, **kwargs):
return context
class Polity_capitalDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_capital.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_capital
success_url = reverse_lazy('polity_capitals')
template_name = "core/delete_general.html"
@@ -1224,14 +2275,34 @@ class Polity_capitalDelete(PermissionRequiredMixin, DeleteView):
class Polity_capitalListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_capital instances.
+ """
model = Polity_capital
template_name = "general/polity_capital/polity_capital_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_capitals')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Capital"
context["var_main_desc"] = "The capital of a polity is connection point between an existing Polity instance and an existing Capital instance. Optionally, year range associations can be specified. If not provided, it implies that the capital remains constant throughout the entire duration of the polity's existence."
@@ -1245,13 +2316,28 @@ def get_context_data(self, **kwargs):
class Polity_capitalListViewAll(generic.ListView):
+ """
+ View for listing all Polity_capital instances.
+ """
model = Polity_capital
template_name = "general/polity_capital/polity_capital_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_capitals_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_capital instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_capital instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1259,6 +2345,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Capital"
context["var_main_desc"] = "The capital of a polity is connection point between an existing Polity instance and an existing Capital instance. Optionally, year range associations can be specified. If not provided, it implies that the capital remains constant throughout the entire duration of the polity's existence."
@@ -1272,12 +2369,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_capitalDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_capital instance.
+ """
model = Polity_capital
template_name = "general/polity_capital/polity_capital_detail.html"
@permission_required('core.view_capital')
def polity_capital_download(request):
+ """
+ Download a CSV file of all Polity_capital instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_capital.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1301,6 +2413,18 @@ def polity_capital_download(request):
@permission_required('core.view_capital')
def polity_capital_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_capital instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_capitals.csv"'
@@ -1322,19 +2446,52 @@ def polity_capital_meta_download(request):
class Polity_languageCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_language.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language
form_class = Polity_languageForm
template_name = "general/polity_language/polity_language_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the language field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['language'].choices = sorted(form.fields['language'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_language-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1348,23 +2505,55 @@ def get_context_data(self, **kwargs):
class Polity_languageUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_language.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language
form_class = Polity_languageForm
template_name = "general/polity_language/polity_language_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the language field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['language'].choices = sorted(form.fields['language'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language"
return context
class Polity_languageDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_language.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language
success_url = reverse_lazy('polity_languages')
template_name = "core/delete_general.html"
@@ -1372,14 +2561,34 @@ class Polity_languageDelete(PermissionRequiredMixin, DeleteView):
class Polity_languageListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_language instances.
+ """
model = Polity_language
template_name = "general/polity_language/polity_language_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_languages')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language"
context["var_main_desc"] = "The language of a polity."
@@ -1393,13 +2602,28 @@ def get_context_data(self, **kwargs):
class Polity_languageListViewAll(generic.ListView):
+ """
+ View for listing all Polity_language instances.
+ """
model = Polity_language
template_name = "general/polity_language/polity_language_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_languages_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_language instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_language instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1407,6 +2631,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language"
context["var_main_desc"] = "The language of a polity."
@@ -1420,12 +2655,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_languageDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_language instance.
+ """
model = Polity_language
template_name = "general/polity_language/polity_language_detail.html"
@permission_required('core.view_capital')
def polity_language_download(request):
+ """
+ Download a CSV file of all Polity_language instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_language.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1444,6 +2694,18 @@ def polity_language_download(request):
@permission_required('core.view_capital')
def polity_language_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_language instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_languages.csv"'
@@ -1465,19 +2727,52 @@ def polity_language_meta_download(request):
class Polity_linguistic_familyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_linguistic_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_linguistic_family
form_class = Polity_linguistic_familyForm
template_name = "general/polity_linguistic_family/polity_linguistic_family_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the linguistic_family field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['linguistic_family'].choices = sorted(form.fields['linguistic_family'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_linguistic_family-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1491,23 +2786,55 @@ def get_context_data(self, **kwargs):
class Polity_linguistic_familyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_linguistic_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_linguistic_family
form_class = Polity_linguistic_familyForm
template_name = "general/polity_linguistic_family/polity_linguistic_family_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the linguistic_family field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['linguistic_family'].choices = sorted(form.fields['linguistic_family'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Linguistic Family"
return context
class Polity_linguistic_familyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_linguistic_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_linguistic_family
success_url = reverse_lazy('polity_linguistic_familys')
template_name = "core/delete_general.html"
@@ -1515,14 +2842,34 @@ class Polity_linguistic_familyDelete(PermissionRequiredMixin, DeleteView):
class Polity_linguistic_familyListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_linguistic_family instances.
+ """
model = Polity_linguistic_family
template_name = "general/polity_linguistic_family/polity_linguistic_family_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_linguistic_familys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Linguistic Family"
context["var_main_desc"] = "The linguistic family of a polity."
@@ -1536,13 +2883,28 @@ def get_context_data(self, **kwargs):
class Polity_linguistic_familyListViewAll(generic.ListView):
+ """
+ View for listing all Polity_linguistic_family instances.
+ """
model = Polity_linguistic_family
template_name = "general/polity_linguistic_family/polity_linguistic_family_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_linguistic_familys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_linguistic_family instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_linguistic_family instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1550,6 +2912,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Linguistic Family"
context["var_main_desc"] = "The linguistic family of a polity."
@@ -1563,12 +2936,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_linguistic_familyDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_linguistic_family instance.
+ """
model = Polity_linguistic_family
template_name = "general/polity_linguistic_family/polity_linguistic_family_detail.html"
@permission_required('core.view_capital')
def polity_linguistic_family_download(request):
+ """
+ Download a CSV file of all Polity_linguistic_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_linguistic_family.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1587,6 +2975,18 @@ def polity_linguistic_family_download(request):
@permission_required('core.view_capital')
def polity_linguistic_family_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_linguistic_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_linguistic_familys.csv"'
@@ -1608,14 +3008,38 @@ def polity_linguistic_family_meta_download(request):
class Polity_language_genusCreate(PermissionRequiredMixin, PolityIdMixin,CreateView):
+ """
+ View for creating a new Polity_language_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language_genus
form_class = Polity_language_genusForm
template_name = "general/polity_language_genus/polity_language_genus_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_language_genus-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1629,18 +3053,41 @@ def get_context_data(self, **kwargs):
class Polity_language_genusUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_language_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language_genus
form_class = Polity_language_genusForm
template_name = "general/polity_language_genus/polity_language_genus_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language Genus"
return context
class Polity_language_genusDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_language_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_language_genus
success_url = reverse_lazy('polity_language_genuss')
template_name = "core/delete_general.html"
@@ -1648,14 +3095,34 @@ class Polity_language_genusDelete(PermissionRequiredMixin, DeleteView):
class Polity_language_genusListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_language_genus instances.
+ """
model = Polity_language_genus
template_name = "general/polity_language_genus/polity_language_genus_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_language_genuss')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language Genus"
context["var_main_desc"] = "The language genus of a polity."
@@ -1669,13 +3136,28 @@ def get_context_data(self, **kwargs):
class Polity_language_genusListViewAll(generic.ListView):
+ """
+ View for listing all Polity_language_genus instances.
+ """
model = Polity_language_genus
template_name = "general/polity_language_genus/polity_language_genus_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_language_genuss_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_language_genus instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_language_genus instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1683,6 +3165,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Language Genus"
context["var_main_desc"] = "The language genus of a polity."
@@ -1696,12 +3189,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_language_genusDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_language_genus instance.
+ """
model = Polity_language_genus
template_name = "general/polity_language_genus/polity_language_genus_detail.html"
@permission_required('core.view_capital')
def polity_language_genus_download(request):
+ """
+ Download a CSV file of all Polity_language_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_language_genus.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1720,6 +3228,18 @@ def polity_language_genus_download(request):
@permission_required('core.view_capital')
def polity_language_genus_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_language_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_language_genuss.csv"'
@@ -1741,19 +3261,52 @@ def polity_language_genus_meta_download(request):
class Polity_religion_genusCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_genus
form_class = Polity_religion_genusForm
template_name = "general/polity_religion_genus/polity_religion_genus_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion_genus field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion_genus'].choices = sorted(form.fields['religion_genus'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_genus-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1767,23 +3320,55 @@ def get_context_data(self, **kwargs):
class Polity_religion_genusUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_genus
form_class = Polity_religion_genusForm
template_name = "general/polity_religion_genus/polity_religion_genus_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion_genus field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion_genus'].choices = sorted(form.fields['religion_genus'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Genus"
return context
class Polity_religion_genusDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_genus
success_url = reverse_lazy('polity_religion_genuss')
template_name = "core/delete_general.html"
@@ -1791,14 +3376,34 @@ class Polity_religion_genusDelete(PermissionRequiredMixin, DeleteView):
class Polity_religion_genusListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_religion_genus instances.
+ """
model = Polity_religion_genus
template_name = "general/polity_religion_genus/polity_religion_genus_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_genuss')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Genus"
context["var_main_desc"] = "The religion genus of a polity."
@@ -1812,13 +3417,28 @@ def get_context_data(self, **kwargs):
class Polity_religion_genusListViewAll(generic.ListView):
+ """
+ View for listing all Polity_religion_genus instances.
+ """
model = Polity_religion_genus
template_name = "general/polity_religion_genus/polity_religion_genus_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_genuss_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_religion_genus instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_religion_genus instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1826,6 +3446,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Genus"
context["var_main_desc"] = "The religion genus of a polity."
@@ -1839,12 +3470,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_religion_genusDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_religion_genus instance.
+ """
model = Polity_religion_genus
template_name = "general/polity_religion_genus/polity_religion_genus_detail.html"
@permission_required('core.view_capital')
def polity_religion_genus_download(request):
+ """
+ Download a CSV file of all Polity_religion_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_religion_genus.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -1863,6 +3509,18 @@ def polity_religion_genus_download(request):
@permission_required('core.view_capital')
def polity_religion_genus_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_religion_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_religion_genuss.csv"'
@@ -1884,17 +3542,41 @@ def polity_religion_genus_meta_download(request):
class Polity_religion_familyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_family
form_class = Polity_religion_familyForm
template_name = "general/polity_religion_family/polity_religion_family_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion_family field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion_family'].choices = sorted(form.fields['religion_family'].choices, key=lambda x: x[1].lower())
return form
def get_initial(self):
+ """
+ Get the initial value of the polity field from the query string.
+
+ Note:
+ TODO This should already be handled by the PolityIdMixin.
+
+ Returns:
+ dict: The initial value of the polity field.
+ """
initial = super(Polity_religion_familyCreate, self).get_initial()
polity_id_x = self.request.GET.get('polity_id_x')
initial['polity'] = polity_id_x
@@ -1902,8 +3584,26 @@ def get_initial(self):
return initial
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_family-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1917,23 +3617,55 @@ def get_context_data(self, **kwargs):
class Polity_religion_familyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_family
form_class = Polity_religion_familyForm
template_name = "general/polity_religion_family/polity_religion_family_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion_family field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion_family'].choices = sorted(form.fields['religion_family'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Family"
return context
class Polity_religion_familyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion_family
success_url = reverse_lazy('polity_religion_familys')
template_name = "core/delete_general.html"
@@ -1941,14 +3673,34 @@ class Polity_religion_familyDelete(PermissionRequiredMixin, DeleteView):
class Polity_religion_familyListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_religion_family instances.
+ """
model = Polity_religion_family
template_name = "general/polity_religion_family/polity_religion_family_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_familys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Family"
context["var_main_desc"] = "The religion family of a polity."
@@ -1962,13 +3714,28 @@ def get_context_data(self, **kwargs):
class Polity_religion_familyListViewAll(generic.ListView):
+ """
+ View for listing all Polity_religion_family instances.
+ """
model = Polity_religion_family
template_name = "general/polity_religion_family/polity_religion_family_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion_familys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_religion_family instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_religion_family instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -1976,6 +3743,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion Family"
context["var_main_desc"] = "The religion family of a polity."
@@ -1989,12 +3767,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_religion_familyDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_religion_family instance.
+ """
model = Polity_religion_family
template_name = "general/polity_religion_family/polity_religion_family_detail.html"
@permission_required('core.view_capital')
def polity_religion_family_download(request):
+ """
+ Download a CSV file of all Polity_religion_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_religion_family.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2013,6 +3806,18 @@ def polity_religion_family_download(request):
@permission_required('core.view_capital')
def polity_religion_family_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_religion_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_religion_familys.csv"'
@@ -2034,19 +3839,52 @@ def polity_religion_family_meta_download(request):
class Polity_religionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion
form_class = Polity_religionForm
template_name = "general/polity_religion/polity_religion_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion'].choices = sorted(form.fields['religion'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religion-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2060,23 +3898,55 @@ def get_context_data(self, **kwargs):
class Polity_religionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion
form_class = Polity_religionForm
template_name = "general/polity_religion/polity_religion_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the religion field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['religion'].choices = sorted(form.fields['religion'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion"
return context
class Polity_religionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religion
success_url = reverse_lazy('polity_religions')
template_name = "core/delete_general.html"
@@ -2084,14 +3954,34 @@ class Polity_religionDelete(PermissionRequiredMixin, DeleteView):
class Polity_religionListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_religion instances.
+ """
model = Polity_religion
template_name = "general/polity_religion/polity_religion_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion"
context["var_main_desc"] = "The religion of a polity."
@@ -2105,13 +3995,28 @@ def get_context_data(self, **kwargs):
class Polity_religionListViewAll(generic.ListView):
+ """
+ View for listing all Polity_religion instances.
+ """
model = Polity_religion
template_name = "general/polity_religion/polity_religion_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religions_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_religion instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_religion instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2119,6 +4024,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religion"
context["var_main_desc"] = "The religion of a polity."
@@ -2132,12 +4048,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_religionDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_religion instance.
+ """
model = Polity_religion
template_name = "general/polity_religion/polity_religion_detail.html"
@permission_required('core.view_capital')
def polity_religion_download(request):
+ """
+ Download a CSV file of all Polity_religion instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_religion.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2156,6 +4087,18 @@ def polity_religion_download(request):
@permission_required('core.view_capital')
def polity_religion_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_religion instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_religions.csv"'
@@ -2177,19 +4120,52 @@ def polity_religion_meta_download(request):
class Polity_relationship_to_preceding_entityCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_relationship_to_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_relationship_to_preceding_entity
form_class = Polity_relationship_to_preceding_entityForm
template_name = "general/polity_relationship_to_preceding_entity/polity_relationship_to_preceding_entity_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the relationship_to_preceding_entity field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['relationship_to_preceding_entity'].choices = sorted(form.fields['relationship_to_preceding_entity'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_relationship_to_preceding_entity-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2203,23 +4179,55 @@ def get_context_data(self, **kwargs):
class Polity_relationship_to_preceding_entityUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_relationship_to_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_relationship_to_preceding_entity
form_class = Polity_relationship_to_preceding_entityForm
template_name = "general/polity_relationship_to_preceding_entity/polity_relationship_to_preceding_entity_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the relationship_to_preceding_entity field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['relationship_to_preceding_entity'].choices = sorted(form.fields['relationship_to_preceding_entity'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Relationship to Preceding Entity"
return context
class Polity_relationship_to_preceding_entityDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_relationship_to_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_relationship_to_preceding_entity
success_url = reverse_lazy('polity_relationship_to_preceding_entitys')
template_name = "core/delete_general.html"
@@ -2227,14 +4235,34 @@ class Polity_relationship_to_preceding_entityDelete(PermissionRequiredMixin, Del
class Polity_relationship_to_preceding_entityListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_relationship_to_preceding_entity instances.
+ """
model = Polity_relationship_to_preceding_entity
template_name = "general/polity_relationship_to_preceding_entity/polity_relationship_to_preceding_entity_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_relationship_to_preceding_entitys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Relationship to Preceding Entity"
context["var_main_desc"] = "The polity relationship to preceding (quasi)polity"
@@ -2248,13 +4276,28 @@ def get_context_data(self, **kwargs):
class Polity_relationship_to_preceding_entityListViewAll(generic.ListView):
+ """
+ View for listing all Polity_relationship_to_preceding_entity instances.
+ """
model = Polity_relationship_to_preceding_entity
template_name = "general/polity_relationship_to_preceding_entity/polity_relationship_to_preceding_entity_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_relationship_to_preceding_entitys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_relationship_to_preceding_entity instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_relationship_to_preceding_entity instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2262,6 +4305,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Relationship to Preceding Entity"
context["var_main_desc"] = "The polity relationship to preceding (quasi)polity"
@@ -2275,12 +4329,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_relationship_to_preceding_entityDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_relationship_to_preceding_entity instance.
+ """
model = Polity_relationship_to_preceding_entity
template_name = "general/polity_relationship_to_preceding_entity/polity_relationship_to_preceding_entity_detail.html"
@permission_required('core.view_capital')
def polity_relationship_to_preceding_entity_download(request):
+ """
+ Download a CSV file of all Polity_relationship_to_preceding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_relationship_to_preceding_entity.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2299,6 +4368,18 @@ def polity_relationship_to_preceding_entity_download(request):
@permission_required('core.view_capital')
def polity_relationship_to_preceding_entity_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_relationship_to_preceding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_relationship_to_preceding_entitys.csv"'
@@ -2320,14 +4401,38 @@ def polity_relationship_to_preceding_entity_meta_download(request):
class Polity_preceding_entityCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_preceding_entity
form_class = Polity_preceding_entityForm
template_name = "general/polity_preceding_entity/polity_preceding_entity_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_preceding_entity-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# Extract query parameters
@@ -2371,14 +4476,30 @@ def get_context_data(self, **kwargs):
class Polity_preceding_entityUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_preceding_entity
form_class = Polity_preceding_entityForm
template_name = "general/polity_preceding_entity/polity_preceding_entity_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
+ """
+ Get the context data of the view.
+
+ :noindex:
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
+ context = super().get_context_data(**kwargs)
if self.object.polity and self.object.other_polity:
all_rels = Polity_preceding_entity.objects.filter(
@@ -2409,6 +4530,12 @@ def get_context_data(self, **kwargs):
return context
class Polity_preceding_entityDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_preceding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_preceding_entity
success_url = reverse_lazy('polity_preceding_entitys')
template_name = "core/delete_general.html"
@@ -2416,14 +4543,34 @@ class Polity_preceding_entityDelete(PermissionRequiredMixin, DeleteView):
class Polity_preceding_entityListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_preceding_entity instances.
+ """
model = Polity_preceding_entity
template_name = "general/polity_preceding_entity/polity_preceding_entity_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_preceding_entitys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Preceding Entity"
context["var_main_desc"] = "The preceding entity of a polity."
@@ -2437,13 +4584,28 @@ def get_context_data(self, **kwargs):
class Polity_preceding_entityListViewAll(generic.ListView):
+ """
+ View for listing all Polity_preceding_entity instances.
+ """
model = Polity_preceding_entity
template_name = "general/polity_preceding_entity/polity_preceding_entity_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_preceding_entitys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_preceding_entity instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_preceding_entity instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2451,6 +4613,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Preceding Entity"
context["var_main_desc"] = "The preceding entity of a polity."
@@ -2464,12 +4637,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_preceding_entityDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_preceding_entity instance.
+ """
model = Polity_preceding_entity
template_name = "general/polity_preceding_entity/polity_preceding_entity_detail.html"
@permission_required('core.view_capital')
def polity_preceding_entity_download(request):
+ """
+ Download a CSV file of all Polity_preceding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_preceding_entity.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2488,6 +4676,18 @@ def polity_preceding_entity_download(request):
@permission_required('core.view_capital')
def polity_preceding_entity_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_preceding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_preceding_entitys.csv"'
@@ -2509,14 +4709,38 @@ def polity_preceding_entity_meta_download(request):
class Polity_succeeding_entityCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_succeeding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_succeeding_entity
form_class = Polity_succeeding_entityForm
template_name = "general/polity_succeeding_entity/polity_succeeding_entity_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_succeeding_entity-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2530,18 +4754,41 @@ def get_context_data(self, **kwargs):
class Polity_succeeding_entityUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_succeeding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_succeeding_entity
form_class = Polity_succeeding_entityForm
template_name = "general/polity_succeeding_entity/polity_succeeding_entity_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Succeeding Entity"
return context
class Polity_succeeding_entityDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_succeeding_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_succeeding_entity
success_url = reverse_lazy('polity_succeeding_entitys')
template_name = "core/delete_general.html"
@@ -2549,14 +4796,34 @@ class Polity_succeeding_entityDelete(PermissionRequiredMixin, DeleteView):
class Polity_succeeding_entityListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_succeeding_entity instances.
+ """
model = Polity_succeeding_entity
template_name = "general/polity_succeeding_entity/polity_succeeding_entity_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_succeeding_entitys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Succeeding Entity"
context["var_main_desc"] = "The succeeding entity of a polity."
@@ -2570,13 +4837,28 @@ def get_context_data(self, **kwargs):
class Polity_succeeding_entityListViewAll(generic.ListView):
+ """
+ View for listing all Polity_succeeding_entity instances.
+ """
model = Polity_succeeding_entity
template_name = "general/polity_succeeding_entity/polity_succeeding_entity_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_succeeding_entitys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_succeeding_entity instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_succeeding_entity instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2584,6 +4866,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Succeeding Entity"
context["var_main_desc"] = "The succeeding entity of a polity."
@@ -2597,12 +4890,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_succeeding_entityDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_succeeding_entity instance.
+ """
model = Polity_succeeding_entity
template_name = "general/polity_succeeding_entity/polity_succeeding_entity_detail.html"
@permission_required('core.view_capital')
def polity_succeeding_entity_download(request):
+ """
+ Download a CSV file of all Polity_succeeding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_succeeding_entity.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2621,6 +4929,18 @@ def polity_succeeding_entity_download(request):
@permission_required('core.view_capital')
def polity_succeeding_entity_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_succeeding_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_succeeding_entitys.csv"'
@@ -2642,14 +4962,38 @@ def polity_succeeding_entity_meta_download(request):
class Polity_supracultural_entityCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_supracultural_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_supracultural_entity
form_class = Polity_supracultural_entityForm
template_name = "general/polity_supracultural_entity/polity_supracultural_entity_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_supracultural_entity-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2663,18 +5007,41 @@ def get_context_data(self, **kwargs):
class Polity_supracultural_entityUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_supracultural_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_supracultural_entity
form_class = Polity_supracultural_entityForm
template_name = "general/polity_supracultural_entity/polity_supracultural_entity_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Supracultural Entity"
return context
class Polity_supracultural_entityDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_supracultural_entity.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_supracultural_entity
success_url = reverse_lazy('polity_supracultural_entitys')
template_name = "core/delete_general.html"
@@ -2682,14 +5049,34 @@ class Polity_supracultural_entityDelete(PermissionRequiredMixin, DeleteView):
class Polity_supracultural_entityListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_supracultural_entity instances.
+ """
model = Polity_supracultural_entity
template_name = "general/polity_supracultural_entity/polity_supracultural_entity_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_supracultural_entitys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Supracultural Entity"
context["var_main_desc"] = "The supracultural entity of a polity."
@@ -2703,13 +5090,28 @@ def get_context_data(self, **kwargs):
class Polity_supracultural_entityListViewAll(generic.ListView):
+ """
+ View for listing all Polity_supracultural_entity instances.
+ """
model = Polity_supracultural_entity
template_name = "general/polity_supracultural_entity/polity_supracultural_entity_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_supracultural_entitys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_supracultural_entity instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_supracultural_entity instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2717,6 +5119,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Supracultural Entity"
context["var_main_desc"] = "The supracultural entity of a polity."
@@ -2730,12 +5143,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_supracultural_entityDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_supracultural_entity instance.
+ """
model = Polity_supracultural_entity
template_name = "general/polity_supracultural_entity/polity_supracultural_entity_detail.html"
@permission_required('core.view_capital')
def polity_supracultural_entity_download(request):
+ """
+ Download a CSV file of all Polity_supracultural_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_supracultural_entity.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2754,6 +5182,18 @@ def polity_supracultural_entity_download(request):
@permission_required('core.view_capital')
def polity_supracultural_entity_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_supracultural_entity instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_supracultural_entitys.csv"'
@@ -2775,14 +5215,38 @@ def polity_supracultural_entity_meta_download(request):
class Polity_scale_of_supracultural_interactionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_scale_of_supracultural_interaction.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_scale_of_supracultural_interaction
form_class = Polity_scale_of_supracultural_interactionForm
template_name = "general/polity_scale_of_supracultural_interaction/polity_scale_of_supracultural_interaction_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_scale_of_supracultural_interaction-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2796,18 +5260,41 @@ def get_context_data(self, **kwargs):
class Polity_scale_of_supracultural_interactionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_scale_of_supracultural_interaction.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_scale_of_supracultural_interaction
form_class = Polity_scale_of_supracultural_interactionForm
template_name = "general/polity_scale_of_supracultural_interaction/polity_scale_of_supracultural_interaction_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Scale of Supracultural Interaction"
return context
class Polity_scale_of_supracultural_interactionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_scale_of_supracultural_interaction.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_scale_of_supracultural_interaction
success_url = reverse_lazy('polity_scale_of_supracultural_interactions')
template_name = "core/delete_general.html"
@@ -2815,14 +5302,34 @@ class Polity_scale_of_supracultural_interactionDelete(PermissionRequiredMixin, D
class Polity_scale_of_supracultural_interactionListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_scale_of_supracultural_interaction instances.
+ """
model = Polity_scale_of_supracultural_interaction
template_name = "general/polity_scale_of_supracultural_interaction/polity_scale_of_supracultural_interaction_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_scale_of_supracultural_interactions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Scale of Supracultural Interaction"
context["var_main_desc"] = "The scale of Supra Cultural Interaction of a polity."
@@ -2836,13 +5343,28 @@ def get_context_data(self, **kwargs):
class Polity_scale_of_supracultural_interactionListViewAll(generic.ListView):
+ """
+ View for listing all Polity_scale_of_supracultural_interaction instances.
+ """
model = Polity_scale_of_supracultural_interaction
template_name = "general/polity_scale_of_supracultural_interaction/polity_scale_of_supracultural_interaction_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_scale_of_supracultural_interactions_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_scale_of_supracultural_interaction instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_scale_of_supracultural_interaction instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2850,6 +5372,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Scale of Supracultural Interaction"
context["var_main_desc"] = "The scale of Supra Cultural Interaction of a polity."
@@ -2863,12 +5396,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_scale_of_supracultural_interactionDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_scale_of_supracultural_interaction instance.
+ """
model = Polity_scale_of_supracultural_interaction
template_name = "general/polity_scale_of_supracultural_interaction/polity_scale_of_supracultural_interaction_detail.html"
@permission_required('core.view_capital')
def polity_scale_of_supracultural_interaction_download(request):
+ """
+ Download a CSV file of all Polity_scale_of_supracultural_interaction instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_scale_of_supracultural_interaction.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -2887,6 +5435,18 @@ def polity_scale_of_supracultural_interaction_download(request):
@permission_required('core.view_capital')
def polity_scale_of_supracultural_interaction_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_scale_of_supracultural_interaction instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_scale_of_supracultural_interactions.csv"'
@@ -2908,19 +5468,52 @@ def polity_scale_of_supracultural_interaction_meta_download(request):
class Polity_alternate_religion_genusCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_alternate_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_genus
form_class = Polity_alternate_religion_genusForm
template_name = "general/polity_alternate_religion_genus/polity_alternate_religion_genus_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion_genus' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion_genus'].choices = sorted(form.fields['alternate_religion_genus'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_genus-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2934,23 +5527,55 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religion_genusUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_alternate_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_genus
form_class = Polity_alternate_religion_genusForm
template_name = "general/polity_alternate_religion_genus/polity_alternate_religion_genus_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion_genus' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion_genus'].choices = sorted(form.fields['alternate_religion_genus'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Genus"
return context
class Polity_alternate_religion_genusDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_alternate_religion_genus.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_genus
success_url = reverse_lazy('polity_alternate_religion_genuss')
template_name = "core/delete_general.html"
@@ -2958,14 +5583,34 @@ class Polity_alternate_religion_genusDelete(PermissionRequiredMixin, DeleteView)
class Polity_alternate_religion_genusListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_alternate_religion_genus instances.
+ """
model = Polity_alternate_religion_genus
template_name = "general/polity_alternate_religion_genus/polity_alternate_religion_genus_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_genuss')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Genus"
context["var_main_desc"] = "The alternate religion genus of a polity."
@@ -2979,13 +5624,28 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religion_genusListViewAll(generic.ListView):
+ """
+ View for listing all Polity_alternate_religion_genus instances.
+ """
model = Polity_alternate_religion_genus
template_name = "general/polity_alternate_religion_genus/polity_alternate_religion_genus_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_genuss_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_alternate_religion_genus instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_alternate_religion_genus instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -2993,6 +5653,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Genus"
context["var_main_desc"] = "The alternate religion genus of a polity."
@@ -3006,12 +5677,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_alternate_religion_genusDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_alternate_religion_genus instance.
+ """
model = Polity_alternate_religion_genus
template_name = "general/polity_alternate_religion_genus/polity_alternate_religion_genus_detail.html"
@permission_required('core.view_capital')
def polity_alternate_religion_genus_download(request):
+ """
+ Download a CSV file of all Polity_alternate_religion_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_alternate_religion_genus.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3030,6 +5716,18 @@ def polity_alternate_religion_genus_download(request):
@permission_required('core.view_capital')
def polity_alternate_religion_genus_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_alternate_religion_genus instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_alternate_religion_genuss.csv"'
@@ -3051,19 +5749,52 @@ def polity_alternate_religion_genus_meta_download(request):
class Polity_alternate_religion_familyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_alternate_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_family
form_class = Polity_alternate_religion_familyForm
template_name = "general/polity_alternate_religion_family/polity_alternate_religion_family_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion_family' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion_family'].choices = sorted(form.fields['alternate_religion_family'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_family-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3077,23 +5808,55 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religion_familyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_alternate_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_family
form_class = Polity_alternate_religion_familyForm
template_name = "general/polity_alternate_religion_family/polity_alternate_religion_family_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion_family' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion_family'].choices = sorted(form.fields['alternate_religion_family'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Family"
return context
class Polity_alternate_religion_familyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_alternate_religion_family.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion_family
success_url = reverse_lazy('polity_alternate_religion_familys')
template_name = "core/delete_general.html"
@@ -3101,14 +5864,34 @@ class Polity_alternate_religion_familyDelete(PermissionRequiredMixin, DeleteView
class Polity_alternate_religion_familyListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_alternate_religion_family instances.
+ """
model = Polity_alternate_religion_family
template_name = "general/polity_alternate_religion_family/polity_alternate_religion_family_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_familys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Family"
context["var_main_desc"] = "The alternate religion family of a polity."
@@ -3122,13 +5905,28 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religion_familyListViewAll(generic.ListView):
+ """
+ View for listing all Polity_alternate_religion_family instances.
+ """
model = Polity_alternate_religion_family
template_name = "general/polity_alternate_religion_family/polity_alternate_religion_family_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion_familys_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_alternate_religion_family instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_alternate_religion_family instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -3136,6 +5934,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion Family"
context["var_main_desc"] = "The alternate religion family of a polity."
@@ -3149,12 +5958,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_alternate_religion_familyDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_alternate_religion_family instance.
+ """
model = Polity_alternate_religion_family
template_name = "general/polity_alternate_religion_family/polity_alternate_religion_family_detail.html"
@permission_required('core.view_capital')
def polity_alternate_religion_family_download(request):
+ """
+ Download a CSV file of all Polity_alternate_religion_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_alternate_religion_family.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3173,6 +5997,18 @@ def polity_alternate_religion_family_download(request):
@permission_required('core.view_capital')
def polity_alternate_religion_family_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_alternate_religion_family instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_alternate_religion_familys.csv"'
@@ -3194,19 +6030,52 @@ def polity_alternate_religion_family_meta_download(request):
class Polity_alternate_religionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_alternate_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion
form_class = Polity_alternate_religionForm
template_name = "general/polity_alternate_religion/polity_alternate_religion_form.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion'].choices = sorted(form.fields['alternate_religion'].choices, key=lambda x: x[1].lower())
return form
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religion-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3220,23 +6089,55 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_alternate_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion
form_class = Polity_alternate_religionForm
template_name = "general/polity_alternate_religion/polity_alternate_religion_update.html"
permission_required = 'core.add_capital'
def get_form(self, form_class=None):
+ """
+ Get the form of the view. Sort the choices of the 'alternate_religion' field.
+
+ Args:
+ form_class: The form class. Defaults to None.
+
+ Returns:
+ Form: The form of the view.
+ """
form = super().get_form(form_class)
form.fields['alternate_religion'].choices = sorted(form.fields['alternate_religion'].choices, key=lambda x: x[1].lower())
return form
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion"
return context
class Polity_alternate_religionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_alternate_religion.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_alternate_religion
success_url = reverse_lazy('polity_alternate_religions')
template_name = "core/delete_general.html"
@@ -3244,14 +6145,34 @@ class Polity_alternate_religionDelete(PermissionRequiredMixin, DeleteView):
class Polity_alternate_religionListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_alternate_religion instances.
+ """
model = Polity_alternate_religion
template_name = "general/polity_alternate_religion/polity_alternate_religion_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion"
context["var_main_desc"] = "The alternate religion of a polity."
@@ -3265,13 +6186,28 @@ def get_context_data(self, **kwargs):
class Polity_alternate_religionListViewAll(generic.ListView):
+ """
+ View for listing all Polity_alternate_religion instances.
+ """
model = Polity_alternate_religion
template_name = "general/polity_alternate_religion/polity_alternate_religion_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_alternate_religions_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_alternate_religion instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_alternate_religion instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -3279,6 +6215,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Alternate Religion"
context["var_main_desc"] = "The alternate religion of a polity."
@@ -3292,12 +6239,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_alternate_religionDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_alternate_religion instance.
+ """
model = Polity_alternate_religion
template_name = "general/polity_alternate_religion/polity_alternate_religion_detail.html"
@permission_required('core.view_capital')
def polity_alternate_religion_download(request):
+ """
+ Download a CSV file of all Polity_alternate_religion instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_alternate_religion.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3316,6 +6278,18 @@ def polity_alternate_religion_download(request):
@permission_required('core.view_capital')
def polity_alternate_religion_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_alternate_religion instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_alternate_religions.csv"'
@@ -3337,14 +6311,38 @@ def polity_alternate_religion_meta_download(request):
class Polity_expertCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Polity_expert.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_expert
form_class = Polity_expertForm
template_name = "general/polity_expert/polity_expert_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_expert-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3358,18 +6356,41 @@ def get_context_data(self, **kwargs):
class Polity_expertUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_expert.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_expert
form_class = Polity_expertForm
template_name = "general/polity_expert/polity_expert_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Expert"
return context
class Polity_expertDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_expert.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_expert
success_url = reverse_lazy('polity_experts')
template_name = "core/delete_general.html"
@@ -3377,14 +6398,34 @@ class Polity_expertDelete(PermissionRequiredMixin, DeleteView):
class Polity_expertListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_expert instances.
+ """
model = Polity_expert
template_name = "general/polity_expert/polity_expert_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_experts')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Expert"
context["var_main_desc"] = "The expert of a polity."
@@ -3398,13 +6439,28 @@ def get_context_data(self, **kwargs):
class Polity_expertListViewAll(generic.ListView):
+ """
+ View for listing all Polity_expert instances.
+ """
model = Polity_expert
template_name = "general/polity_expert/polity_expert_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_experts_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_expert instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_expert instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -3412,6 +6468,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Expert"
context["var_main_desc"] = "The expert of a polity."
@@ -3425,12 +6492,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_expertDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_expert instance.
+ """
model = Polity_expert
template_name = "general/polity_expert/polity_expert_detail.html"
@permission_required('core.view_capital')
def polity_expert_download(request):
+ """
+ Download a CSV file of all Polity_expert instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_expert.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3449,6 +6531,18 @@ def polity_expert_download(request):
@permission_required('core.view_capital')
def polity_expert_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_expert instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_experts.csv"'
@@ -3470,14 +6564,38 @@ def polity_expert_meta_download(request):
class Polity_editorCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Polity_editor.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_editor
form_class = Polity_editorForm
template_name = "general/polity_editor/polity_editor_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_editor-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3491,18 +6609,41 @@ def get_context_data(self, **kwargs):
class Polity_editorUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_editor.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_editor
form_class = Polity_editorForm
template_name = "general/polity_editor/polity_editor_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Editor"
return context
class Polity_editorDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_editor.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_editor
success_url = reverse_lazy('polity_editors')
template_name = "core/delete_general.html"
@@ -3510,14 +6651,34 @@ class Polity_editorDelete(PermissionRequiredMixin, DeleteView):
class Polity_editorListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_editor instances.
+ """
model = Polity_editor
template_name = "general/polity_editor/polity_editor_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_editors')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Editor"
context["var_main_desc"] = "The editor of a polity."
@@ -3531,13 +6692,28 @@ def get_context_data(self, **kwargs):
class Polity_editorListViewAll(generic.ListView):
+ """
+ View for listing all Polity_editor instances.
+ """
model = Polity_editor
template_name = "general/polity_editor/polity_editor_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_editors_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_editor instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_editor instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -3545,6 +6721,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Editor"
context["var_main_desc"] = "The editor of a polity."
@@ -3558,12 +6745,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_editorDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_editor instance.
+ """
model = Polity_editor
template_name = "general/polity_editor/polity_editor_detail.html"
@permission_required('core.view_capital')
def polity_editor_download(request):
+ """
+ Download a CSV file of all Polity_editor instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_editor.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3582,6 +6784,18 @@ def polity_editor_download(request):
@permission_required('core.view_capital')
def polity_editor_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_editor instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_editors.csv"'
@@ -3603,14 +6817,38 @@ def polity_editor_meta_download(request):
class Polity_religious_traditionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_religious_tradition.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religious_tradition
form_class = Polity_religious_traditionForm
template_name = "general/polity_religious_tradition/polity_religious_tradition_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religious_tradition-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3624,18 +6862,41 @@ def get_context_data(self, **kwargs):
class Polity_religious_traditionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_religious_tradition.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religious_tradition
form_class = Polity_religious_traditionForm
template_name = "general/polity_religious_tradition/polity_religious_tradition_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religious Tradition"
return context
class Polity_religious_traditionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_religious_tradition.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_religious_tradition
success_url = reverse_lazy('polity_religious_traditions')
template_name = "core/delete_general.html"
@@ -3643,14 +6904,34 @@ class Polity_religious_traditionDelete(PermissionRequiredMixin, DeleteView):
class Polity_religious_traditionListView(generic.ListView):
+ """
+ Paginated view for listing all Polity_religious_tradition instances.
+ """
model = Polity_religious_tradition
template_name = "general/polity_religious_tradition/polity_religious_tradition_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religious_traditions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religious Tradition"
context["var_main_desc"] = "The details of religious traditions."
@@ -3664,13 +6945,28 @@ def get_context_data(self, **kwargs):
class Polity_religious_traditionListViewAll(generic.ListView):
+ """
+ View for listing all Polity_religious_tradition instances.
+ """
model = Polity_religious_tradition
template_name = "general/polity_religious_tradition/polity_religious_tradition_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_religious_traditions_all')
def get_queryset(self):
+ """
+ Get the queryset of Polity_religious_tradition instances.
+
+ Returns:
+ QuerySet: The queryset of Polity_religious_tradition instances.
+ """
order = self.request.GET.get('orderby', 'year_from')
order2 = self.request.GET.get('orderby2', 'year_to')
#orders = [order, order2]
@@ -3678,6 +6974,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Religious Tradition"
context["var_main_desc"] = "The details of religious traditions."
@@ -3691,12 +6998,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_religious_traditionDetailView(generic.DetailView):
+ """
+ View for displaying a single Polity_religious_tradition instance.
+ """
model = Polity_religious_tradition
template_name = "general/polity_religious_tradition/polity_religious_tradition_detail.html"
@permission_required('core.view_capital')
def polity_religious_tradition_download(request):
+ """
+ Download a CSV file of all Polity_religious_tradition instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_religious_tradition.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -3715,6 +7037,18 @@ def polity_religious_tradition_download(request):
@permission_required('core.view_capital')
def polity_religious_tradition_meta_download(request):
+ """
+ Download a CSV file of the meta data for Polity_religious_tradition instances.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="polity_religious_traditions.csv"'
@@ -3886,6 +7220,18 @@ def generalvars(request):
@permission_required('core.view_capital')
def download_csv_all_general(request):
+ """
+ Download a CSV file of all general variables. This includes all models in the "general" app.
+
+ Note:
+ This view is restricted to users with the 'view_capital' permission.
+
+ Args:
+ request: The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
# Fetch all models in the "general" app
app_name = 'general'
app_models = apps.get_app_config(app_name).get_models()
@@ -3936,6 +7282,12 @@ def download_csv_all_general(request):
######EMAIL_CONFIRMATION_BRANCH is the keyword that needs to be searched
def send_test_email():
+ """
+ Send a test email.
+
+ Returns:
+ None
+ """
send_mail(
'Test Email',
'This is a test email from Django.',
diff --git a/seshat/apps/rt/forms.py b/seshat/apps/rt/forms.py
index 31751da52..598dc835e 100644
--- a/seshat/apps/rt/forms.py
+++ b/seshat/apps/rt/forms.py
@@ -53,7 +53,13 @@
# widgets['sc_ra'] = forms.Select(attrs={'class': 'form-control mb-3', })
class Widespread_religionForm(forms.ModelForm):
+ """
+ Form for creating and updating the Widespread_religion model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Widespread_religion
fields = commonfields.copy()
fields.append('order')
@@ -71,7 +77,13 @@ class Meta:
widgets['degree_of_prevalence'] = forms.Select(attrs={'class': 'form-control mb-3', })
class Official_religionForm(forms.ModelForm):
+ """
+ Form for creating and updating creating and updating the Official_religion model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Official_religion
fields = commonfields.copy()
fields.append('coded_value')
@@ -82,7 +94,13 @@ class Meta:
class Elites_religionForm(forms.ModelForm):
+ """
+ Form for creating and updating the Elites_religion model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Elites_religion
fields = commonfields.copy()
fields.append('coded_value')
@@ -93,7 +111,13 @@ class Meta:
##########################################
class Theo_sync_dif_relForm(forms.ModelForm):
+ """
+ Form for creating and updating the Theo_sync_dif_rel model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Theo_sync_dif_rel
fields = commonfields.copy()
fields.append('coded_value')
@@ -104,7 +128,13 @@ class Meta:
class Sync_rel_pra_ind_beliForm(forms.ModelForm):
+ """
+ Form for creating and updating the Sync_rel_pra_ind_beli model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Sync_rel_pra_ind_beli
fields = commonfields.copy()
fields.append('coded_value')
@@ -115,7 +145,13 @@ class Meta:
class Religious_fragmentationForm(forms.ModelForm):
+ """
+ Form for creating and updating the Religious_fragmentation model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Religious_fragmentation
fields = commonfields.copy()
fields.append('coded_value')
@@ -126,7 +162,13 @@ class Meta:
class Gov_vio_freq_rel_grpForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_vio_freq_rel_grp model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_vio_freq_rel_grp
fields = commonfields.copy()
fields.append('coded_value')
@@ -137,7 +179,13 @@ class Meta:
class Gov_res_pub_worForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_pub_wor model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_pub_wor
fields = commonfields.copy()
fields.append('coded_value')
@@ -148,7 +196,13 @@ class Meta:
class Gov_res_pub_prosForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_pub_pros model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_pub_pros
fields = commonfields.copy()
fields.append('coded_value')
@@ -159,7 +213,13 @@ class Meta:
class Gov_res_convForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_conv model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_conv
fields = commonfields.copy()
fields.append('coded_value')
@@ -170,7 +230,13 @@ class Meta:
class Gov_press_convForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_press_conv model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_press_conv
fields = commonfields.copy()
fields.append('coded_value')
@@ -181,7 +247,13 @@ class Meta:
class Gov_res_prop_own_for_rel_grpForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_prop_own_for_rel_grp model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_prop_own_for_rel_grp
fields = commonfields.copy()
fields.append('coded_value')
@@ -192,7 +264,13 @@ class Meta:
class Tax_rel_adh_act_insForm(forms.ModelForm):
+ """
+ Form for creating and updating the Tax_rel_adh_act_ins model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Tax_rel_adh_act_ins
fields = commonfields.copy()
fields.append('coded_value')
@@ -203,7 +281,13 @@ class Meta:
class Gov_obl_rel_grp_ofc_recoForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_obl_rel_grp_ofc_reco model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_obl_rel_grp_ofc_reco
fields = commonfields.copy()
fields.append('coded_value')
@@ -214,7 +298,13 @@ class Meta:
class Gov_res_cons_rel_builForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_cons_rel_buil model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_cons_rel_buil
fields = commonfields.copy()
fields.append('coded_value')
@@ -225,7 +315,13 @@ class Meta:
class Gov_res_rel_eduForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_rel_edu model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_rel_edu
fields = commonfields.copy()
fields.append('coded_value')
@@ -236,7 +332,13 @@ class Meta:
class Gov_res_cir_rel_litForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_res_cir_rel_lit model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_res_cir_rel_lit
fields = commonfields.copy()
fields.append('coded_value')
@@ -247,7 +349,13 @@ class Meta:
class Gov_dis_rel_grp_occ_funForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_dis_rel_grp_occ_fun model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_dis_rel_grp_occ_fun
fields = commonfields.copy()
fields.append('coded_value')
@@ -258,7 +366,13 @@ class Meta:
class Soc_vio_freq_rel_grpForm(forms.ModelForm):
+ """
+ Form for creating and updating the Soc_vio_freq_rel_grp model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Soc_vio_freq_rel_grp
fields = commonfields.copy()
fields.append('coded_value')
@@ -269,7 +383,13 @@ class Meta:
class Soc_dis_rel_grp_occ_funForm(forms.ModelForm):
+ """
+ Form for creating and updating the Soc_dis_rel_grp_occ_fun model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Soc_dis_rel_grp_occ_fun
fields = commonfields.copy()
fields.append('coded_value')
@@ -280,7 +400,13 @@ class Meta:
class Gov_press_conv_for_agaForm(forms.ModelForm):
+ """
+ Form for creating and updating the Gov_press_conv_for_aga model.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gov_press_conv_for_aga
fields = commonfields.copy()
fields.append('coded_value')
diff --git a/seshat/apps/rt/models.py b/seshat/apps/rt/models.py
index 8f5b14baf..0c5e89d19 100644
--- a/seshat/apps/rt/models.py
+++ b/seshat/apps/rt/models.py
@@ -15,7 +15,6 @@
from ..core.models import SeshatCommon, Certainty, Tags, Section, Subsection, Religion
from seshat.apps.accounts.models import Seshat_Expert
-# Create your models here.
@@ -57,6 +56,23 @@
###################
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -64,9 +80,50 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ', '.join(['' + citation.__str__() + ' ' for citation in self.citations.all()[:2]])
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': mark_safe(' The start year is bigger than the end year!'),
@@ -93,6 +150,9 @@ def clean_times(self):
class Widespread_religion(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Widespread_religion")
order = models.CharField(max_length=10, choices=ORDER_CHOICES)
widespread_religion = models.ForeignKey(Religion, on_delete=models.SET_NULL, related_name="%(app_label)s_%(class)s_related",
@@ -100,15 +160,42 @@ class Widespread_religion(SeshatCommon):
degree_of_prevalence = models.CharField(max_length=500, choices=PREVALENCE_CHOICES, null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Widespread_religion'
verbose_name_plural = 'Widespread_religions'
ordering = ['order']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "widespread_religion"
@@ -127,6 +214,13 @@ def clean_name_dynamic(self):
return "Widespread religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Widespread Religion"
def show_value(self):
@@ -156,6 +250,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('widespread_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -163,21 +265,58 @@ def __str__(self) -> str:
class Official_religion(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Official_religion")
coded_value = models.ForeignKey(Religion, on_delete=models.SET_NULL, related_name="%(app_label)s_%(class)s_related", related_query_name="%(app_label)s_%(class)s",null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Official_religion'
verbose_name_plural = 'Official_religions'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "official_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Official Religion"
def show_value(self):
@@ -202,6 +341,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('official_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -209,21 +356,58 @@ def __str__(self) -> str:
class Elites_religion(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Elites_religion")
coded_value = models.ForeignKey(Religion, on_delete=models.SET_NULL, related_name="%(app_label)s_%(class)s_related", related_query_name="%(app_label)s_%(class)s", null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Elites_religion'
verbose_name_plural = 'Elites_religions'
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "elites_religion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Elites Religion"
def show_value(self):
@@ -248,6 +432,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('elites_religion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -256,25 +448,80 @@ def __str__(self) -> str:
############################
class Theo_sync_dif_rel(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Theo_sync_dif_rel")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Theo_sync_dif_rel'
verbose_name_plural = 'Theological Syncretism of Different Religionss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "theo_sync_dif_rel"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Theological Syncretism of Different Religions"
def show_value(self):
@@ -299,6 +546,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('theo_sync_dif_rel-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -306,25 +561,80 @@ def __str__(self) -> str:
class Sync_rel_pra_ind_beli(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Sync_rel_pra_ind_beli")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Sync_rel_pra_ind_beli'
verbose_name_plural = 'Syncretism of Religious Practices at the Level of Individual Believerss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "sync_rel_pra_ind_beli"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Syncretism of Religious Practices at the Level of Individual Believers"
def show_value(self):
@@ -349,6 +659,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('sync_rel_pra_ind_beli-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -356,25 +674,80 @@ def __str__(self) -> str:
class Religious_fragmentation(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Religious_fragmentation")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Religious_fragmentation'
verbose_name_plural = 'Religious Fragmentations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "religious_fragmentation"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Religious Fragmentation"
def show_value(self):
@@ -399,6 +772,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('religious_fragmentation-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -406,25 +787,80 @@ def __str__(self) -> str:
class Gov_vio_freq_rel_grp(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_vio_freq_rel_grp")
coded_value = models.CharField(max_length=500, choices=FREQUENCY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_vio_freq_rel_grp'
verbose_name_plural = 'Frequency of Governmental Violence Against Religious Groupss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_vio_freq_rel_grp"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Frequency of Governmental Violence Against Religious Groups"
def show_value(self):
@@ -449,6 +885,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_vio_freq_rel_grp-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -456,25 +900,80 @@ def __str__(self) -> str:
class Gov_res_pub_wor(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_pub_wor")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_pub_wor'
verbose_name_plural = 'Government Restrictions on Public Worships'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_pub_wor"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Public Worship"
def show_value(self):
@@ -499,6 +998,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_pub_wor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -506,25 +1013,80 @@ def __str__(self) -> str:
class Gov_res_pub_pros(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_pub_pros")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_pub_pros'
verbose_name_plural = 'Government Restrictions on Public Proselytizings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_pub_pros"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Public Proselytizing"
def show_value(self):
@@ -549,6 +1111,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_pub_pros-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -556,25 +1126,80 @@ def __str__(self) -> str:
class Gov_res_conv(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_conv")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_conv'
verbose_name_plural = 'Government Restrictions on Conversions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_conv"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Conversion"
def show_value(self):
@@ -599,6 +1224,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_conv-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -606,25 +1239,80 @@ def __str__(self) -> str:
class Gov_press_conv(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_press_conv")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_press_conv'
verbose_name_plural = 'Government Pressure to Converts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_press_conv"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Pressure to Convert"
def show_value(self):
@@ -649,6 +1337,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_press_conv-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -656,25 +1352,80 @@ def __str__(self) -> str:
class Gov_res_prop_own_for_rel_grp(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_prop_own_for_rel_grp")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_prop_own_for_rel_grp'
verbose_name_plural = 'Government Restrictions on Property Ownership for Adherents of Any Religious Groups'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_prop_own_for_rel_grp"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Property Ownership for Adherents of Any Religious Group"
def show_value(self):
@@ -699,6 +1450,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_prop_own_for_rel_grp-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -706,25 +1465,80 @@ def __str__(self) -> str:
class Tax_rel_adh_act_ins(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Tax_rel_adh_act_ins")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Tax_rel_adh_act_ins'
verbose_name_plural = 'Taxes Based on Religious Adherence or on Religious Activities and Institutionss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "tax_rel_adh_act_ins"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Taxes Based on Religious Adherence or on Religious Activities and Institutions"
def show_value(self):
@@ -749,6 +1563,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('tax_rel_adh_act_ins-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -756,25 +1578,80 @@ def __str__(self) -> str:
class Gov_obl_rel_grp_ofc_reco(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_obl_rel_grp_ofc_reco")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_obl_rel_grp_ofc_reco'
verbose_name_plural = 'Governmental Obligations for Religious Groups to Apply for Official Recognitions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_obl_rel_grp_ofc_reco"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Governmental Obligations for Religious Groups to Apply for Official Recognition"
def show_value(self):
@@ -799,6 +1676,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_obl_rel_grp_ofc_reco-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -806,25 +1691,80 @@ def __str__(self) -> str:
class Gov_res_cons_rel_buil(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_cons_rel_buil")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_cons_rel_buil'
verbose_name_plural = 'Government Restrictions on Construction of Religious Buildingss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_cons_rel_buil"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Construction of Religious Buildings"
def show_value(self):
@@ -849,6 +1789,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_cons_rel_buil-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -856,25 +1804,80 @@ def __str__(self) -> str:
class Gov_res_rel_edu(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_rel_edu")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_rel_edu'
verbose_name_plural = 'Government Restrictions on Religious Educations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_rel_edu"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Religious Education"
def show_value(self):
@@ -899,6 +1902,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_rel_edu-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -906,25 +1917,80 @@ def __str__(self) -> str:
class Gov_res_cir_rel_lit(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_res_cir_rel_lit")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_res_cir_rel_lit'
verbose_name_plural = 'Government Restrictions on Circulation of Religious Literatures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_res_cir_rel_lit"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Restrictions on Circulation of Religious Literature"
def show_value(self):
@@ -949,6 +2015,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_res_cir_rel_lit-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -956,25 +2030,80 @@ def __str__(self) -> str:
class Gov_dis_rel_grp_occ_fun(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_dis_rel_grp_occ_fun")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_dis_rel_grp_occ_fun'
verbose_name_plural = 'Government Discrimination Against Religious Groups Taking up Certain Occupations or Functionss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_dis_rel_grp_occ_fun"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Government Discrimination Against Religious Groups Taking up Certain Occupations or Functions"
def show_value(self):
@@ -999,6 +2128,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_dis_rel_grp_occ_fun-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1006,25 +2143,80 @@ def __str__(self) -> str:
class Soc_vio_freq_rel_grp(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Soc_vio_freq_rel_grp")
coded_value = models.CharField(max_length=500, choices=FREQUENCY_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Soc_vio_freq_rel_grp'
verbose_name_plural = 'Frequency of Societal Violence Against Religious Groupss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "soc_vio_freq_rel_grp"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Frequency of Societal Violence Against Religious Groups"
def show_value(self):
@@ -1049,6 +2241,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('soc_vio_freq_rel_grp-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1056,25 +2256,80 @@ def __str__(self) -> str:
class Soc_dis_rel_grp_occ_fun(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Soc_dis_rel_grp_occ_fun")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Soc_dis_rel_grp_occ_fun'
verbose_name_plural = 'Societal Discrimination Against Religious Groups Taking up Certain Occupations or Functionss'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "soc_dis_rel_grp_occ_fun"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Societal Discrimination Against Religious Groups Taking up Certain Occupations or Functions"
def show_value(self):
@@ -1099,6 +2354,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('soc_dis_rel_grp_occ_fun-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1106,25 +2369,80 @@ def __str__(self) -> str:
class Gov_press_conv_for_aga(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Gov_press_conv_for_aga")
coded_value = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gov_press_conv_for_aga'
verbose_name_plural = 'Societal Pressure to Convert or Against Conversions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gov_press_conv_for_aga"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Societal Pressure to Convert or Against Conversion"
def show_value(self):
@@ -1149,6 +2467,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gov_press_conv_for_aga-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/rt/tests.py b/seshat/apps/rt/tests.py
index c2629a3ab..e69de29bb 100644
--- a/seshat/apps/rt/tests.py
+++ b/seshat/apps/rt/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
\ No newline at end of file
diff --git a/seshat/apps/rt/views.py b/seshat/apps/rt/views.py
index 5d43fc83f..36ba91934 100644
--- a/seshat/apps/rt/views.py
+++ b/seshat/apps/rt/views.py
@@ -45,7 +45,15 @@
def rtvars(request):
+ """
+ View function for the RT variables page.
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the rendered RT variables page.
+ """
app_name = 'rt' # Replace with your app name
models_1 = apps.get_app_config(app_name).get_models()
@@ -125,6 +133,18 @@ def rtvars(request):
# Define a custom test function to check for the 'core.add_capital' permission
def 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.
+
+ Args:
+ user (User): The user object.
+
+ Returns:
+ bool: True if the user has the 'core.add_capital' permission, False otherwise.
+ """
return user.has_perm('core.add_capital')
@@ -136,6 +156,23 @@ def has_add_capital_permission(user):
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered detail page.
+ """
# Retrieve the object for the given model class
obj = get_object_or_404(model_class, pk=pk)
form_inline_new = SeshatCommentPartForm2(request.POST)
@@ -158,8 +195,25 @@ def dynamic_detail_view(request, pk, model_class, myvar, var_name_display):
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered create page.
+ """
if x_name in ["widespread_religion",]:
x_name_1 = "order"
x_name_2 = "widespread_religion"
@@ -227,6 +281,28 @@ def dynamic_create_view(request, form_class, x_name, myvar, my_exp, var_section,
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def dynamic_update_view(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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered update page.
+ """
# Retrieve the object based on the object_id
my_object = model_class.objects.get(id=object_id)
@@ -303,6 +379,25 @@ def dynamic_update_view(request, object_id, form_class, model_class, x_name, myv
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered list page.
+ """
if var_name in ["widespread_religion",]:
object_list = model_class.objects.all().order_by('polity_id', 'order')
else:
@@ -372,6 +467,21 @@ def generic_list_view(request, model_class, var_name, var_name_display, var_sect
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the CSV file.
+ """
items = model_class.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -400,6 +510,24 @@ def generic_download(request, model_class, var_name):
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the CSV file.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = f'attachment; filename="metadata_{var_name}s.csv"'
@@ -424,6 +552,22 @@ def generic_metadata_download(request, var_name, var_name_display, var_section,
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered confirmation page.
+ """
permission_required = 'core.add_capital'
# Retrieve the object for the given model class
@@ -447,6 +591,22 @@ def confirm_delete_view(request, model_class, pk, var_name):
@permission_required('core.add_capital', raise_exception=True)
@user_passes_test(has_add_capital_permission, login_url='permission_denied')
def 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.
+
+ Args:
+ 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:
+ HttpResponse: The response object that contains the rendered confirmation page.
+ """
permission_required = 'core.add_capital'
# Retrieve the object for the given model class
obj = get_object_or_404(model_class, pk=pk)
@@ -468,6 +628,18 @@ def delete_object_view(request, model_class, pk, var_name):
@permission_required('core.view_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the CSV file.
+ """
# Fetch all models in the "socomp" app
app_name = 'rt' # Replace with your app name
app_models = apps.get_app_config(app_name).get_models()
@@ -505,6 +677,18 @@ def download_csv_all_rt(request):
@permission_required('core.view_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the rendered problematic data table.
+ """
# Fetch all models in the "socomp" app
app_name = 'rt' # Replace with your app name
app_models = apps.get_app_config(app_name).get_models()
@@ -523,6 +707,18 @@ def show_problematic_rt_data_table(request):
@permission_required('core.view_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the CSV file.
+ """
# Fetch all models in the "socomp" app
app_name = 'rt' # Replace with your app name
app_models = apps.get_app_config(app_name).get_models()
@@ -560,6 +756,18 @@ def download_csv_religious_landscape(request):
@permission_required('core.view_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the CSV file.
+ """
# Fetch all models in the "socomp" app
app_name = 'rt' # Replace with your app name
app_models = apps.get_app_config(app_name).get_models()
@@ -597,6 +805,18 @@ def download_csv_government_restrictions(request):
@permission_required('core.view_capital')
def 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.
+
+ Args:
+ request (HttpRequest): The request object used to generate this page.
+
+ Returns:
+ HttpResponse: The response object that contains the CSV file.
+ """
# Fetch all models in the "socomp" app
app_name = 'rt' # Replace with your app name
app_models = apps.get_app_config(app_name).get_models()
@@ -630,4 +850,4 @@ def download_csv_societal_restrictions(request):
obj.polity.long_name, obj.polity.new_name, obj.polity.name, obj.show_value_from(), obj.show_value_to(), obj.get_tag_display(), obj.is_disputed, obj.is_uncertain,
obj.expert_reviewed, obj.drb_reviewed,])
- return response
\ No newline at end of file
+ return response
diff --git a/seshat/apps/sc/forms.py b/seshat/apps/sc/forms.py
index e8a680b17..d7ef1cf31 100644
--- a/seshat/apps/sc/forms.py
+++ b/seshat/apps/sc/forms.py
@@ -44,7 +44,13 @@
}
class RaForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Ra
fields = commonfields.copy()
fields.append('sc_ra')
@@ -55,7 +61,13 @@ class Meta:
class Polity_territoryForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_territory
fields = commonfields.copy()
fields.append('polity_territory_from')
@@ -68,7 +80,13 @@ class Meta:
class Polity_populationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polity_population
fields = commonfields.copy()
fields.append('polity_population_from')
@@ -81,7 +99,13 @@ class Meta:
class Population_of_the_largest_settlementForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Population_of_the_largest_settlement
fields = commonfields.copy()
fields.append('population_of_the_largest_settlement_from')
@@ -94,7 +118,13 @@ class Meta:
class Settlement_hierarchyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Settlement_hierarchy
fields = commonfields.copy()
fields.append('settlement_hierarchy_from')
@@ -107,7 +137,13 @@ class Meta:
class Administrative_levelForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Administrative_level
fields = commonfields.copy()
fields.append('administrative_level_from')
@@ -120,7 +156,13 @@ class Meta:
class Religious_levelForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Religious_level
fields = commonfields.copy()
fields.append('religious_level_from')
@@ -133,7 +175,13 @@ class Meta:
class Military_levelForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Military_level
fields = commonfields.copy()
fields.append('military_level_from')
@@ -146,7 +194,13 @@ class Meta:
class Professional_military_officerForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Professional_military_officer
fields = commonfields.copy()
fields.append('professional_military_officer')
@@ -157,7 +211,13 @@ class Meta:
class Professional_soldierForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Professional_soldier
fields = commonfields.copy()
fields.append('professional_soldier')
@@ -168,7 +228,13 @@ class Meta:
class Professional_priesthoodForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Professional_priesthood
fields = commonfields.copy()
fields.append('professional_priesthood')
@@ -179,7 +245,13 @@ class Meta:
class Full_time_bureaucratForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Full_time_bureaucrat
fields = commonfields.copy()
fields.append('full_time_bureaucrat')
@@ -190,7 +262,13 @@ class Meta:
class Examination_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Examination_system
fields = commonfields.copy()
fields.append('examination_system')
@@ -201,7 +279,13 @@ class Meta:
class Merit_promotionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Merit_promotion
fields = commonfields.copy()
fields.append('merit_promotion')
@@ -212,7 +296,13 @@ class Meta:
class Specialized_government_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Specialized_government_building
fields = commonfields.copy()
fields.append('specialized_government_building')
@@ -223,7 +313,13 @@ class Meta:
class Formal_legal_codeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Formal_legal_code
fields = commonfields.copy()
fields.append('formal_legal_code')
@@ -234,7 +330,13 @@ class Meta:
class JudgeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Judge
fields = commonfields.copy()
fields.append('judge')
@@ -245,7 +347,13 @@ class Meta:
class CourtForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Court
fields = commonfields.copy()
fields.append('court')
@@ -256,7 +364,13 @@ class Meta:
class Professional_lawyerForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Professional_lawyer
fields = commonfields.copy()
fields.append('professional_lawyer')
@@ -267,7 +381,13 @@ class Meta:
class Irrigation_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Irrigation_system
fields = commonfields.copy()
fields.append('irrigation_system')
@@ -278,7 +398,13 @@ class Meta:
class Drinking_water_supply_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Drinking_water_supply_system
fields = commonfields.copy()
fields.append('drinking_water_supply_system')
@@ -289,7 +415,13 @@ class Meta:
class MarketForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Market
fields = commonfields.copy()
fields.append('market')
@@ -300,7 +432,13 @@ class Meta:
class Food_storage_siteForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Food_storage_site
fields = commonfields.copy()
fields.append('food_storage_site')
@@ -311,7 +449,13 @@ class Meta:
class RoadForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Road
fields = commonfields.copy()
fields.append('road')
@@ -322,7 +466,13 @@ class Meta:
class BridgeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Bridge
fields = commonfields.copy()
fields.append('bridge')
@@ -333,7 +483,13 @@ class Meta:
class CanalForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Canal
fields = commonfields.copy()
fields.append('canal')
@@ -344,7 +500,13 @@ class Meta:
class PortForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Port
fields = commonfields.copy()
fields.append('port')
@@ -355,7 +517,13 @@ class Meta:
class Mines_or_quarryForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Mines_or_quarry
fields = commonfields.copy()
fields.append('mines_or_quarry')
@@ -366,7 +534,13 @@ class Meta:
class Mnemonic_deviceForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Mnemonic_device
fields = commonfields.copy()
fields.append('mnemonic_device')
@@ -377,7 +551,13 @@ class Meta:
class Nonwritten_recordForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Nonwritten_record
fields = commonfields.copy()
fields.append('nonwritten_record')
@@ -388,7 +568,13 @@ class Meta:
class Written_recordForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Written_record
fields = commonfields.copy()
fields.append('written_record')
@@ -399,7 +585,13 @@ class Meta:
class ScriptForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Script
fields = commonfields.copy()
fields.append('script')
@@ -410,7 +602,13 @@ class Meta:
class Non_phonetic_writingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Non_phonetic_writing
fields = commonfields.copy()
fields.append('non_phonetic_writing')
@@ -421,7 +619,13 @@ class Meta:
class Phonetic_alphabetic_writingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Phonetic_alphabetic_writing
fields = commonfields.copy()
fields.append('phonetic_alphabetic_writing')
@@ -432,7 +636,13 @@ class Meta:
class Lists_tables_and_classificationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Lists_tables_and_classification
fields = commonfields.copy()
fields.append('lists_tables_and_classification')
@@ -443,7 +653,13 @@ class Meta:
class CalendarForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Calendar
fields = commonfields.copy()
fields.append('calendar')
@@ -454,7 +670,13 @@ class Meta:
class Sacred_textForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Sacred_text
fields = commonfields.copy()
fields.append('sacred_text')
@@ -465,7 +687,13 @@ class Meta:
class Religious_literatureForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Religious_literature
fields = commonfields.copy()
fields.append('religious_literature')
@@ -476,7 +704,13 @@ class Meta:
class Practical_literatureForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Practical_literature
fields = commonfields.copy()
fields.append('practical_literature')
@@ -487,7 +721,13 @@ class Meta:
class HistoryForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = History
fields = commonfields.copy()
fields.append('history')
@@ -498,7 +738,13 @@ class Meta:
class PhilosophyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Philosophy
fields = commonfields.copy()
fields.append('philosophy')
@@ -509,7 +755,13 @@ class Meta:
class Scientific_literatureForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Scientific_literature
fields = commonfields.copy()
fields.append('scientific_literature')
@@ -520,7 +772,13 @@ class Meta:
class FictionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Fiction
fields = commonfields.copy()
fields.append('fiction')
@@ -531,7 +789,13 @@ class Meta:
class ArticleForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Article
fields = commonfields.copy()
fields.append('article')
@@ -542,7 +806,13 @@ class Meta:
class TokenForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Token
fields = commonfields.copy()
fields.append('token')
@@ -553,7 +823,13 @@ class Meta:
class Precious_metalForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Precious_metal
fields = commonfields.copy()
fields.append('precious_metal')
@@ -564,7 +840,13 @@ class Meta:
class Foreign_coinForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Foreign_coin
fields = commonfields.copy()
fields.append('foreign_coin')
@@ -575,7 +857,13 @@ class Meta:
class Indigenous_coinForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Indigenous_coin
fields = commonfields.copy()
fields.append('indigenous_coin')
@@ -586,7 +874,13 @@ class Meta:
class Paper_currencyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Paper_currency
fields = commonfields.copy()
fields.append('paper_currency')
@@ -597,7 +891,13 @@ class Meta:
class CourierForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Courier
fields = commonfields.copy()
fields.append('courier')
@@ -608,7 +908,13 @@ class Meta:
class Postal_stationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Postal_station
fields = commonfields.copy()
fields.append('postal_station')
@@ -619,7 +925,13 @@ class Meta:
class General_postal_serviceForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = General_postal_service
fields = commonfields.copy()
fields.append('general_postal_service')
@@ -631,7 +943,13 @@ class Meta:
# NEW SC vars
class Communal_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Communal_building
fields = commonfields.copy()
fields.append('communal_building')
@@ -643,7 +961,13 @@ class Meta:
widgets['communal_building'] = forms.Select(attrs={'class': 'form-control mb-3', })
class Utilitarian_public_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Utilitarian_public_building
fields = commonfields.copy()
fields.append('utilitarian_public_building')
@@ -655,7 +979,13 @@ class Meta:
widgets['utilitarian_public_building'] = forms.Select(attrs={'class': 'form-control mb-3', })
class Other_utilitarian_public_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Other_utilitarian_public_building
fields = commonfields.copy()
fields.append('other_utilitarian_public_building')
@@ -668,7 +998,13 @@ class Meta:
class Symbolic_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Symbolic_building
fields = commonfields.copy()
fields.append('symbolic_building')
@@ -681,7 +1017,13 @@ class Meta:
class Entertainment_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Entertainment_building
fields = commonfields.copy()
fields.append('entertainment_building')
@@ -694,7 +1036,13 @@ class Meta:
class Knowledge_or_information_buildingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Knowledge_or_information_building
fields = commonfields.copy()
fields.append('knowledge_or_information_building')
@@ -707,7 +1055,13 @@ class Meta:
class Special_purpose_siteForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Special_purpose_site
fields = commonfields.copy()
fields.append('special_purpose_site')
@@ -720,7 +1074,13 @@ class Meta:
class Ceremonial_siteForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Ceremonial_site
fields = commonfields.copy()
fields.append('ceremonial_site')
@@ -733,7 +1093,13 @@ class Meta:
class Burial_siteForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Burial_site
fields = commonfields.copy()
fields.append('burial_site')
@@ -746,7 +1112,13 @@ class Meta:
class Trading_emporiaForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Trading_emporia
fields = commonfields.copy()
fields.append('trading_emporia')
@@ -759,7 +1131,13 @@ class Meta:
class EnclosureForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Enclosure
fields = commonfields.copy()
fields.append('enclosure')
@@ -772,7 +1150,13 @@ class Meta:
class Length_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Length_measurement_system
fields = commonfields.copy()
fields.append('length_measurement_system')
@@ -785,7 +1169,13 @@ class Meta:
class Area_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Area_measurement_system
fields = commonfields.copy()
fields.append('area_measurement_system')
@@ -798,7 +1188,13 @@ class Meta:
class Volume_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Volume_measurement_system
fields = commonfields.copy()
fields.append('volume_measurement_system')
@@ -811,7 +1207,13 @@ class Meta:
class Weight_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Weight_measurement_system
fields = commonfields.copy()
fields.append('weight_measurement_system')
@@ -824,7 +1226,13 @@ class Meta:
class Time_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Time_measurement_system
fields = commonfields.copy()
fields.append('time_measurement_system')
@@ -837,7 +1245,13 @@ class Meta:
class Geometrical_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Geometrical_measurement_system
fields = commonfields.copy()
fields.append('geometrical_measurement_system')
@@ -850,7 +1264,13 @@ class Meta:
class Other_measurement_systemForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Other_measurement_system
fields = commonfields.copy()
fields.append('other_measurement_system')
@@ -863,7 +1283,13 @@ class Meta:
class Debt_and_credit_structureForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Debt_and_credit_structure
fields = commonfields.copy()
fields.append('debt_and_credit_structure')
@@ -876,7 +1302,13 @@ class Meta:
class Store_of_wealthForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Store_of_wealth
fields = commonfields.copy()
fields.append('store_of_wealth')
@@ -888,7 +1320,13 @@ class Meta:
widgets['store_of_wealth'] = forms.Select(attrs={'class': 'form-control mb-3', })
class Source_of_supportForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Source_of_support
fields = commonfields.copy()
fields.append('source_of_support')
@@ -902,7 +1340,13 @@ class Meta:
class Occupational_complexityForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Occupational_complexity
fields = commonfields.copy()
fields.append('occupational_complexity')
@@ -913,7 +1357,13 @@ class Meta:
class Special_purpose_houseForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Special_purpose_house
fields = commonfields.copy()
fields.append('special_purpose_house')
@@ -924,7 +1374,13 @@ class Meta:
class Other_special_purpose_siteForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Other_special_purpose_site
fields = commonfields.copy()
fields.append('other_special_purpose_site')
@@ -936,7 +1392,13 @@ class Meta:
class Largest_communication_distanceForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Largest_communication_distance
fields = commonfields.copy()
fields.append('largest_communication_distance_from')
@@ -950,7 +1412,13 @@ class Meta:
class Fastest_individual_communicationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Fastest_individual_communication
fields = commonfields.copy()
fields.append('fastest_individual_communication_from')
diff --git a/seshat/apps/sc/models.py b/seshat/apps/sc/models.py
index eef0a6230..1378758af 100644
--- a/seshat/apps/sc/models.py
+++ b/seshat/apps/sc/models.py
@@ -52,6 +52,23 @@
########## Beginning of Function Definitions for General (Vars) Models
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -59,9 +76,50 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ', '.join(['' + citation.__str__() + ' ' for citation in self.citations.all()[:2]])
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': mark_safe(' The start year is bigger than the end year!'),
@@ -89,25 +147,62 @@ def clean_times(self):
########## Beginning of class Definitions for general Models
class Ra(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Ra")
sc_ra = models.ForeignKey(Seshat_Expert, on_delete=models.SET_NULL, null=True, related_name="sc_research_assistant")
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Ra'
verbose_name_plural = 'Ras'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "ra"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "ra"
def show_value(self):
@@ -126,6 +221,14 @@ def show_value_to(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('ra-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -133,26 +236,63 @@ def __str__(self) -> str:
class Polity_territory(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Polity_territory")
polity_territory_from = models.IntegerField(blank=True, null=True)
polity_territory_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_territory'
verbose_name_plural = 'Polity_territories'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_territory"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Territory"
def show_value(self):
@@ -186,6 +326,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_territory-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -193,26 +341,63 @@ def __str__(self) -> str:
class Polity_population(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Polity_population")
polity_population_from = models.IntegerField(blank=True, null=True)
polity_population_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polity_population'
verbose_name_plural = 'Polity_populations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polity_population"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Polity Population"
def show_value(self):
@@ -246,6 +431,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polity_population-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -253,26 +446,63 @@ def __str__(self) -> str:
class Population_of_the_largest_settlement(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Population_of_the_largest_settlement")
population_of_the_largest_settlement_from = models.IntegerField(blank=True, null=True)
population_of_the_largest_settlement_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Population_of_the_largest_settlement'
verbose_name_plural = 'Population_of_the_largest_settlements'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "population_of_the_largest_settlement"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Population of the Largest Settlement"
def show_value(self):
@@ -307,6 +537,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('population_of_the_largest_settlement-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -314,26 +552,63 @@ def __str__(self) -> str:
class Settlement_hierarchy(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Settlement_hierarchy")
settlement_hierarchy_from = models.IntegerField(blank=True, null=True)
settlement_hierarchy_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Settlement_hierarchy'
verbose_name_plural = 'Settlement_hierarchies'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "settlement_hierarchy"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Settlement Hierarchy"
def show_value(self):
@@ -368,6 +643,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('settlement_hierarchy-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -375,26 +658,63 @@ def __str__(self) -> str:
class Administrative_level(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Administrative_level")
administrative_level_from = models.IntegerField(blank=True, null=True)
administrative_level_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Administrative_level'
verbose_name_plural = 'Administrative_levels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "administrative_level"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Administrative Level"
def show_value(self):
@@ -429,6 +749,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('administrative_level-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -436,26 +764,63 @@ def __str__(self) -> str:
class Religious_level(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Religious_level")
religious_level_from = models.IntegerField(blank=True, null=True)
religious_level_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Religious_level'
verbose_name_plural = 'Religious_levels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "religious_level"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Religious Level"
def show_value(self):
@@ -489,6 +854,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('religious_level-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -496,26 +869,63 @@ def __str__(self) -> str:
class Military_level(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Military_level")
military_level_from = models.IntegerField(blank=True, null=True)
military_level_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Military_level'
verbose_name_plural = 'Military_levels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "military_level"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Military Level"
def show_value(self):
@@ -549,6 +959,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('military_level-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -556,25 +974,62 @@ def __str__(self) -> str:
class Professional_military_officer(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Professional_military_officer")
professional_military_officer = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Professional_military_officer'
verbose_name_plural = 'Professional_military_officers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "professional_military_officer"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Professional Military Officer"
def show_value(self):
@@ -599,6 +1054,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('professional_military_officer-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -606,25 +1069,62 @@ def __str__(self) -> str:
class Professional_soldier(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Professional_soldier")
professional_soldier = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Professional_soldier'
verbose_name_plural = 'Professional_soldiers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "professional_soldier"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Professional Soldier"
def show_value(self):
@@ -649,6 +1149,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('professional_soldier-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -656,25 +1164,62 @@ def __str__(self) -> str:
class Professional_priesthood(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Professional_priesthood")
professional_priesthood = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Professional_priesthood'
verbose_name_plural = 'Professional_priesthoods'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "professional_priesthood"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Professional Priesthood"
def show_value(self):
@@ -699,6 +1244,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('professional_priesthood-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -706,25 +1259,62 @@ def __str__(self) -> str:
class Full_time_bureaucrat(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Full_time_bureaucrat")
full_time_bureaucrat = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Full_time_bureaucrat'
verbose_name_plural = 'Full_time_bureaucrats'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "full_time_bureaucrat"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Full Time Bureaucrat"
def show_value(self):
@@ -750,6 +1340,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('full_time_bureaucrat-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -757,25 +1355,62 @@ def __str__(self) -> str:
class Examination_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Examination_system")
examination_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Examination_system'
verbose_name_plural = 'Examination_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "examination_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Examination System"
def show_value(self):
@@ -800,6 +1435,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('examination_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -807,25 +1450,62 @@ def __str__(self) -> str:
class Merit_promotion(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Merit_promotion")
merit_promotion = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Merit_promotion'
verbose_name_plural = 'Merit_promotions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "merit_promotion"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Merit Promotion"
def show_value(self):
@@ -850,6 +1530,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('merit_promotion-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -857,25 +1545,62 @@ def __str__(self) -> str:
class Specialized_government_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Specialized_government_building")
specialized_government_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Specialized_government_building'
verbose_name_plural = 'Specialized_government_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "specialized_government_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Specialized Government Building"
def show_value(self):
@@ -901,6 +1626,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('specialized_government_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -908,25 +1641,62 @@ def __str__(self) -> str:
class Formal_legal_code(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Formal_legal_code")
formal_legal_code = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Formal_legal_code'
verbose_name_plural = 'Formal_legal_codes'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "formal_legal_code"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Formal Legal Code"
def show_value(self):
@@ -952,6 +1722,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('formal_legal_code-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -959,25 +1737,62 @@ def __str__(self) -> str:
class Judge(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Judge")
judge = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Judge'
verbose_name_plural = 'Judges'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "judge"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Judge"
def show_value(self):
@@ -1002,6 +1817,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('judge-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1009,25 +1832,62 @@ def __str__(self) -> str:
class Court(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Court")
court = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Court'
verbose_name_plural = 'Courts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "court"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Court"
def show_value(self):
@@ -1052,6 +1912,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('court-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1059,25 +1927,62 @@ def __str__(self) -> str:
class Professional_lawyer(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Professional_lawyer")
professional_lawyer = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Professional_lawyer'
verbose_name_plural = 'Professional_lawyers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "professional_lawyer"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Professional Lawyer"
def show_value(self):
@@ -1102,6 +2007,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('professional_lawyer-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1109,25 +2022,62 @@ def __str__(self) -> str:
class Irrigation_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Irrigation_system")
irrigation_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Irrigation_system'
verbose_name_plural = 'Irrigation_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "irrigation_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Irrigation System"
def show_value(self):
@@ -1152,6 +2102,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('irrigation_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1159,25 +2117,62 @@ def __str__(self) -> str:
class Drinking_water_supply_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Drinking_water_supply_system")
drinking_water_supply_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Drinking_water_supply_system'
verbose_name_plural = 'Drinking_water_supply_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "drinking_water_supply_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Drinking Water Supply System"
def show_value(self):
@@ -1202,6 +2197,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('drinking_water_supply_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1209,25 +2212,62 @@ def __str__(self) -> str:
class Market(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Market")
market = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Market'
verbose_name_plural = 'Markets'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "market"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Market"
def show_value(self):
@@ -1252,6 +2292,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('market-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1259,25 +2307,62 @@ def __str__(self) -> str:
class Food_storage_site(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Food_storage_site")
food_storage_site = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Food_storage_site'
verbose_name_plural = 'Food_storage_sites'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "food_storage_site"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Food Storage Site"
def show_value(self):
@@ -1302,6 +2387,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('food_storage_site-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1309,25 +2402,62 @@ def __str__(self) -> str:
class Road(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Road")
road = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Road'
verbose_name_plural = 'Roads'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "road"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Road"
def show_value(self):
@@ -1352,6 +2482,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('road-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1359,25 +2497,62 @@ def __str__(self) -> str:
class Bridge(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Bridge")
bridge = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Bridge'
verbose_name_plural = 'Bridges'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "bridge"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Bridge"
def show_value(self):
@@ -1402,6 +2577,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('bridge-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1409,25 +2592,62 @@ def __str__(self) -> str:
class Canal(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Canal")
canal = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Canal'
verbose_name_plural = 'Canals'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
- return return_citations(self)
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
+ return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "canal"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Canal"
def show_value(self):
@@ -1452,6 +2672,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('canal-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1459,25 +2687,62 @@ def __str__(self) -> str:
class Port(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Port")
port = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Port'
verbose_name_plural = 'Ports'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "port"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Port"
def show_value(self):
@@ -1502,6 +2767,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('port-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1509,25 +2782,62 @@ def __str__(self) -> str:
class Mines_or_quarry(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Mines_or_quarry")
mines_or_quarry = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Mines_or_quarry'
verbose_name_plural = 'Mines_or_quarries'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "mines_or_quarry"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Mines or Quarry"
def show_value(self):
@@ -1552,6 +2862,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('mines_or_quarry-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1559,25 +2877,62 @@ def __str__(self) -> str:
class Mnemonic_device(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Mnemonic_device")
mnemonic_device = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Mnemonic_device'
verbose_name_plural = 'Mnemonic_devices'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "mnemonic_device"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Mnemonic Device"
def show_value(self):
@@ -1602,6 +2957,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('mnemonic_device-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1609,25 +2972,62 @@ def __str__(self) -> str:
class Nonwritten_record(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Nonwritten_record")
nonwritten_record = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Nonwritten_record'
verbose_name_plural = 'Nonwritten_records'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "nonwritten_record"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Nonwritten Record"
def show_value(self):
@@ -1652,6 +3052,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('nonwritten_record-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1659,25 +3067,62 @@ def __str__(self) -> str:
class Written_record(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Written_record")
written_record = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Written_record'
verbose_name_plural = 'Written_records'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "written_record"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Written Record"
def show_value(self):
@@ -1702,6 +3147,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('written_record-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1709,25 +3162,62 @@ def __str__(self) -> str:
class Script(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Script")
script = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Script'
verbose_name_plural = 'Scripts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "script"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Script"
def show_value(self):
@@ -1752,6 +3242,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('script-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1759,25 +3257,62 @@ def __str__(self) -> str:
class Non_phonetic_writing(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Non_phonetic_writing")
non_phonetic_writing = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Non_phonetic_writing'
verbose_name_plural = 'Non_phonetic_writings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "non_phonetic_writing"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Non Phonetic Writing"
def show_value(self):
@@ -1802,6 +3337,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('non_phonetic_writing-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1809,25 +3352,62 @@ def __str__(self) -> str:
class Phonetic_alphabetic_writing(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Phonetic_alphabetic_writing")
phonetic_alphabetic_writing = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Phonetic_alphabetic_writing'
verbose_name_plural = 'Phonetic_alphabetic_writings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "phonetic_alphabetic_writing"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Phonetic Alphabetic Writing"
def show_value(self):
@@ -1852,6 +3432,14 @@ def sub_subsection(self):
return "Writing System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('phonetic_alphabetic_writing-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1859,25 +3447,62 @@ def __str__(self) -> str:
class Lists_tables_and_classification(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Lists_tables_and_classification")
lists_tables_and_classification = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Lists_tables_and_classification'
verbose_name_plural = 'Lists_tables_and_classifications'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "lists_tables_and_classification"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Lists Tables and Classification"
def show_value(self):
@@ -1902,6 +3527,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('lists_tables_and_classification-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1909,25 +3542,62 @@ def __str__(self) -> str:
class Calendar(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Calendar")
calendar = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Calendar'
verbose_name_plural = 'Calendars'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "calendar"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Calendar"
def show_value(self):
@@ -1952,6 +3622,14 @@ def show_value_to(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('calendar-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1959,25 +3637,62 @@ def __str__(self) -> str:
class Sacred_text(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Sacred_text")
sacred_text = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Sacred_text'
verbose_name_plural = 'Sacred_texts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "sacred_text"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Sacred Text"
def show_value(self):
@@ -2002,6 +3717,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('sacred_text-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2009,25 +3732,62 @@ def __str__(self) -> str:
class Religious_literature(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Religious_literature")
religious_literature = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Religious_literature'
verbose_name_plural = 'Religious_literatures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "religious_literature"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Religious Literature"
def show_value(self):
@@ -2052,6 +3812,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('religious_literature-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2059,25 +3827,62 @@ def __str__(self) -> str:
class Practical_literature(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Practical_literature")
practical_literature = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Practical_literature'
verbose_name_plural = 'Practical_literatures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "practical_literature"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Practical Literature"
def show_value(self):
@@ -2102,6 +3907,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('practical_literature-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2109,25 +3922,62 @@ def __str__(self) -> str:
class History(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="History")
history = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'History'
verbose_name_plural = 'Histories'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "history"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "History"
def show_value(self):
@@ -2152,6 +4002,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('history-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2159,25 +4017,62 @@ def __str__(self) -> str:
class Philosophy(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Philosophy")
philosophy = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Philosophy'
verbose_name_plural = 'Philosophies'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "philosophy"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Philosophy"
def show_value(self):
@@ -2202,6 +4097,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('philosophy-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2209,25 +4112,62 @@ def __str__(self) -> str:
class Scientific_literature(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Scientific_literature")
scientific_literature = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Scientific_literature'
verbose_name_plural = 'Scientific_literatures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "scientific_literature"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Scientific Literature"
def show_value(self):
@@ -2252,6 +4192,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('scientific_literature-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2259,25 +4207,62 @@ def __str__(self) -> str:
class Fiction(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Fiction")
fiction = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Fiction'
verbose_name_plural = 'Fictions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "fiction"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Fiction"
def show_value(self):
@@ -2302,6 +4287,14 @@ def sub_subsection(self):
return "Kinds of Written Documents"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('fiction-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2309,25 +4302,62 @@ def __str__(self) -> str:
class Article(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Article")
article = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Article'
verbose_name_plural = 'Articles'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "article"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Article"
def show_value(self):
@@ -2352,6 +4382,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('article-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2359,25 +4397,62 @@ def __str__(self) -> str:
class Token(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Token")
token = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Token'
verbose_name_plural = 'Tokens'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "token"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Token"
def show_value(self):
@@ -2402,6 +4477,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('token-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2409,25 +4492,62 @@ def __str__(self) -> str:
class Precious_metal(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Precious_metal")
precious_metal = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Precious_metal'
verbose_name_plural = 'Precious_metals'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "precious_metal"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Precious Metal"
def show_value(self):
@@ -2452,6 +4572,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('precious_metal-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2459,25 +4587,62 @@ def __str__(self) -> str:
class Foreign_coin(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Foreign_coin")
foreign_coin = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Foreign_coin'
verbose_name_plural = 'Foreign_coins'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "foreign_coin"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Foreign Coin"
def show_value(self):
@@ -2502,6 +4667,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('foreign_coin-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2509,25 +4682,62 @@ def __str__(self) -> str:
class Indigenous_coin(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Indigenous_coin")
indigenous_coin = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Indigenous_coin'
verbose_name_plural = 'Indigenous_coins'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "indigenous_coin"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Indigenous Coin"
def show_value(self):
@@ -2552,6 +4762,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('indigenous_coin-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2559,25 +4777,62 @@ def __str__(self) -> str:
class Paper_currency(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Paper_currency")
paper_currency = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Paper_currency'
verbose_name_plural = 'Paper_currencies'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "paper_currency"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Paper Currency"
def show_value(self):
@@ -2602,6 +4857,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('paper_currency-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2609,25 +4872,62 @@ def __str__(self) -> str:
class Courier(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Courier")
courier = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Courier'
verbose_name_plural = 'Couriers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "courier"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Courier"
def show_value(self):
@@ -2652,6 +4952,14 @@ def sub_subsection(self):
return "Postal System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('courier-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2659,25 +4967,62 @@ def __str__(self) -> str:
class Postal_station(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Postal_station")
postal_station = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Postal_station'
verbose_name_plural = 'Postal_stations'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "postal_station"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Postal Station"
def show_value(self):
@@ -2702,6 +5047,14 @@ def sub_subsection(self):
return "Postal System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('postal_station-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2709,25 +5062,62 @@ def __str__(self) -> str:
class General_postal_service(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="General_postal_service")
general_postal_service = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'General_postal_service'
verbose_name_plural = 'General_postal_services'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "general_postal_service"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "General Postal Service"
def show_value(self):
@@ -2752,6 +5142,14 @@ def sub_subsection(self):
return "Postal System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('general_postal_service-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2763,25 +5161,62 @@ def __str__(self) -> str:
############################## NEW SC Variables
class Communal_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Communal_building")
communal_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Communal_building'
verbose_name_plural = 'Communal_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "communal_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Communal Building"
def show_value(self):
@@ -2806,6 +5241,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('communal_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2813,25 +5256,62 @@ def __str__(self) -> str:
class Utilitarian_public_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Utilitarian_public_building")
utilitarian_public_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Utilitarian_public_building'
verbose_name_plural = 'Utilitarian_public_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "utilitarian_public_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Utilitarian Public Building"
def show_value(self):
@@ -2856,6 +5336,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('utilitarian_public_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2863,25 +5351,62 @@ def __str__(self) -> str:
class Symbolic_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Symbolic_building")
symbolic_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Symbolic_building'
verbose_name_plural = 'Symbolic_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "symbolic_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Symbolic Building"
def show_value(self):
@@ -2906,6 +5431,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('symbolic_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2913,25 +5446,62 @@ def __str__(self) -> str:
class Entertainment_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Entertainment_building")
entertainment_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Entertainment_building'
verbose_name_plural = 'Entertainment_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "entertainment_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Entertainment Building"
def show_value(self):
@@ -2956,6 +5526,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('entertainment_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2963,25 +5541,62 @@ def __str__(self) -> str:
class Knowledge_or_information_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Knowledge_or_information_building")
knowledge_or_information_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Knowledge_or_information_building'
verbose_name_plural = 'Knowledge_or_information_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "knowledge_or_information_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Knowledge Or Information Building"
def show_value(self):
@@ -3006,31 +5621,76 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('knowledge_or_information_building-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
class Other_utilitarian_public_building(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Other_utilitarian_public_building")
other_utilitarian_public_building = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Other_utilitarian_public_building'
verbose_name_plural = 'Other_utilitarian_public_buildings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "other_utilitarian_public_building"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Other Utilitarian Public Building"
def show_value(self):
@@ -3055,6 +5715,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('other_utilitarian_public_building-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3062,25 +5730,62 @@ def __str__(self) -> str:
class Special_purpose_site(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Special_purpose_site")
special_purpose_site = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Special_purpose_site'
verbose_name_plural = 'Special_purpose_sites'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "special_purpose_site"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Special Purpose Site"
def show_value(self):
@@ -3105,6 +5810,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('special_purpose_site-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3112,25 +5825,62 @@ def __str__(self) -> str:
class Ceremonial_site(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Ceremonial_site")
ceremonial_site = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Ceremonial_site'
verbose_name_plural = 'Ceremonial_sites'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "ceremonial_site"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Ceremonial Site"
def show_value(self):
@@ -3155,6 +5905,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('ceremonial_site-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3162,25 +5920,62 @@ def __str__(self) -> str:
class Burial_site(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Burial_site")
burial_site = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Burial_site'
verbose_name_plural = 'Burial_sites'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "burial_site"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Burial Site"
def show_value(self):
@@ -3205,6 +6000,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('burial_site-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3212,25 +6015,62 @@ def __str__(self) -> str:
class Trading_emporia(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Trading_emporia")
trading_emporia = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Trading_emporia'
verbose_name_plural = 'Trading_emporias'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "trading_emporia"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Trading Emporia"
def show_value(self):
@@ -3255,6 +6095,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('trading_emporia-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3262,25 +6110,62 @@ def __str__(self) -> str:
class Enclosure(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Enclosure")
enclosure = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Enclosure'
verbose_name_plural = 'Enclosures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "enclosure"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Enclosure"
def show_value(self):
@@ -3305,6 +6190,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('enclosure-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3312,25 +6205,62 @@ def __str__(self) -> str:
class Length_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Length_measurement_system")
length_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Length_measurement_system'
verbose_name_plural = 'Length_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "length_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Length Measurement System"
def show_value(self):
@@ -3355,6 +6285,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('length_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3362,25 +6300,62 @@ def __str__(self) -> str:
class Area_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Area_measurement_system")
area_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Area_measurement_system'
verbose_name_plural = 'Area_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "area_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Area Measurement System"
def show_value(self):
@@ -3405,6 +6380,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('area_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3412,25 +6395,62 @@ def __str__(self) -> str:
class Volume_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Volume_measurement_system")
volume_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Volume_measurement_system'
verbose_name_plural = 'Volume_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "volume_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Volume Measurement System"
def show_value(self):
@@ -3455,6 +6475,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('volume_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3462,25 +6490,62 @@ def __str__(self) -> str:
class Weight_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Weight_measurement_system")
weight_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Weight_measurement_system'
verbose_name_plural = 'Weight_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "weight_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Weight Measurement System"
def show_value(self):
@@ -3505,6 +6570,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('weight_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3512,25 +6585,62 @@ def __str__(self) -> str:
class Time_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Time_measurement_system")
time_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Time_measurement_system'
verbose_name_plural = 'Time_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "time_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Time Measurement System"
def show_value(self):
@@ -3555,6 +6665,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('time_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3562,25 +6680,62 @@ def __str__(self) -> str:
class Geometrical_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Geometrical_measurement_system")
geometrical_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Geometrical_measurement_system'
verbose_name_plural = 'Geometrical_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "geometrical_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Geometrical Measurement System"
def show_value(self):
@@ -3605,6 +6760,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('geometrical_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3612,25 +6775,62 @@ def __str__(self) -> str:
class Other_measurement_system(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Other_measurement_system")
other_measurement_system = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Other_measurement_system'
verbose_name_plural = 'Other_measurement_systems'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "other_measurement_system"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Other Measurement System"
def show_value(self):
@@ -3655,6 +6855,14 @@ def sub_subsection(self):
return "Measurement System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('other_measurement_system-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3662,25 +6870,62 @@ def __str__(self) -> str:
class Debt_and_credit_structure(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Debt_and_credit_structure")
debt_and_credit_structure = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Debt_and_credit_structure'
verbose_name_plural = 'Debt_and_credit_structures'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "debt_and_credit_structure"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Debt And Credit Structure"
def show_value(self):
@@ -3705,6 +6950,14 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('debt_and_credit_structure-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3712,25 +6965,62 @@ def __str__(self) -> str:
class Store_of_wealth(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Store_of_wealth")
store_of_wealth = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Store_of_wealth'
verbose_name_plural = 'Store_of_wealths'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "store_of_wealth"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Store Of Wealth"
def show_value(self):
@@ -3755,31 +7045,76 @@ def sub_subsection(self):
return "Money"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('store_of_wealth-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
class Source_of_support(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Source_of_support")
source_of_support = models.CharField(max_length=500, choices=SOURCE_OF_SUPPORT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Source_of_support'
verbose_name_plural = 'Source_of_supports'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "source_of_support"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Source Of Support"
def show_value(self):
@@ -3804,31 +7139,76 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('source_of_support-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
class Occupational_complexity(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Occupational_complexity")
occupational_complexity = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Occupational_complexity'
verbose_name_plural = 'Occupational_complexies'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "occupational_complexity"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Occupational Complexity"
def show_value(self):
@@ -3853,6 +7233,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('occupational_complexity-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3860,25 +7248,62 @@ def __str__(self) -> str:
class Special_purpose_house(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Special_purpose_house")
special_purpose_house = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Special_purpose_house'
verbose_name_plural = 'Special Purpose Houses'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "special_purpose_house"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Special Purpose House"
def show_value(self):
@@ -3903,31 +7328,76 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('special_purpose_house-detail', args=[str(self.id)])
def __str__(self) -> str:
return call_my_name(self)
class Other_special_purpose_site(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Other_special_purpose_site")
other_special_purpose_site = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Other_special_purpose_site'
verbose_name_plural = 'Other Special Purpose Sites'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "other_special_purpose_site"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Other Special Purpose Site"
def show_value(self):
@@ -3952,6 +7422,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('other_special_purpose_site-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -3959,26 +7437,63 @@ def __str__(self) -> str:
class Largest_communication_distance(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Largest_communication_distance")
largest_communication_distance_from = models.IntegerField(null=True, blank=True)
largest_communication_distance_to = models.IntegerField(null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Largest_communication_distance'
verbose_name_plural = 'Largest Communication Distances'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "largest_communication_distance"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Largest Communication Distance"
def show_value(self):
@@ -4012,6 +7527,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('largest_communication_distance-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -4019,26 +7542,63 @@ def __str__(self) -> str:
class Fastest_individual_communication(SeshatCommon):
+ """
+
+ """
name = models.CharField(max_length=100, default="Fastest_individual_communication")
fastest_individual_communication_from = models.IntegerField(null=True, blank=True)
fastest_individual_communication_to = models.IntegerField(null=True, blank=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Fastest_individual_communication'
verbose_name_plural = 'Fastest Individual Communications'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "fastest_individual_communication"
def clean_name_spaced(self):
+ """
+ Return the name of the model instance with spaces.
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+ """
return "Fastest Individual Communication"
def show_value(self):
@@ -4072,6 +7632,14 @@ def sub_subsection(self):
return "Postal System"
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('fastest_individual_communication-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/sc/tests.py b/seshat/apps/sc/tests.py
index 7ce503c2d..e69de29bb 100644
--- a/seshat/apps/sc/tests.py
+++ b/seshat/apps/sc/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/sc/views.py b/seshat/apps/sc/views.py
index 6ec90f8c9..a31954e42 100644
--- a/seshat/apps/sc/views.py
+++ b/seshat/apps/sc/views.py
@@ -46,14 +46,38 @@
from .forms import RaForm, Polity_territoryForm, Polity_populationForm, Population_of_the_largest_settlementForm, Settlement_hierarchyForm, Administrative_levelForm, Religious_levelForm, Military_levelForm, Professional_military_officerForm, Professional_soldierForm, Professional_priesthoodForm, Full_time_bureaucratForm, Examination_systemForm, Merit_promotionForm, Specialized_government_buildingForm, Formal_legal_codeForm, JudgeForm, CourtForm, Professional_lawyerForm, Irrigation_systemForm, Drinking_water_supply_systemForm, MarketForm, Food_storage_siteForm, RoadForm, BridgeForm, CanalForm, PortForm, Mines_or_quarryForm, Mnemonic_deviceForm, Nonwritten_recordForm, Written_recordForm, ScriptForm, Non_phonetic_writingForm, Phonetic_alphabetic_writingForm, Lists_tables_and_classificationForm, CalendarForm, Sacred_textForm, Religious_literatureForm, Practical_literatureForm, HistoryForm, PhilosophyForm, Scientific_literatureForm, FictionForm, ArticleForm, TokenForm, Precious_metalForm, Foreign_coinForm, Indigenous_coinForm, Paper_currencyForm, CourierForm, Postal_stationForm, General_postal_serviceForm
class RaCreate(PermissionRequiredMixin, CreateView):
+ """
+ View for creating a new Ra object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ra
form_class = RaForm
template_name = "sc/ra/ra_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ra-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -67,18 +91,41 @@ def get_context_data(self, **kwargs):
class RaUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Ra object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ra
form_class = RaForm
template_name = "sc/ra/ra_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "ra"
return context
class RaDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Ra object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ra
success_url = reverse_lazy('ras')
template_name = "core/delete_general.html"
@@ -86,14 +133,34 @@ class RaDelete(PermissionRequiredMixin, DeleteView):
class RaListView(generic.ListView):
+ """
+ Paginated view for listing all the Ra objects.
+ """
model = Ra
template_name = "sc/ra/ra_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ras')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "ra"
context["var_main_desc"] = "The name of the research assistant or associate who coded the data. if more than one ra made a substantial contribution, list all via separate entries."
@@ -107,6 +174,9 @@ def get_context_data(self, **kwargs):
class RaListViewAll(generic.ListView):
+ """
+ View for listing all the Ra objects.
+ """
model = Ra
template_name = "sc/ra/ra_list_all.html"
@@ -121,6 +191,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "ra"
context["var_main_desc"] = "The name of the research assistant or associate who coded the data. if more than one ra made a substantial contribution, list all via separate entries."
@@ -134,12 +215,27 @@ def get_context_data(self, **kwargs):
return context
class RaDetailView(generic.DetailView):
+ """
+ View for displaying the details of a Ra object.
+ """
model = Ra
template_name = "sc/ra/ra_detail.html"
@permission_required('core.view_capital')
def ra_download(request):
+ """
+ Download all the data in the Ra model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Ra.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -162,6 +258,18 @@ def ra_download(request):
@permission_required('core.view_capital')
def ra_meta_download(request):
+ """
+ Download the metadata of the Ra model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="metadata_ras.csv"'
@@ -183,14 +291,38 @@ def ra_meta_download(request):
class Polity_territoryCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_territory object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_territory
form_class = Polity_territoryForm
template_name = "sc/polity_territory/polity_territory_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_territory-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -204,18 +336,41 @@ def get_context_data(self, **kwargs):
class Polity_territoryUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_territory object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_territory
form_class = Polity_territoryForm
template_name = "sc/polity_territory/polity_territory_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Territory"
return context
class Polity_territoryDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_territory object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_territory
success_url = reverse_lazy('polity_territorys')
template_name = "core/delete_general.html"
@@ -223,14 +378,34 @@ class Polity_territoryDelete(PermissionRequiredMixin, DeleteView):
class Polity_territoryListView(generic.ListView):
+ """
+ Paginated view for listing all the Polity_territory objects.
+ """
model = Polity_territory
template_name = "sc/polity_territory/polity_territory_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_territorys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Territory"
context["var_main_desc"] = "Talking about social scale, polity territory is coded in squared kilometers."
@@ -244,10 +419,19 @@ def get_context_data(self, **kwargs):
class Polity_territoryListViewAll(generic.ListView):
+ """
+ View for listing all the Polity_territory objects.
+ """
model = Polity_territory
template_name = "sc/polity_territory/polity_territory_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_territorys_all')
def get_queryset(self):
@@ -258,6 +442,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Territory"
context["var_main_desc"] = "Talking about social scale, polity territory is coded in squared kilometers."
@@ -271,12 +466,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_territoryDetailView(generic.DetailView):
+ """
+ View for displaying the details of a Polity_territory object.
+ """
model = Polity_territory
template_name = "sc/polity_territory/polity_territory_detail.html"
@permission_required('core.view_capital')
def polity_territory_download(request):
+ """
+ Download all the data in the Polity_territory model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_territory.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -299,6 +509,18 @@ def polity_territory_download(request):
@permission_required('core.view_capital')
def polity_territory_meta_download(request):
+ """
+ Download the metadata of the Polity_territory model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="metadata_polity_territorys.csv"'
@@ -320,14 +542,38 @@ def polity_territory_meta_download(request):
class Polity_populationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Polity_population object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_population
form_class = Polity_populationForm
template_name = "sc/polity_population/polity_population_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_population-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -341,18 +587,41 @@ def get_context_data(self, **kwargs):
class Polity_populationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+ View for updating an existing Polity_population object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_population
form_class = Polity_populationForm
template_name = "sc/polity_population/polity_population_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Population"
return context
class Polity_populationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Polity_population object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polity_population
success_url = reverse_lazy('polity_populations')
template_name = "core/delete_general.html"
@@ -360,14 +629,34 @@ class Polity_populationDelete(PermissionRequiredMixin, DeleteView):
class Polity_populationListView(generic.ListView):
+ """
+ Paginated view for listing all the Polity_population objects.
+ """
model = Polity_population
template_name = "sc/polity_population/polity_population_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_populations')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Population"
context["var_main_desc"] = "Talking about social scale, polity population is the estimated population of the polity; can change as a result of both adding/losing new territories or by population growth/decline within a region"
@@ -381,10 +670,19 @@ def get_context_data(self, **kwargs):
class Polity_populationListViewAll(generic.ListView):
+ """
+ View for listing all the Polity_population objects.
+ """
model = Polity_population
template_name = "sc/polity_population/polity_population_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polity_populations_all')
def get_queryset(self):
@@ -395,6 +693,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Polity Population"
context["var_main_desc"] = "Talking about social scale, polity population is the estimated population of the polity; can change as a result of both adding/losing new territories or by population growth/decline within a region"
@@ -408,12 +717,27 @@ def get_context_data(self, **kwargs):
return context
class Polity_populationDetailView(generic.DetailView):
+ """
+ View for displaying the details of a Polity_population object.
+ """
model = Polity_population
template_name = "sc/polity_population/polity_population_detail.html"
@permission_required('core.view_capital')
def polity_population_download(request):
+ """
+ Download all the data of the Polity_population model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
items = Polity_population.objects.all()
response = HttpResponse(content_type='text/csv')
@@ -436,6 +760,18 @@ def polity_population_download(request):
@permission_required('core.view_capital')
def polity_population_meta_download(request):
+ """
+ Download the metadata of the Polity_population model as a CSV file.
+
+ Note:
+ The access to this view is restricted to users with the 'core.view_capital' permission.
+
+ Args:
+ request (HttpRequest): The request object.
+
+ Returns:
+ HttpResponse: The response object.
+ """
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="metadata_polity_populations.csv"'
@@ -457,14 +793,38 @@ def polity_population_meta_download(request):
class Population_of_the_largest_settlementCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+ View for creating a new Population_of_the_largest_settlement object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Population_of_the_largest_settlement
form_class = Population_of_the_largest_settlementForm
template_name = "sc/population_of_the_largest_settlement/population_of_the_largest_settlement_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('population_of_the_largest_settlement-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -478,18 +838,41 @@ def get_context_data(self, **kwargs):
class Population_of_the_largest_settlementUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Population_of_the_largest_settlement
form_class = Population_of_the_largest_settlementForm
template_name = "sc/population_of_the_largest_settlement/population_of_the_largest_settlement_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Population of the Largest Settlement"
return context
class Population_of_the_largest_settlementDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Population_of_the_largest_settlement object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Population_of_the_largest_settlement
success_url = reverse_lazy('population_of_the_largest_settlements')
template_name = "core/delete_general.html"
@@ -497,14 +880,34 @@ class Population_of_the_largest_settlementDelete(PermissionRequiredMixin, Delete
class Population_of_the_largest_settlementListView(generic.ListView):
+ """
+ Paginated view for listing all the Population_of_the_largest_settlement objects.
+ """
model = Population_of_the_largest_settlement
template_name = "sc/population_of_the_largest_settlement/population_of_the_largest_settlement_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('population_of_the_largest_settlements')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Population of the Largest Settlement"
context["var_main_desc"] = "Talking about social scale, population of the largest settlement is the estimated population of the largest settlement of the polity. note that the largest settlement could be different from the capital (coded under general variables). if possible, indicate the dynamics (that is, how population changed during the temporal period of the polity). note that we are also building a city database - you should consult it as it may already have the needed data."
@@ -518,10 +921,19 @@ def get_context_data(self, **kwargs):
class Population_of_the_largest_settlementListViewAll(generic.ListView):
+ """
+
+ """
model = Population_of_the_largest_settlement
template_name = "sc/population_of_the_largest_settlement/population_of_the_largest_settlement_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('population_of_the_largest_settlements_all')
def get_queryset(self):
@@ -532,6 +944,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Population of the Largest Settlement"
context["var_main_desc"] = "Talking about social scale, population of the largest settlement is the estimated population of the largest settlement of the polity. note that the largest settlement could be different from the capital (coded under general variables). if possible, indicate the dynamics (that is, how population changed during the temporal period of the polity). note that we are also building a city database - you should consult it as it may already have the needed data."
@@ -545,6 +968,9 @@ def get_context_data(self, **kwargs):
return context
class Population_of_the_largest_settlementDetailView(generic.DetailView):
+ """
+
+ """
model = Population_of_the_largest_settlement
template_name = "sc/population_of_the_largest_settlement/population_of_the_largest_settlement_detail.html"
@@ -594,14 +1020,38 @@ def population_of_the_largest_settlement_meta_download(request):
class Settlement_hierarchyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlement_hierarchy
form_class = Settlement_hierarchyForm
template_name = "sc/settlement_hierarchy/settlement_hierarchy_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlement_hierarchy-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -615,18 +1065,41 @@ def get_context_data(self, **kwargs):
class Settlement_hierarchyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlement_hierarchy
form_class = Settlement_hierarchyForm
template_name = "sc/settlement_hierarchy/settlement_hierarchy_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Settlement Hierarchy"
return context
class Settlement_hierarchyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Settlement_hierarchy object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlement_hierarchy
success_url = reverse_lazy('settlement_hierarchys')
template_name = "core/delete_general.html"
@@ -634,14 +1107,34 @@ class Settlement_hierarchyDelete(PermissionRequiredMixin, DeleteView):
class Settlement_hierarchyListView(generic.ListView):
+ """
+ Paginated view for listing all the Settlement_hierarchy objects.
+ """
model = Settlement_hierarchy
template_name = "sc/settlement_hierarchy/settlement_hierarchy_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlement_hierarchys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Settlement Hierarchy"
context["var_main_desc"] = "Talking about hierarchical complexity, settlement hierarchy records (in levels) the hierarchy of not just settlement sizes, but also their complexity as reflected in different roles they play within the (quasi)polity. as settlements become more populous they acquire more complex functions: transportational (e.g. port); economic (e.g. market); administrative (e.g. storehouse, local government building); cultural (e.g. theatre); religious (e.g. temple), utilitarian (e.g. hospital), monumental (e.g. statues, plazas). example: (1) large city (monumental structures, theatre, market, hospital, central government buildings) (2) city (market, theatre, regional government buildings) (3) large town (market, administrative buildings) (4) town (administrative buildings, storehouse)) (5) village (shrine) (6) hamlet (residential only). in the narrative paragraph explain the different levels and list their functions. provide a (crude) estimate of population sizes. for example, large town (market, temple, administrative buildings): 2,000-5,000 inhabitants."
@@ -655,10 +1148,19 @@ def get_context_data(self, **kwargs):
class Settlement_hierarchyListViewAll(generic.ListView):
+ """
+
+ """
model = Settlement_hierarchy
template_name = "sc/settlement_hierarchy/settlement_hierarchy_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlement_hierarchys_all')
def get_queryset(self):
@@ -669,6 +1171,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Settlement Hierarchy"
context["var_main_desc"] = "Talking about hierarchical complexity, settlement hierarchy records (in levels) the hierarchy of not just settlement sizes, but also their complexity as reflected in different roles they play within the (quasi)polity. as settlements become more populous they acquire more complex functions: transportational (e.g. port); economic (e.g. market); administrative (e.g. storehouse, local government building); cultural (e.g. theatre); religious (e.g. temple), utilitarian (e.g. hospital), monumental (e.g. statues, plazas). example: (1) large city (monumental structures, theatre, market, hospital, central government buildings) (2) city (market, theatre, regional government buildings) (3) large town (market, administrative buildings) (4) town (administrative buildings, storehouse)) (5) village (shrine) (6) hamlet (residential only). in the narrative paragraph explain the different levels and list their functions. provide a (crude) estimate of population sizes. for example, large town (market, temple, administrative buildings): 2,000-5,000 inhabitants."
@@ -682,6 +1195,9 @@ def get_context_data(self, **kwargs):
return context
class Settlement_hierarchyDetailView(generic.DetailView):
+ """
+
+ """
model = Settlement_hierarchy
template_name = "sc/settlement_hierarchy/settlement_hierarchy_detail.html"
@@ -731,14 +1247,38 @@ def settlement_hierarchy_meta_download(request):
class Administrative_levelCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Administrative_level
form_class = Administrative_levelForm
template_name = "sc/administrative_level/administrative_level_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('administrative_level-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -752,18 +1292,41 @@ def get_context_data(self, **kwargs):
class Administrative_levelUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Administrative_level
form_class = Administrative_levelForm
template_name = "sc/administrative_level/administrative_level_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Administrative Level"
return context
class Administrative_levelDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Administrative_level object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Administrative_level
success_url = reverse_lazy('administrative_levels')
template_name = "core/delete_general.html"
@@ -771,14 +1334,34 @@ class Administrative_levelDelete(PermissionRequiredMixin, DeleteView):
class Administrative_levelListView(generic.ListView):
+ """
+ Paginated view for listing all the Administrative_level objects.
+ """
model = Administrative_level
template_name = "sc/administrative_level/administrative_level_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('administrative_levels')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Administrative Level"
context["var_main_desc"] = "Talking about hierarchical complexity, administrative levels records the administrative levels of a polity. an example of hierarchy for a state society could be (1) the overall ruler, (2) provincial/regional governors, (3) district heads, (4) town mayors, (5) village heads. note that unlike in settlement hierarchy, here you code people hierarchy. do not simply copy settlement hierarchy data here. for archaeological polities, you will usually code as 'unknown', unless experts identified ranks of chiefs or officials independently of the settlement hierarchy. note: often there are more than one concurrent administrative hierarchy. in the example above the hierarchy refers to the territorial government. in addition, the ruler may have a hierarchically organized central bureaucracy located in the capital. for example, (4)the overall ruler, (3) chiefs of various ministries, (2) midlevel bureaucrats, (1) scribes and clerks. in the narrative paragraph detail what is known about both hierarchies. the machine-readable code should reflect the largest number (the longer chain of command)."
@@ -792,10 +1375,19 @@ def get_context_data(self, **kwargs):
class Administrative_levelListViewAll(generic.ListView):
+ """
+
+ """
model = Administrative_level
template_name = "sc/administrative_level/administrative_level_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('administrative_levels_all')
def get_queryset(self):
@@ -806,6 +1398,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Administrative Level"
context["var_main_desc"] = "Talking about hierarchical complexity, administrative levels records the administrative levels of a polity. an example of hierarchy for a state society could be (1) the overall ruler, (2) provincial/regional governors, (3) district heads, (4) town mayors, (5) village heads. note that unlike in settlement hierarchy, here you code people hierarchy. do not simply copy settlement hierarchy data here. for archaeological polities, you will usually code as 'unknown', unless experts identified ranks of chiefs or officials independently of the settlement hierarchy. note: often there are more than one concurrent administrative hierarchy. in the example above the hierarchy refers to the territorial government. in addition, the ruler may have a hierarchically organized central bureaucracy located in the capital. for example, (4)the overall ruler, (3) chiefs of various ministries, (2) midlevel bureaucrats, (1) scribes and clerks. in the narrative paragraph detail what is known about both hierarchies. the machine-readable code should reflect the largest number (the longer chain of command)."
@@ -819,6 +1422,9 @@ def get_context_data(self, **kwargs):
return context
class Administrative_levelDetailView(generic.DetailView):
+ """
+
+ """
model = Administrative_level
template_name = "sc/administrative_level/administrative_level_detail.html"
@@ -868,14 +1474,38 @@ def administrative_level_meta_download(request):
class Religious_levelCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_level
form_class = Religious_levelForm
template_name = "sc/religious_level/religious_level_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_level-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -889,18 +1519,41 @@ def get_context_data(self, **kwargs):
class Religious_levelUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_level
form_class = Religious_levelForm
template_name = "sc/religious_level/religious_level_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Level"
return context
class Religious_levelDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Religious_level object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_level
success_url = reverse_lazy('religious_levels')
template_name = "core/delete_general.html"
@@ -908,14 +1561,34 @@ class Religious_levelDelete(PermissionRequiredMixin, DeleteView):
class Religious_levelListView(generic.ListView):
+ """
+ Paginated view for listing all the Religious_level objects.
+ """
model = Religious_level
template_name = "sc/religious_level/religious_level_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_levels')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Level"
context["var_main_desc"] = "Talking about hierarchical complexity, religious levels records the religious levels of a polity. same principle as with administrative levels. start with the head of the official cult (if present) coded as: level 1, and work down to the local priest."
@@ -929,10 +1602,19 @@ def get_context_data(self, **kwargs):
class Religious_levelListViewAll(generic.ListView):
+ """
+
+ """
model = Religious_level
template_name = "sc/religious_level/religious_level_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_levels_all')
def get_queryset(self):
@@ -943,6 +1625,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Level"
context["var_main_desc"] = "Talking about hierarchical complexity, religious levels records the religious levels of a polity. same principle as with administrative levels. start with the head of the official cult (if present) coded as: level 1, and work down to the local priest."
@@ -956,6 +1649,9 @@ def get_context_data(self, **kwargs):
return context
class Religious_levelDetailView(generic.DetailView):
+ """
+
+ """
model = Religious_level
template_name = "sc/religious_level/religious_level_detail.html"
@@ -1005,14 +1701,38 @@ def religious_level_meta_download(request):
class Military_levelCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Military_level
form_class = Military_levelForm
template_name = "sc/military_level/military_level_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('military_level-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1026,18 +1746,41 @@ def get_context_data(self, **kwargs):
class Military_levelUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Military_level
form_class = Military_levelForm
template_name = "sc/military_level/military_level_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Military Level"
return context
class Military_levelDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Military_level object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Military_level
success_url = reverse_lazy('military_levels')
template_name = "core/delete_general.html"
@@ -1045,14 +1788,34 @@ class Military_levelDelete(PermissionRequiredMixin, DeleteView):
class Military_levelListView(generic.ListView):
+ """
+ Paginated view for listing all the Military_level objects.
+ """
model = Military_level
template_name = "sc/military_level/military_level_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('military_levels')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Military Level"
context["var_main_desc"] = "Talking about hierarchical complexity, military levels records the military levels of a polity. same principle as with administrative levels. start with the commander-in-chief coded as: level 1, and work down to the private. even in primitive societies such as simple chiefdoms it is often possible to distinguish at least two levels – a commander and soldiers. a complex chiefdom would be coded three levels. the presence of warrior burials might be the basis for inferring the existence of a military organization. (the lowest military level is always the individual soldier)."
@@ -1066,7 +1829,7 @@ def get_context_data(self, **kwargs):
# class Military_levelListViewAll(generic.ListView):
-# model = Military_level
+# model = Military_level
# template_name = "sc/military_level/military_level_list_all.html"
# def get_absolute_url(self):
@@ -1093,6 +1856,9 @@ def get_context_data(self, **kwargs):
# return context
class Military_levelDetailView(generic.DetailView):
+ """
+
+ """
model = Military_level
template_name = "sc/military_level/military_level_detail.html"
@@ -1142,14 +1908,38 @@ def military_level_meta_download(request):
class Professional_military_officerCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_military_officer
form_class = Professional_military_officerForm
template_name = "sc/professional_military_officer/professional_military_officer_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_military_officer-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1163,18 +1953,41 @@ def get_context_data(self, **kwargs):
class Professional_military_officerUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_military_officer
form_class = Professional_military_officerForm
template_name = "sc/professional_military_officer/professional_military_officer_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Military Officer"
return context
class Professional_military_officerDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Professional_military_officer object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_military_officer
success_url = reverse_lazy('professional_military_officers')
template_name = "core/delete_general.html"
@@ -1182,14 +1995,34 @@ class Professional_military_officerDelete(PermissionRequiredMixin, DeleteView):
class Professional_military_officerListView(generic.ListView):
+ """
+ Paginated view for listing all the Professional_military_officer objects.
+ """
model = Professional_military_officer
template_name = "sc/professional_military_officer/professional_military_officer_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_military_officers')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Military Officer"
context["var_main_desc"] = "Talking about professions, professional military officers refer to full-time professional military officers."
@@ -1203,10 +2036,19 @@ def get_context_data(self, **kwargs):
class Professional_military_officerListViewAll(generic.ListView):
+ """
+
+ """
model = Professional_military_officer
template_name = "sc/professional_military_officer/professional_military_officer_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_military_officers_all')
def get_queryset(self):
@@ -1217,6 +2059,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Military Officer"
context["var_main_desc"] = "Talking about professions, professional military officers refer to full-time professional military officers."
@@ -1230,6 +2083,9 @@ def get_context_data(self, **kwargs):
return context
class Professional_military_officerDetailView(generic.DetailView):
+ """
+
+ """
model = Professional_military_officer
template_name = "sc/professional_military_officer/professional_military_officer_detail.html"
@@ -1279,14 +2135,38 @@ def professional_military_officer_meta_download(request):
class Professional_soldierCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_soldier
form_class = Professional_soldierForm
template_name = "sc/professional_soldier/professional_soldier_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_soldier-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1300,18 +2180,41 @@ def get_context_data(self, **kwargs):
class Professional_soldierUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_soldier
form_class = Professional_soldierForm
template_name = "sc/professional_soldier/professional_soldier_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Soldier"
return context
class Professional_soldierDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Professional_soldier object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_soldier
success_url = reverse_lazy('professional_soldiers')
template_name = "core/delete_general.html"
@@ -1319,14 +2222,34 @@ class Professional_soldierDelete(PermissionRequiredMixin, DeleteView):
class Professional_soldierListView(generic.ListView):
+ """
+ Paginated view for listing all the Professional_soldier objects.
+ """
model = Professional_soldier
template_name = "sc/professional_soldier/professional_soldier_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_soldiers')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Soldier"
context["var_main_desc"] = "Talking about professions, professional soldiers refer to full-time professional soldiers."
@@ -1340,10 +2263,19 @@ def get_context_data(self, **kwargs):
class Professional_soldierListViewAll(generic.ListView):
+ """
+
+ """
model = Professional_soldier
template_name = "sc/professional_soldier/professional_soldier_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_soldiers_all')
def get_queryset(self):
@@ -1354,6 +2286,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Soldier"
context["var_main_desc"] = "Talking about professions, professional soldiers refer to full-time professional soldiers."
@@ -1367,6 +2310,9 @@ def get_context_data(self, **kwargs):
return context
class Professional_soldierDetailView(generic.DetailView):
+ """
+
+ """
model = Professional_soldier
template_name = "sc/professional_soldier/professional_soldier_detail.html"
@@ -1416,14 +2362,38 @@ def professional_soldier_meta_download(request):
class Professional_priesthoodCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_priesthood
form_class = Professional_priesthoodForm
template_name = "sc/professional_priesthood/professional_priesthood_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_priesthood-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1437,18 +2407,41 @@ def get_context_data(self, **kwargs):
class Professional_priesthoodUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_priesthood
form_class = Professional_priesthoodForm
template_name = "sc/professional_priesthood/professional_priesthood_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Priesthood"
return context
class Professional_priesthoodDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Professional_priesthood object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_priesthood
success_url = reverse_lazy('professional_priesthoods')
template_name = "core/delete_general.html"
@@ -1456,14 +2449,34 @@ class Professional_priesthoodDelete(PermissionRequiredMixin, DeleteView):
class Professional_priesthoodListView(generic.ListView):
+ """
+ Paginated view for listing all the Professional_priesthood objects.
+ """
model = Professional_priesthood
template_name = "sc/professional_priesthood/professional_priesthood_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_priesthoods')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Priesthood"
context["var_main_desc"] = "Talking about professions, professional priesthood refers to full-time professional priesthood."
@@ -1477,10 +2490,19 @@ def get_context_data(self, **kwargs):
class Professional_priesthoodListViewAll(generic.ListView):
+ """
+
+ """
model = Professional_priesthood
template_name = "sc/professional_priesthood/professional_priesthood_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_priesthoods_all')
def get_queryset(self):
@@ -1491,6 +2513,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Priesthood"
context["var_main_desc"] = "Talking about professions, professional priesthood refers to full-time professional priesthood."
@@ -1504,6 +2537,9 @@ def get_context_data(self, **kwargs):
return context
class Professional_priesthoodDetailView(generic.DetailView):
+ """
+
+ """
model = Professional_priesthood
template_name = "sc/professional_priesthood/professional_priesthood_detail.html"
@@ -1553,14 +2589,38 @@ def professional_priesthood_meta_download(request):
class Full_time_bureaucratCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Full_time_bureaucrat
form_class = Full_time_bureaucratForm
template_name = "sc/full_time_bureaucrat/full_time_bureaucrat_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('full_time_bureaucrat-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1574,18 +2634,41 @@ def get_context_data(self, **kwargs):
class Full_time_bureaucratUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Full_time_bureaucrat
form_class = Full_time_bureaucratForm
template_name = "sc/full_time_bureaucrat/full_time_bureaucrat_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Full Time Bureaucrat"
return context
class Full_time_bureaucratDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Full_time_bureaucrat object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Full_time_bureaucrat
success_url = reverse_lazy('full_time_bureaucrats')
template_name = "core/delete_general.html"
@@ -1593,14 +2676,34 @@ class Full_time_bureaucratDelete(PermissionRequiredMixin, DeleteView):
class Full_time_bureaucratListView(generic.ListView):
+ """
+ Paginated view for listing all the Full_time_bureaucrat objects.
+ """
model = Full_time_bureaucrat
template_name = "sc/full_time_bureaucrat/full_time_bureaucrat_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('full_time_bureaucrats')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Full Time Bureaucrat"
context["var_main_desc"] = "Talking about bureaucracy characteristics, full-time bureaucrats refer to full-time administrative specialists. code this absent if administrative duties are performed by generalists such as chiefs and subchiefs. also code it absent if state officials perform multiple functions, e.g. combining administrative tasks with military duties. note that this variable shouldn't be coded 'present' only on the basis of the presence of specialized government buildings; there must be some additional evidence of functional specialization in government."
@@ -1614,10 +2717,19 @@ def get_context_data(self, **kwargs):
class Full_time_bureaucratListViewAll(generic.ListView):
+ """
+
+ """
model = Full_time_bureaucrat
template_name = "sc/full_time_bureaucrat/full_time_bureaucrat_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('full_time_bureaucrats_all')
def get_queryset(self):
@@ -1628,6 +2740,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Full Time Bureaucrat"
context["var_main_desc"] = "Talking about bureaucracy characteristics, full-time bureaucrats refer to full-time administrative specialists. code this absent if administrative duties are performed by generalists such as chiefs and subchiefs. also code it absent if state officials perform multiple functions, e.g. combining administrative tasks with military duties. note that this variable shouldn't be coded 'present' only on the basis of the presence of specialized government buildings; there must be some additional evidence of functional specialization in government."
@@ -1641,6 +2764,9 @@ def get_context_data(self, **kwargs):
return context
class Full_time_bureaucratDetailView(generic.DetailView):
+ """
+
+ """
model = Full_time_bureaucrat
template_name = "sc/full_time_bureaucrat/full_time_bureaucrat_detail.html"
@@ -1690,14 +2816,38 @@ def full_time_bureaucrat_meta_download(request):
class Examination_systemCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Examination_system
form_class = Examination_systemForm
template_name = "sc/examination_system/examination_system_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('examination_system-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1711,18 +2861,41 @@ def get_context_data(self, **kwargs):
class Examination_systemUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Examination_system
form_class = Examination_systemForm
template_name = "sc/examination_system/examination_system_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Examination System"
return context
class Examination_systemDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Examination_system object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Examination_system
success_url = reverse_lazy('examination_systems')
template_name = "core/delete_general.html"
@@ -1730,14 +2903,34 @@ class Examination_systemDelete(PermissionRequiredMixin, DeleteView):
class Examination_systemListView(generic.ListView):
+ """
+ Paginated view for listing all the Examination_system objects.
+ """
model = Examination_system
template_name = "sc/examination_system/examination_system_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('examination_systems')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Examination System"
context["var_main_desc"] = "Talking about bureaucracy characteristics, the paradigmatic example of an examination system is the chinese imperial system."
@@ -1751,10 +2944,19 @@ def get_context_data(self, **kwargs):
class Examination_systemListViewAll(generic.ListView):
+ """
+
+ """
model = Examination_system
template_name = "sc/examination_system/examination_system_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('examination_systems_all')
def get_queryset(self):
@@ -1765,6 +2967,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Examination System"
context["var_main_desc"] = "Talking about bureaucracy characteristics, the paradigmatic example of an examination system is the chinese imperial system."
@@ -1778,6 +2991,9 @@ def get_context_data(self, **kwargs):
return context
class Examination_systemDetailView(generic.DetailView):
+ """
+
+ """
model = Examination_system
template_name = "sc/examination_system/examination_system_detail.html"
@@ -1827,14 +3043,38 @@ def examination_system_meta_download(request):
class Merit_promotionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merit_promotion
form_class = Merit_promotionForm
template_name = "sc/merit_promotion/merit_promotion_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merit_promotion-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1848,18 +3088,41 @@ def get_context_data(self, **kwargs):
class Merit_promotionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merit_promotion
form_class = Merit_promotionForm
template_name = "sc/merit_promotion/merit_promotion_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Merit Promotion"
return context
class Merit_promotionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Merit_promotion object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merit_promotion
success_url = reverse_lazy('merit_promotions')
template_name = "core/delete_general.html"
@@ -1867,14 +3130,34 @@ class Merit_promotionDelete(PermissionRequiredMixin, DeleteView):
class Merit_promotionListView(generic.ListView):
+ """
+ Paginated view for listing all the Merit_promotion objects.
+ """
model = Merit_promotion
template_name = "sc/merit_promotion/merit_promotion_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merit_promotions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Merit Promotion"
context["var_main_desc"] = "Talking about bureaucracy characteristics, merit promotion is coded present if there are regular, institutionalized procedures for promotion based on performance. when exceptional individuals are promoted to the top ranks, in the absence of institutionalized procedures, we code it under institution and equity variables"
@@ -1888,10 +3171,19 @@ def get_context_data(self, **kwargs):
class Merit_promotionListViewAll(generic.ListView):
+ """
+
+ """
model = Merit_promotion
template_name = "sc/merit_promotion/merit_promotion_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merit_promotions_all')
def get_queryset(self):
@@ -1902,6 +3194,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Merit Promotion"
context["var_main_desc"] = "Talking about bureaucracy characteristics, merit promotion is coded present if there are regular, institutionalized procedures for promotion based on performance. when exceptional individuals are promoted to the top ranks, in the absence of institutionalized procedures, we code it under institution and equity variables"
@@ -1915,6 +3218,9 @@ def get_context_data(self, **kwargs):
return context
class Merit_promotionDetailView(generic.DetailView):
+ """
+
+ """
model = Merit_promotion
template_name = "sc/merit_promotion/merit_promotion_detail.html"
@@ -1964,14 +3270,38 @@ def merit_promotion_meta_download(request):
class Specialized_government_buildingCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_government_building
form_class = Specialized_government_buildingForm
template_name = "sc/specialized_government_building/specialized_government_building_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_government_building-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -1985,18 +3315,41 @@ def get_context_data(self, **kwargs):
class Specialized_government_buildingUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_government_building
form_class = Specialized_government_buildingForm
template_name = "sc/specialized_government_building/specialized_government_building_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Specialized Government Building"
return context
class Specialized_government_buildingDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Specialized_government_building object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_government_building
success_url = reverse_lazy('specialized_government_buildings')
template_name = "core/delete_general.html"
@@ -2004,14 +3357,34 @@ class Specialized_government_buildingDelete(PermissionRequiredMixin, DeleteView)
class Specialized_government_buildingListView(generic.ListView):
+ """
+ Paginated view for listing all the Specialized_government_building objects.
+ """
model = Specialized_government_building
template_name = "sc/specialized_government_building/specialized_government_building_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_government_buildings')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Specialized Government Building"
context["var_main_desc"] = "Talking about bureaucracy characteristics, these buildings are where administrative officials are located, and must be distinct from the ruler's palace. they may be used for document storage, registration offices, minting money, etc. defense structures also are not coded here (see military). state-owned/operated workshop should also not be coded here."
@@ -2025,10 +3398,19 @@ def get_context_data(self, **kwargs):
class Specialized_government_buildingListViewAll(generic.ListView):
+ """
+
+ """
model = Specialized_government_building
template_name = "sc/specialized_government_building/specialized_government_building_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_government_buildings_all')
def get_queryset(self):
@@ -2039,6 +3421,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Specialized Government Building"
context["var_main_desc"] = "Talking about bureaucracy characteristics, these buildings are where administrative officials are located, and must be distinct from the ruler's palace. they may be used for document storage, registration offices, minting money, etc. defense structures also are not coded here (see military). state-owned/operated workshop should also not be coded here."
@@ -2052,6 +3445,9 @@ def get_context_data(self, **kwargs):
return context
class Specialized_government_buildingDetailView(generic.DetailView):
+ """
+
+ """
model = Specialized_government_building
template_name = "sc/specialized_government_building/specialized_government_building_detail.html"
@@ -2101,14 +3497,38 @@ def specialized_government_building_meta_download(request):
class Formal_legal_codeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Formal_legal_code
form_class = Formal_legal_codeForm
template_name = "sc/formal_legal_code/formal_legal_code_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('formal_legal_code-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2122,18 +3542,41 @@ def get_context_data(self, **kwargs):
class Formal_legal_codeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Formal_legal_code
form_class = Formal_legal_codeForm
template_name = "sc/formal_legal_code/formal_legal_code_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Formal Legal Code"
return context
class Formal_legal_codeDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Formal_legal_code object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Formal_legal_code
success_url = reverse_lazy('formal_legal_codes')
template_name = "core/delete_general.html"
@@ -2141,14 +3584,34 @@ class Formal_legal_codeDelete(PermissionRequiredMixin, DeleteView):
class Formal_legal_codeListView(generic.ListView):
+ """
+ Paginated view for listing all the Formal_legal_code objects.
+ """
model = Formal_legal_code
template_name = "sc/formal_legal_code/formal_legal_code_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('formal_legal_codes')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Formal Legal Code"
context["var_main_desc"] = "Talking about law, formal legal code refers to legal code usually, but not always written down. if not written down, code it 'present' when a uniform legal system is established by oral transmission (e.g., officials are taught the rules, or the laws are announced in a public space). provide a short description"
@@ -2162,10 +3625,19 @@ def get_context_data(self, **kwargs):
class Formal_legal_codeListViewAll(generic.ListView):
+ """
+
+ """
model = Formal_legal_code
template_name = "sc/formal_legal_code/formal_legal_code_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('formal_legal_codes_all')
def get_queryset(self):
@@ -2176,6 +3648,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Formal Legal Code"
context["var_main_desc"] = "Talking about law, formal legal code refers to legal code usually, but not always written down. if not written down, code it 'present' when a uniform legal system is established by oral transmission (e.g., officials are taught the rules, or the laws are announced in a public space). provide a short description"
@@ -2189,6 +3672,9 @@ def get_context_data(self, **kwargs):
return context
class Formal_legal_codeDetailView(generic.DetailView):
+ """
+
+ """
model = Formal_legal_code
template_name = "sc/formal_legal_code/formal_legal_code_detail.html"
@@ -2238,14 +3724,38 @@ def formal_legal_code_meta_download(request):
class JudgeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Judge
form_class = JudgeForm
template_name = "sc/judge/judge_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('judge-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2259,18 +3769,41 @@ def get_context_data(self, **kwargs):
class JudgeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Judge
form_class = JudgeForm
template_name = "sc/judge/judge_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Judge"
return context
class JudgeDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Judge object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Judge
success_url = reverse_lazy('judges')
template_name = "core/delete_general.html"
@@ -2278,14 +3811,34 @@ class JudgeDelete(PermissionRequiredMixin, DeleteView):
class JudgeListView(generic.ListView):
+ """
+ Paginated view for listing all the Judge objects.
+ """
model = Judge
template_name = "sc/judge/judge_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('judges')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Judge"
context["var_main_desc"] = "Talking about law, judges refers only to full-time professional judges"
@@ -2299,10 +3852,19 @@ def get_context_data(self, **kwargs):
class JudgeListViewAll(generic.ListView):
+ """
+
+ """
model = Judge
template_name = "sc/judge/judge_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('judges_all')
def get_queryset(self):
@@ -2313,6 +3875,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Judge"
context["var_main_desc"] = "Talking about law, judges refers only to full-time professional judges"
@@ -2326,6 +3899,9 @@ def get_context_data(self, **kwargs):
return context
class JudgeDetailView(generic.DetailView):
+ """
+
+ """
model = Judge
template_name = "sc/judge/judge_detail.html"
@@ -2375,14 +3951,38 @@ def judge_meta_download(request):
class CourtCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Court
form_class = CourtForm
template_name = "sc/court/court_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('court-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2396,18 +3996,41 @@ def get_context_data(self, **kwargs):
class CourtUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Court
form_class = CourtForm
template_name = "sc/court/court_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Court"
return context
class CourtDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Court object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Court
success_url = reverse_lazy('courts')
template_name = "core/delete_general.html"
@@ -2415,14 +4038,34 @@ class CourtDelete(PermissionRequiredMixin, DeleteView):
class CourtListView(generic.ListView):
+ """
+ Paginated view for listing all the Court objects.
+ """
model = Court
template_name = "sc/court/court_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('courts')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Court"
context["var_main_desc"] = "Talking about law, courts are buildings specialized for legal proceedings only."
@@ -2436,10 +4079,19 @@ def get_context_data(self, **kwargs):
class CourtListViewAll(generic.ListView):
+ """
+
+ """
model = Court
template_name = "sc/court/court_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('courts_all')
def get_queryset(self):
@@ -2450,6 +4102,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Court"
context["var_main_desc"] = "Talking about law, courts are buildings specialized for legal proceedings only."
@@ -2463,6 +4126,9 @@ def get_context_data(self, **kwargs):
return context
class CourtDetailView(generic.DetailView):
+ """
+
+ """
model = Court
template_name = "sc/court/court_detail.html"
@@ -2512,14 +4178,38 @@ def court_meta_download(request):
class Professional_lawyerCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_lawyer
form_class = Professional_lawyerForm
template_name = "sc/professional_lawyer/professional_lawyer_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_lawyer-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2533,18 +4223,41 @@ def get_context_data(self, **kwargs):
class Professional_lawyerUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_lawyer
form_class = Professional_lawyerForm
template_name = "sc/professional_lawyer/professional_lawyer_update.html"
permission_required = 'core.add_capital'
- def get_context_data(self, **kwargs):
+ def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Lawyer"
return context
class Professional_lawyerDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Professional_lawyer object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Professional_lawyer
success_url = reverse_lazy('professional_lawyers')
template_name = "core/delete_general.html"
@@ -2552,14 +4265,34 @@ class Professional_lawyerDelete(PermissionRequiredMixin, DeleteView):
class Professional_lawyerListView(generic.ListView):
+ """
+ Paginated view for listing all the Professional_lawyer objects.
+ """
model = Professional_lawyer
template_name = "sc/professional_lawyer/professional_lawyer_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_lawyers')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Lawyer"
context["var_main_desc"] = "Talking about law, no Descriptions IN Codebook."
@@ -2573,10 +4306,19 @@ def get_context_data(self, **kwargs):
class Professional_lawyerListViewAll(generic.ListView):
+ """
+
+ """
model = Professional_lawyer
template_name = "sc/professional_lawyer/professional_lawyer_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('professional_lawyers_all')
def get_queryset(self):
@@ -2587,6 +4329,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Professional Lawyer"
context["var_main_desc"] = "Talking about law, no Descriptions IN Codebook."
@@ -2600,6 +4353,9 @@ def get_context_data(self, **kwargs):
return context
class Professional_lawyerDetailView(generic.DetailView):
+ """
+
+ """
model = Professional_lawyer
template_name = "sc/professional_lawyer/professional_lawyer_detail.html"
@@ -2649,14 +4405,38 @@ def professional_lawyer_meta_download(request):
class Irrigation_systemCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Irrigation_system
form_class = Irrigation_systemForm
template_name = "sc/irrigation_system/irrigation_system_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('irrigation_system-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2670,18 +4450,41 @@ def get_context_data(self, **kwargs):
class Irrigation_systemUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Irrigation_system
form_class = Irrigation_systemForm
template_name = "sc/irrigation_system/irrigation_system_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Irrigation System"
return context
class Irrigation_systemDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Irrigation_system object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Irrigation_system
success_url = reverse_lazy('irrigation_systems')
template_name = "core/delete_general.html"
@@ -2689,14 +4492,34 @@ class Irrigation_systemDelete(PermissionRequiredMixin, DeleteView):
class Irrigation_systemListView(generic.ListView):
+ """
+ Paginated view for listing all the Irrigation_system objects.
+ """
model = Irrigation_system
template_name = "sc/irrigation_system/irrigation_system_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('irrigation_systems')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Irrigation System"
context["var_main_desc"] = "Talking about specialized buildings, irrigation systems are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -2710,10 +4533,19 @@ def get_context_data(self, **kwargs):
class Irrigation_systemListViewAll(generic.ListView):
+ """
+
+ """
model = Irrigation_system
template_name = "sc/irrigation_system/irrigation_system_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('irrigation_systems_all')
def get_queryset(self):
@@ -2724,6 +4556,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Irrigation System"
context["var_main_desc"] = "Talking about specialized buildings, irrigation systems are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -2737,6 +4580,9 @@ def get_context_data(self, **kwargs):
return context
class Irrigation_systemDetailView(generic.DetailView):
+ """
+
+ """
model = Irrigation_system
template_name = "sc/irrigation_system/irrigation_system_detail.html"
@@ -2786,14 +4632,38 @@ def irrigation_system_meta_download(request):
class Drinking_water_supply_systemCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Drinking_water_supply_system
form_class = Drinking_water_supply_systemForm
template_name = "sc/drinking_water_supply_system/drinking_water_supply_system_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('drinking_water_supply_system-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2807,18 +4677,41 @@ def get_context_data(self, **kwargs):
class Drinking_water_supply_systemUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Drinking_water_supply_system
form_class = Drinking_water_supply_systemForm
template_name = "sc/drinking_water_supply_system/drinking_water_supply_system_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Drinking Water Supply System"
return context
class Drinking_water_supply_systemDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Drinking_water_supply_system object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Drinking_water_supply_system
success_url = reverse_lazy('drinking_water_supply_systems')
template_name = "core/delete_general.html"
@@ -2826,14 +4719,34 @@ class Drinking_water_supply_systemDelete(PermissionRequiredMixin, DeleteView):
class Drinking_water_supply_systemListView(generic.ListView):
+ """
+ Paginated view for listing all the Drinking_water_supply_system objects.
+ """
model = Drinking_water_supply_system
template_name = "sc/drinking_water_supply_system/drinking_water_supply_system_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('drinking_water_supply_systems')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Drinking Water Supply System"
context["var_main_desc"] = "Talking about specialized buildings, drinking water supply systems are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -2847,10 +4760,19 @@ def get_context_data(self, **kwargs):
class Drinking_water_supply_systemListViewAll(generic.ListView):
+ """
+
+ """
model = Drinking_water_supply_system
template_name = "sc/drinking_water_supply_system/drinking_water_supply_system_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('drinking_water_supply_systems_all')
def get_queryset(self):
@@ -2861,6 +4783,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Drinking Water Supply System"
context["var_main_desc"] = "Talking about specialized buildings, drinking water supply systems are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -2874,6 +4807,9 @@ def get_context_data(self, **kwargs):
return context
class Drinking_water_supply_systemDetailView(generic.DetailView):
+ """
+
+ """
model = Drinking_water_supply_system
template_name = "sc/drinking_water_supply_system/drinking_water_supply_system_detail.html"
@@ -2923,14 +4859,38 @@ def drinking_water_supply_system_meta_download(request):
class MarketCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Market
form_class = MarketForm
template_name = "sc/market/market_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('market-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -2944,18 +4904,41 @@ def get_context_data(self, **kwargs):
class MarketUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Market
form_class = MarketForm
template_name = "sc/market/market_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Market"
return context
class MarketDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Market object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Market
success_url = reverse_lazy('markets')
template_name = "core/delete_general.html"
@@ -2963,14 +4946,34 @@ class MarketDelete(PermissionRequiredMixin, DeleteView):
class MarketListView(generic.ListView):
+ """
+ Paginated view for listing all the Market objects.
+ """
model = Market
template_name = "sc/market/market_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('markets')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Market"
context["var_main_desc"] = "Talking about specialized buildings, markets are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -2984,10 +4987,19 @@ def get_context_data(self, **kwargs):
class MarketListViewAll(generic.ListView):
+ """
+
+ """
model = Market
template_name = "sc/market/market_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('markets_all')
def get_queryset(self):
@@ -2998,6 +5010,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Market"
context["var_main_desc"] = "Talking about specialized buildings, markets are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -3011,6 +5034,9 @@ def get_context_data(self, **kwargs):
return context
class MarketDetailView(generic.DetailView):
+ """
+
+ """
model = Market
template_name = "sc/market/market_detail.html"
@@ -3060,14 +5086,38 @@ def market_meta_download(request):
class Food_storage_siteCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Food_storage_site
form_class = Food_storage_siteForm
template_name = "sc/food_storage_site/food_storage_site_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('food_storage_site-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3081,18 +5131,41 @@ def get_context_data(self, **kwargs):
class Food_storage_siteUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Food_storage_site
form_class = Food_storage_siteForm
template_name = "sc/food_storage_site/food_storage_site_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Food Storage Site"
return context
class Food_storage_siteDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Food_storage_site object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Food_storage_site
success_url = reverse_lazy('food_storage_sites')
template_name = "core/delete_general.html"
@@ -3100,14 +5173,34 @@ class Food_storage_siteDelete(PermissionRequiredMixin, DeleteView):
class Food_storage_siteListView(generic.ListView):
+ """
+ Paginated view for listing all the Food_storage_site objects.
+ """
model = Food_storage_site
template_name = "sc/food_storage_site/food_storage_site_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('food_storage_sites')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Food Storage Site"
context["var_main_desc"] = "Talking about specialized buildings, food storage sites are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -3121,10 +5214,19 @@ def get_context_data(self, **kwargs):
class Food_storage_siteListViewAll(generic.ListView):
+ """
+
+ """
model = Food_storage_site
template_name = "sc/food_storage_site/food_storage_site_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('food_storage_sites_all')
def get_queryset(self):
@@ -3135,6 +5237,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Food Storage Site"
context["var_main_desc"] = "Talking about specialized buildings, food storage sites are polity owned (which includes owned by the community, or the state), no Descriptions IN Codebook"
@@ -3148,6 +5261,9 @@ def get_context_data(self, **kwargs):
return context
class Food_storage_siteDetailView(generic.DetailView):
+ """
+
+ """
model = Food_storage_site
template_name = "sc/food_storage_site/food_storage_site_detail.html"
@@ -3197,14 +5313,38 @@ def food_storage_site_meta_download(request):
class RoadCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Road
form_class = RoadForm
template_name = "sc/road/road_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('road-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3218,18 +5358,41 @@ def get_context_data(self, **kwargs):
class RoadUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Road
form_class = RoadForm
template_name = "sc/road/road_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Road"
return context
class RoadDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Road object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Road
success_url = reverse_lazy('roads')
template_name = "core/delete_general.html"
@@ -3237,14 +5400,34 @@ class RoadDelete(PermissionRequiredMixin, DeleteView):
class RoadListView(generic.ListView):
+ """
+ Paginated view for listing all the Road objects.
+ """
model = Road
template_name = "sc/road/road_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('roads')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Road"
context["var_main_desc"] = "Talking about transport infrastructure, roads refers to deliberately constructed roads that connect settlements or other sites. it excludes streets/accessways within settlements and paths between settlements that develop through repeated use."
@@ -3258,10 +5441,19 @@ def get_context_data(self, **kwargs):
class RoadListViewAll(generic.ListView):
+ """
+
+ """
model = Road
template_name = "sc/road/road_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('roads_all')
def get_queryset(self):
@@ -3272,6 +5464,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Road"
context["var_main_desc"] = "Talking about transport infrastructure, roads refers to deliberately constructed roads that connect settlements or other sites. it excludes streets/accessways within settlements and paths between settlements that develop through repeated use."
@@ -3285,6 +5488,9 @@ def get_context_data(self, **kwargs):
return context
class RoadDetailView(generic.DetailView):
+ """
+
+ """
model = Road
template_name = "sc/road/road_detail.html"
@@ -3334,14 +5540,38 @@ def road_meta_download(request):
class BridgeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bridge
form_class = BridgeForm
template_name = "sc/bridge/bridge_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bridge-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3355,18 +5585,41 @@ def get_context_data(self, **kwargs):
class BridgeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bridge
form_class = BridgeForm
template_name = "sc/bridge/bridge_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Bridge"
return context
class BridgeDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Bridge object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bridge
success_url = reverse_lazy('bridges')
template_name = "core/delete_general.html"
@@ -3374,14 +5627,34 @@ class BridgeDelete(PermissionRequiredMixin, DeleteView):
class BridgeListView(generic.ListView):
+ """
+ Paginated view for listing all the Bridge objects.
+ """
model = Bridge
template_name = "sc/bridge/bridge_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bridges')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Bridge"
context["var_main_desc"] = "Talking about transport infrastructure, bridges refers to bridges built and/or maintained by the polity (that is, code 'present' even if the polity did not build a bridge, but devotes resources to maintaining it)."
@@ -3395,10 +5668,19 @@ def get_context_data(self, **kwargs):
class BridgeListViewAll(generic.ListView):
+ """
+
+ """
model = Bridge
template_name = "sc/bridge/bridge_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bridges_all')
def get_queryset(self):
@@ -3409,6 +5691,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Bridge"
context["var_main_desc"] = "Talking about transport infrastructure, bridges refers to bridges built and/or maintained by the polity (that is, code 'present' even if the polity did not build a bridge, but devotes resources to maintaining it)."
@@ -3422,6 +5715,9 @@ def get_context_data(self, **kwargs):
return context
class BridgeDetailView(generic.DetailView):
+ """
+
+ """
model = Bridge
template_name = "sc/bridge/bridge_detail.html"
@@ -3471,14 +5767,38 @@ def bridge_meta_download(request):
class CanalCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Canal
form_class = CanalForm
template_name = "sc/canal/canal_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('canal-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3492,18 +5812,41 @@ def get_context_data(self, **kwargs):
class CanalUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Canal
form_class = CanalForm
template_name = "sc/canal/canal_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Canal"
return context
class CanalDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Canal object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Canal
success_url = reverse_lazy('canals')
template_name = "core/delete_general.html"
@@ -3511,14 +5854,34 @@ class CanalDelete(PermissionRequiredMixin, DeleteView):
class CanalListView(generic.ListView):
+ """
+ Paginated view for listing all the Canal objects.
+ """
model = Canal
template_name = "sc/canal/canal_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('canals')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Canal"
context["var_main_desc"] = "Talking about transport infrastructure, canals refers to canals built and/or maintained by the polity (that is, code 'present' even if the polity did not build a canal, but devotes resources to maintaining it)."
@@ -3532,10 +5895,19 @@ def get_context_data(self, **kwargs):
class CanalListViewAll(generic.ListView):
+ """
+
+ """
model = Canal
template_name = "sc/canal/canal_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('canals_all')
def get_queryset(self):
@@ -3546,6 +5918,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Canal"
context["var_main_desc"] = "Talking about transport infrastructure, canals refers to canals built and/or maintained by the polity (that is, code 'present' even if the polity did not build a canal, but devotes resources to maintaining it)."
@@ -3559,6 +5942,9 @@ def get_context_data(self, **kwargs):
return context
class CanalDetailView(generic.DetailView):
+ """
+
+ """
model = Canal
template_name = "sc/canal/canal_detail.html"
@@ -3608,14 +5994,38 @@ def canal_meta_download(request):
class PortCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Port
form_class = PortForm
template_name = "sc/port/port_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('port-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3629,18 +6039,41 @@ def get_context_data(self, **kwargs):
class PortUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Port
form_class = PortForm
template_name = "sc/port/port_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Port"
return context
class PortDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Port object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Port
success_url = reverse_lazy('ports')
template_name = "core/delete_general.html"
@@ -3648,14 +6081,34 @@ class PortDelete(PermissionRequiredMixin, DeleteView):
class PortListView(generic.ListView):
+ """
+ Paginated view for listing all the Port objects.
+ """
model = Port
template_name = "sc/port/port_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ports')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Port"
context["var_main_desc"] = "Talking about transport infrastructure, ports include river ports. direct historical or archaeological evidence of ports is absent when no port has been excavated or all evidence of such has been obliterated. indirect historical or archaeological data is absent when there is no evidence that suggests that the polity engaged in maritime or riverine trade, conflict, or transportation, such as evidence of merchant shipping, administrative records of customs duties, or evidence that at the same period of time a trading relation in the region had a port (for example, due to natural processes, there is little evidence of ancient ports in delta egypt at a time we know there was a timber trade with the levant). when evidence for the variable itself is available the code is 'present.' when other forms of evidence suggests the existence of the variable (or not) the code may be 'inferred present' (or 'inferred absent'). when indirect evidence is not available the code will be either absent, temporal uncertainty, suspected unknown, or unknown."
@@ -3669,10 +6122,19 @@ def get_context_data(self, **kwargs):
class PortListViewAll(generic.ListView):
+ """
+
+ """
model = Port
template_name = "sc/port/port_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ports_all')
def get_queryset(self):
@@ -3683,6 +6145,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Port"
context["var_main_desc"] = "Talking about transport infrastructure, ports include river ports. direct historical or archaeological evidence of ports is absent when no port has been excavated or all evidence of such has been obliterated. indirect historical or archaeological data is absent when there is no evidence that suggests that the polity engaged in maritime or riverine trade, conflict, or transportation, such as evidence of merchant shipping, administrative records of customs duties, or evidence that at the same period of time a trading relation in the region had a port (for example, due to natural processes, there is little evidence of ancient ports in delta egypt at a time we know there was a timber trade with the levant). when evidence for the variable itself is available the code is 'present.' when other forms of evidence suggests the existence of the variable (or not) the code may be 'inferred present' (or 'inferred absent'). when indirect evidence is not available the code will be either absent, temporal uncertainty, suspected unknown, or unknown."
@@ -3696,6 +6169,9 @@ def get_context_data(self, **kwargs):
return context
class PortDetailView(generic.DetailView):
+ """
+
+ """
model = Port
template_name = "sc/port/port_detail.html"
@@ -3745,14 +6221,38 @@ def port_meta_download(request):
class Mines_or_quarryCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mines_or_quarry
form_class = Mines_or_quarryForm
template_name = "sc/mines_or_quarry/mines_or_quarry_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mines_or_quarry-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3766,18 +6266,41 @@ def get_context_data(self, **kwargs):
class Mines_or_quarryUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mines_or_quarry
form_class = Mines_or_quarryForm
template_name = "sc/mines_or_quarry/mines_or_quarry_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mines or Quarry"
return context
class Mines_or_quarryDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Mines_or_quarry object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mines_or_quarry
success_url = reverse_lazy('mines_or_quarrys')
template_name = "core/delete_general.html"
@@ -3785,14 +6308,34 @@ class Mines_or_quarryDelete(PermissionRequiredMixin, DeleteView):
class Mines_or_quarryListView(generic.ListView):
+ """
+ Paginated view for listing all the Mines_or_quarry objects.
+ """
model = Mines_or_quarry
template_name = "sc/mines_or_quarry/mines_or_quarry_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mines_or_quarrys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mines or Quarry"
context["var_main_desc"] = "Talking about special purpose sites, no Descriptions IN Codebook"
@@ -3806,10 +6349,19 @@ def get_context_data(self, **kwargs):
class Mines_or_quarryListViewAll(generic.ListView):
+ """
+
+ """
model = Mines_or_quarry
template_name = "sc/mines_or_quarry/mines_or_quarry_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mines_or_quarrys_all')
def get_queryset(self):
@@ -3820,6 +6372,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mines or Quarry"
context["var_main_desc"] = "Talking about special purpose sites, no Descriptions IN Codebook"
@@ -3833,6 +6396,9 @@ def get_context_data(self, **kwargs):
return context
class Mines_or_quarryDetailView(generic.DetailView):
+ """
+
+ """
model = Mines_or_quarry
template_name = "sc/mines_or_quarry/mines_or_quarry_detail.html"
@@ -3882,14 +6448,38 @@ def mines_or_quarry_meta_download(request):
class Mnemonic_deviceCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mnemonic_device
form_class = Mnemonic_deviceForm
template_name = "sc/mnemonic_device/mnemonic_device_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mnemonic_device-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -3903,18 +6493,41 @@ def get_context_data(self, **kwargs):
class Mnemonic_deviceUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mnemonic_device
form_class = Mnemonic_deviceForm
template_name = "sc/mnemonic_device/mnemonic_device_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mnemonic Device"
return context
class Mnemonic_deviceDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Mnemonic_device object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Mnemonic_device
success_url = reverse_lazy('mnemonic_devices')
template_name = "core/delete_general.html"
@@ -3922,14 +6535,34 @@ class Mnemonic_deviceDelete(PermissionRequiredMixin, DeleteView):
class Mnemonic_deviceListView(generic.ListView):
+ """
+ Paginated view for listing all the Mnemonic_device objects.
+ """
model = Mnemonic_device
template_name = "sc/mnemonic_device/mnemonic_device_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mnemonic_devices')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mnemonic Device"
context["var_main_desc"] = "Talking about writing systems, mnemonic devices are: for example, tallies"
@@ -3943,10 +6576,19 @@ def get_context_data(self, **kwargs):
class Mnemonic_deviceListViewAll(generic.ListView):
+ """
+
+ """
model = Mnemonic_device
template_name = "sc/mnemonic_device/mnemonic_device_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('mnemonic_devices_all')
def get_queryset(self):
@@ -3957,6 +6599,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Mnemonic Device"
context["var_main_desc"] = "Talking about writing systems, mnemonic devices are: for example, tallies"
@@ -3970,6 +6623,9 @@ def get_context_data(self, **kwargs):
return context
class Mnemonic_deviceDetailView(generic.DetailView):
+ """
+
+ """
model = Mnemonic_device
template_name = "sc/mnemonic_device/mnemonic_device_detail.html"
@@ -4019,14 +6675,38 @@ def mnemonic_device_meta_download(request):
class Nonwritten_recordCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Nonwritten_record
form_class = Nonwritten_recordForm
template_name = "sc/nonwritten_record/nonwritten_record_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('nonwritten_record-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4040,18 +6720,41 @@ def get_context_data(self, **kwargs):
class Nonwritten_recordUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Nonwritten_record
form_class = Nonwritten_recordForm
template_name = "sc/nonwritten_record/nonwritten_record_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Nonwritten Record"
return context
class Nonwritten_recordDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Nonwritten_record object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Nonwritten_record
success_url = reverse_lazy('nonwritten_records')
template_name = "core/delete_general.html"
@@ -4059,14 +6762,34 @@ class Nonwritten_recordDelete(PermissionRequiredMixin, DeleteView):
class Nonwritten_recordListView(generic.ListView):
+ """
+ Paginated view for listing all the Nonwritten_record objects.
+ """
model = Nonwritten_record
template_name = "sc/nonwritten_record/nonwritten_record_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('nonwritten_records')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Nonwritten Record"
context["var_main_desc"] = "Talking about writing systems, nonwritten records are more extensive than mnemonics, but don't utilize script. example: quipu; seals and stamps"
@@ -4080,10 +6803,19 @@ def get_context_data(self, **kwargs):
class Nonwritten_recordListViewAll(generic.ListView):
+ """
+
+ """
model = Nonwritten_record
template_name = "sc/nonwritten_record/nonwritten_record_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('nonwritten_records_all')
def get_queryset(self):
@@ -4094,6 +6826,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Nonwritten Record"
context["var_main_desc"] = "Talking about writing systems, nonwritten records are more extensive than mnemonics, but don't utilize script. example: quipu; seals and stamps"
@@ -4107,6 +6850,9 @@ def get_context_data(self, **kwargs):
return context
class Nonwritten_recordDetailView(generic.DetailView):
+ """
+
+ """
model = Nonwritten_record
template_name = "sc/nonwritten_record/nonwritten_record_detail.html"
@@ -4156,14 +6902,38 @@ def nonwritten_record_meta_download(request):
class Written_recordCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Written_record
form_class = Written_recordForm
template_name = "sc/written_record/written_record_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('written_record-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4177,18 +6947,41 @@ def get_context_data(self, **kwargs):
class Written_recordUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Written_record
form_class = Written_recordForm
template_name = "sc/written_record/written_record_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Written Record"
return context
class Written_recordDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Written_record object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Written_record
success_url = reverse_lazy('written_records')
template_name = "core/delete_general.html"
@@ -4196,14 +6989,34 @@ class Written_recordDelete(PermissionRequiredMixin, DeleteView):
class Written_recordListView(generic.ListView):
+ """
+ Paginated view for listing all the Written_record objects.
+ """
model = Written_record
template_name = "sc/written_record/written_record_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('written_records')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Written Record"
context["var_main_desc"] = "Talking about writing systems, written records are more than short and fragmentary inscriptions, such as found on tombs or runic stones. there must be several sentences strung together, at the very minimum. for example, royal proclamations from mesopotamia and egypt qualify as written records"
@@ -4217,10 +7030,19 @@ def get_context_data(self, **kwargs):
class Written_recordListViewAll(generic.ListView):
+ """
+
+ """
model = Written_record
template_name = "sc/written_record/written_record_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('written_records_all')
def get_queryset(self):
@@ -4231,6 +7053,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Written Record"
context["var_main_desc"] = "Talking about writing systems, written records are more than short and fragmentary inscriptions, such as found on tombs or runic stones. there must be several sentences strung together, at the very minimum. for example, royal proclamations from mesopotamia and egypt qualify as written records"
@@ -4244,6 +7077,9 @@ def get_context_data(self, **kwargs):
return context
class Written_recordDetailView(generic.DetailView):
+ """
+
+ """
model = Written_record
template_name = "sc/written_record/written_record_detail.html"
@@ -4293,14 +7129,38 @@ def written_record_meta_download(request):
class ScriptCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Script
form_class = ScriptForm
template_name = "sc/script/script_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('script-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4314,18 +7174,41 @@ def get_context_data(self, **kwargs):
class ScriptUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Script
form_class = ScriptForm
template_name = "sc/script/script_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Script"
return context
class ScriptDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Script object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Script
success_url = reverse_lazy('scripts')
template_name = "core/delete_general.html"
@@ -4333,14 +7216,34 @@ class ScriptDelete(PermissionRequiredMixin, DeleteView):
class ScriptListView(generic.ListView):
+ """
+ Paginated view for listing all the Script objects.
+ """
model = Script
template_name = "sc/script/script_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scripts')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Script"
context["var_main_desc"] = "Talking about writing systems, script is as indicated at least by fragmentary inscriptions (note that if written records are present, then so is script)"
@@ -4354,10 +7257,19 @@ def get_context_data(self, **kwargs):
class ScriptListViewAll(generic.ListView):
+ """
+
+ """
model = Script
template_name = "sc/script/script_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scripts_all')
def get_queryset(self):
@@ -4368,6 +7280,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Script"
context["var_main_desc"] = "Talking about writing systems, script is as indicated at least by fragmentary inscriptions (note that if written records are present, then so is script)"
@@ -4381,6 +7304,9 @@ def get_context_data(self, **kwargs):
return context
class ScriptDetailView(generic.DetailView):
+ """
+
+ """
model = Script
template_name = "sc/script/script_detail.html"
@@ -4449,14 +7375,38 @@ def script_meta_download(request):
class Non_phonetic_writingCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Non_phonetic_writing
form_class = Non_phonetic_writingForm
template_name = "sc/non_phonetic_writing/non_phonetic_writing_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('non_phonetic_writing-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4470,18 +7420,41 @@ def get_context_data(self, **kwargs):
class Non_phonetic_writingUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Non_phonetic_writing
form_class = Non_phonetic_writingForm
template_name = "sc/non_phonetic_writing/non_phonetic_writing_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Non Phonetic Writing"
return context
class Non_phonetic_writingDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Non_phonetic_writing object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Non_phonetic_writing
success_url = reverse_lazy('non_phonetic_writings')
template_name = "core/delete_general.html"
@@ -4489,14 +7462,34 @@ class Non_phonetic_writingDelete(PermissionRequiredMixin, DeleteView):
class Non_phonetic_writingListView(generic.ListView):
+ """
+ Paginated view for listing all the Non_phonetic_writing objects.
+ """
model = Non_phonetic_writing
template_name = "sc/non_phonetic_writing/non_phonetic_writing_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('non_phonetic_writings')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Non Phonetic Writing"
context["var_main_desc"] = "Talking about writing systems, this refers to the kind of script"
@@ -4510,10 +7503,19 @@ def get_context_data(self, **kwargs):
class Non_phonetic_writingListViewAll(generic.ListView):
+ """
+
+ """
model = Non_phonetic_writing
template_name = "sc/non_phonetic_writing/non_phonetic_writing_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('non_phonetic_writings_all')
def get_queryset(self):
@@ -4524,6 +7526,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Non Phonetic Writing"
context["var_main_desc"] = "Talking about writing systems, this refers to the kind of script"
@@ -4537,6 +7550,9 @@ def get_context_data(self, **kwargs):
return context
class Non_phonetic_writingDetailView(generic.DetailView):
+ """
+
+ """
model = Non_phonetic_writing
template_name = "sc/non_phonetic_writing/non_phonetic_writing_detail.html"
@@ -4586,14 +7602,38 @@ def non_phonetic_writing_meta_download(request):
class Phonetic_alphabetic_writingCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Phonetic_alphabetic_writing
form_class = Phonetic_alphabetic_writingForm
template_name = "sc/phonetic_alphabetic_writing/phonetic_alphabetic_writing_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('phonetic_alphabetic_writing-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4607,18 +7647,41 @@ def get_context_data(self, **kwargs):
class Phonetic_alphabetic_writingUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Phonetic_alphabetic_writing
form_class = Phonetic_alphabetic_writingForm
template_name = "sc/phonetic_alphabetic_writing/phonetic_alphabetic_writing_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Phonetic Alphabetic Writing"
return context
class Phonetic_alphabetic_writingDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Phonetic_alphabetic_writing object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Phonetic_alphabetic_writing
success_url = reverse_lazy('phonetic_alphabetic_writings')
template_name = "core/delete_general.html"
@@ -4626,14 +7689,34 @@ class Phonetic_alphabetic_writingDelete(PermissionRequiredMixin, DeleteView):
class Phonetic_alphabetic_writingListView(generic.ListView):
+ """
+ Paginated view for listing all the Phonetic_alphabetic_writing objects.
+ """
model = Phonetic_alphabetic_writing
template_name = "sc/phonetic_alphabetic_writing/phonetic_alphabetic_writing_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('phonetic_alphabetic_writings')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Phonetic Alphabetic Writing"
context["var_main_desc"] = "Talking about writing systems, this refers to the kind of script"
@@ -4647,10 +7730,19 @@ def get_context_data(self, **kwargs):
class Phonetic_alphabetic_writingListViewAll(generic.ListView):
+ """
+
+ """
model = Phonetic_alphabetic_writing
template_name = "sc/phonetic_alphabetic_writing/phonetic_alphabetic_writing_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('phonetic_alphabetic_writings_all')
def get_queryset(self):
@@ -4661,6 +7753,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Phonetic Alphabetic Writing"
context["var_main_desc"] = "Talking about writing systems, this refers to the kind of script"
@@ -4674,6 +7777,9 @@ def get_context_data(self, **kwargs):
return context
class Phonetic_alphabetic_writingDetailView(generic.DetailView):
+ """
+
+ """
model = Phonetic_alphabetic_writing
template_name = "sc/phonetic_alphabetic_writing/phonetic_alphabetic_writing_detail.html"
@@ -4723,14 +7829,38 @@ def phonetic_alphabetic_writing_meta_download(request):
class Lists_tables_and_classificationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Lists_tables_and_classification
form_class = Lists_tables_and_classificationForm
template_name = "sc/lists_tables_and_classification/lists_tables_and_classification_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('lists_tables_and_classification-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4744,18 +7874,41 @@ def get_context_data(self, **kwargs):
class Lists_tables_and_classificationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Lists_tables_and_classification
form_class = Lists_tables_and_classificationForm
template_name = "sc/lists_tables_and_classification/lists_tables_and_classification_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Lists Tables and Classification"
return context
class Lists_tables_and_classificationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Lists_tables_and_classification object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Lists_tables_and_classification
success_url = reverse_lazy('lists_tables_and_classifications')
template_name = "core/delete_general.html"
@@ -4763,14 +7916,34 @@ class Lists_tables_and_classificationDelete(PermissionRequiredMixin, DeleteView)
class Lists_tables_and_classificationListView(generic.ListView):
+ """
+ Paginated view for listing all the Lists_tables_and_classification objects.
+ """
model = Lists_tables_and_classification
template_name = "sc/lists_tables_and_classification/lists_tables_and_classification_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('lists_tables_and_classifications')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Lists Tables and Classification"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -4784,10 +7957,19 @@ def get_context_data(self, **kwargs):
class Lists_tables_and_classificationListViewAll(generic.ListView):
+ """
+
+ """
model = Lists_tables_and_classification
template_name = "sc/lists_tables_and_classification/lists_tables_and_classification_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('lists_tables_and_classifications_all')
def get_queryset(self):
@@ -4798,6 +7980,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Lists Tables and Classification"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -4811,6 +8004,9 @@ def get_context_data(self, **kwargs):
return context
class Lists_tables_and_classificationDetailView(generic.DetailView):
+ """
+
+ """
model = Lists_tables_and_classification
template_name = "sc/lists_tables_and_classification/lists_tables_and_classification_detail.html"
@@ -4860,14 +8056,38 @@ def lists_tables_and_classification_meta_download(request):
class CalendarCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Calendar
form_class = CalendarForm
template_name = "sc/calendar/calendar_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('calendar-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -4881,18 +8101,41 @@ def get_context_data(self, **kwargs):
class CalendarUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Calendar
form_class = CalendarForm
template_name = "sc/calendar/calendar_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Calendar"
return context
class CalendarDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Calendar object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Calendar
success_url = reverse_lazy('calendars')
template_name = "core/delete_general.html"
@@ -4900,14 +8143,34 @@ class CalendarDelete(PermissionRequiredMixin, DeleteView):
class CalendarListView(generic.ListView):
+ """
+ Paginated view for listing all the Calendar objects.
+ """
model = Calendar
template_name = "sc/calendar/calendar_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('calendars')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Calendar"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -4921,10 +8184,19 @@ def get_context_data(self, **kwargs):
class CalendarListViewAll(generic.ListView):
+ """
+
+ """
model = Calendar
template_name = "sc/calendar/calendar_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('calendars_all')
def get_queryset(self):
@@ -4935,6 +8207,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Calendar"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -4948,6 +8231,9 @@ def get_context_data(self, **kwargs):
return context
class CalendarDetailView(generic.DetailView):
+ """
+
+ """
model = Calendar
template_name = "sc/calendar/calendar_detail.html"
@@ -4997,14 +8283,38 @@ def calendar_meta_download(request):
class Sacred_textCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sacred_text
form_class = Sacred_textForm
template_name = "sc/sacred_text/sacred_text_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sacred_text-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5018,18 +8328,41 @@ def get_context_data(self, **kwargs):
class Sacred_textUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sacred_text
form_class = Sacred_textForm
template_name = "sc/sacred_text/sacred_text_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Sacred Text"
return context
class Sacred_textDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Sacred_text object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sacred_text
success_url = reverse_lazy('sacred_texts')
template_name = "core/delete_general.html"
@@ -5037,14 +8370,34 @@ class Sacred_textDelete(PermissionRequiredMixin, DeleteView):
class Sacred_textListView(generic.ListView):
+ """
+ Paginated view for listing all the Sacred_text objects.
+ """
model = Sacred_text
template_name = "sc/sacred_text/sacred_text_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sacred_texts')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Sacred Text"
context["var_main_desc"] = "Talking about kinds of written documents, sacred texts originate from supernatural agents (deities), or are directly inspired by them."
@@ -5058,10 +8411,19 @@ def get_context_data(self, **kwargs):
class Sacred_textListViewAll(generic.ListView):
+ """
+
+ """
model = Sacred_text
template_name = "sc/sacred_text/sacred_text_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sacred_texts_all')
def get_queryset(self):
@@ -5072,6 +8434,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Sacred Text"
context["var_main_desc"] = "Talking about kinds of written documents, sacred texts originate from supernatural agents (deities), or are directly inspired by them."
@@ -5085,6 +8458,9 @@ def get_context_data(self, **kwargs):
return context
class Sacred_textDetailView(generic.DetailView):
+ """
+
+ """
model = Sacred_text
template_name = "sc/sacred_text/sacred_text_detail.html"
@@ -5134,14 +8510,38 @@ def sacred_text_meta_download(request):
class Religious_literatureCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_literature
form_class = Religious_literatureForm
template_name = "sc/religious_literature/religious_literature_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_literature-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5155,18 +8555,41 @@ def get_context_data(self, **kwargs):
class Religious_literatureUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_literature
form_class = Religious_literatureForm
template_name = "sc/religious_literature/religious_literature_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Literature"
return context
class Religious_literatureDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Religious_literature object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Religious_literature
success_url = reverse_lazy('religious_literatures')
template_name = "core/delete_general.html"
@@ -5174,14 +8597,34 @@ class Religious_literatureDelete(PermissionRequiredMixin, DeleteView):
class Religious_literatureListView(generic.ListView):
+ """
+ Paginated view for listing all the Religious_literature objects.
+ """
model = Religious_literature
template_name = "sc/religious_literature/religious_literature_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_literatures')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Literature"
context["var_main_desc"] = "Talking about kinds of written documents, religious literature differs from the sacred texts. for example, it may provide commentary on the sacred texts, or advice on how to live a virtuous life."
@@ -5195,10 +8638,19 @@ def get_context_data(self, **kwargs):
class Religious_literatureListViewAll(generic.ListView):
+ """
+
+ """
model = Religious_literature
template_name = "sc/religious_literature/religious_literature_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('religious_literatures_all')
def get_queryset(self):
@@ -5209,6 +8661,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Religious Literature"
context["var_main_desc"] = "Talking about kinds of written documents, religious literature differs from the sacred texts. for example, it may provide commentary on the sacred texts, or advice on how to live a virtuous life."
@@ -5222,6 +8685,9 @@ def get_context_data(self, **kwargs):
return context
class Religious_literatureDetailView(generic.DetailView):
+ """
+
+ """
model = Religious_literature
template_name = "sc/religious_literature/religious_literature_detail.html"
@@ -5271,14 +8737,38 @@ def religious_literature_meta_download(request):
class Practical_literatureCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Practical_literature
form_class = Practical_literatureForm
template_name = "sc/practical_literature/practical_literature_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('practical_literature-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5292,18 +8782,41 @@ def get_context_data(self, **kwargs):
class Practical_literatureUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Practical_literature
form_class = Practical_literatureForm
template_name = "sc/practical_literature/practical_literature_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Practical Literature"
return context
class Practical_literatureDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Practical_literature object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Practical_literature
success_url = reverse_lazy('practical_literatures')
template_name = "core/delete_general.html"
@@ -5311,14 +8824,34 @@ class Practical_literatureDelete(PermissionRequiredMixin, DeleteView):
class Practical_literatureListView(generic.ListView):
+ """
+ Paginated view for listing all the Practical_literature objects.
+ """
model = Practical_literature
template_name = "sc/practical_literature/practical_literature_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('practical_literatures')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Practical Literature"
context["var_main_desc"] = "Talking about kinds of written documents, practical literature refers to texts written with the aim of providing guidance on a certain topic, for example manuals on agriculture, warfare, or cooking. letters do not count as practical literature."
@@ -5332,10 +8865,19 @@ def get_context_data(self, **kwargs):
class Practical_literatureListViewAll(generic.ListView):
+ """
+
+ """
model = Practical_literature
template_name = "sc/practical_literature/practical_literature_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('practical_literatures_all')
def get_queryset(self):
@@ -5346,6 +8888,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Practical Literature"
context["var_main_desc"] = "Talking about kinds of written documents, practical literature refers to texts written with the aim of providing guidance on a certain topic, for example manuals on agriculture, warfare, or cooking. letters do not count as practical literature."
@@ -5359,6 +8912,9 @@ def get_context_data(self, **kwargs):
return context
class Practical_literatureDetailView(generic.DetailView):
+ """
+
+ """
model = Practical_literature
template_name = "sc/practical_literature/practical_literature_detail.html"
@@ -5408,14 +8964,38 @@ def practical_literature_meta_download(request):
class HistoryCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = History
form_class = HistoryForm
template_name = "sc/history/history_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('history-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5429,18 +9009,41 @@ def get_context_data(self, **kwargs):
class HistoryUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = History
form_class = HistoryForm
template_name = "sc/history/history_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "History"
return context
class HistoryDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing History object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = History
success_url = reverse_lazy('historys')
template_name = "core/delete_general.html"
@@ -5448,14 +9051,34 @@ class HistoryDelete(PermissionRequiredMixin, DeleteView):
class HistoryListView(generic.ListView):
+ """
+ Paginated view for listing all the History objects.
+ """
model = History
template_name = "sc/history/history_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('historys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "History"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -5469,10 +9092,19 @@ def get_context_data(self, **kwargs):
class HistoryListViewAll(generic.ListView):
+ """
+
+ """
model = History
template_name = "sc/history/history_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('historys_all')
def get_queryset(self):
@@ -5483,6 +9115,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "History"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -5496,6 +9139,9 @@ def get_context_data(self, **kwargs):
return context
class HistoryDetailView(generic.DetailView):
+ """
+
+ """
model = History
template_name = "sc/history/history_detail.html"
@@ -5545,14 +9191,38 @@ def history_meta_download(request):
class PhilosophyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Philosophy
form_class = PhilosophyForm
template_name = "sc/philosophy/philosophy_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('philosophy-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5566,18 +9236,41 @@ def get_context_data(self, **kwargs):
class PhilosophyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Philosophy
form_class = PhilosophyForm
template_name = "sc/philosophy/philosophy_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Philosophy"
return context
class PhilosophyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Philosophy object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Philosophy
success_url = reverse_lazy('philosophys')
template_name = "core/delete_general.html"
@@ -5585,14 +9278,34 @@ class PhilosophyDelete(PermissionRequiredMixin, DeleteView):
class PhilosophyListView(generic.ListView):
+ """
+ Paginated view for listing all the Philosophy objects.
+ """
model = Philosophy
template_name = "sc/philosophy/philosophy_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('philosophys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Philosophy"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -5606,10 +9319,19 @@ def get_context_data(self, **kwargs):
class PhilosophyListViewAll(generic.ListView):
+ """
+
+ """
model = Philosophy
template_name = "sc/philosophy/philosophy_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('philosophys_all')
def get_queryset(self):
@@ -5620,6 +9342,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Philosophy"
context["var_main_desc"] = "Talking about kinds of written documents, no Descriptions IN Codebook"
@@ -5633,6 +9366,9 @@ def get_context_data(self, **kwargs):
return context
class PhilosophyDetailView(generic.DetailView):
+ """
+
+ """
model = Philosophy
template_name = "sc/philosophy/philosophy_detail.html"
@@ -5682,14 +9418,38 @@ def philosophy_meta_download(request):
class Scientific_literatureCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scientific_literature
form_class = Scientific_literatureForm
template_name = "sc/scientific_literature/scientific_literature_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scientific_literature-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5703,18 +9463,41 @@ def get_context_data(self, **kwargs):
class Scientific_literatureUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scientific_literature
form_class = Scientific_literatureForm
template_name = "sc/scientific_literature/scientific_literature_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Scientific Literature"
return context
class Scientific_literatureDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Scientific_literature object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scientific_literature
success_url = reverse_lazy('scientific_literatures')
template_name = "core/delete_general.html"
@@ -5722,14 +9505,34 @@ class Scientific_literatureDelete(PermissionRequiredMixin, DeleteView):
class Scientific_literatureListView(generic.ListView):
+ """
+ Paginated view for listing all the Scientific_literature objects.
+ """
model = Scientific_literature
template_name = "sc/scientific_literature/scientific_literature_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scientific_literatures')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Scientific Literature"
context["var_main_desc"] = "Talking about kinds of written documents, scientific literature includes mathematics, natural sciences, social sciences"
@@ -5743,10 +9546,19 @@ def get_context_data(self, **kwargs):
class Scientific_literatureListViewAll(generic.ListView):
+ """
+
+ """
model = Scientific_literature
template_name = "sc/scientific_literature/scientific_literature_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scientific_literatures_all')
def get_queryset(self):
@@ -5757,6 +9569,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Scientific Literature"
context["var_main_desc"] = "Talking about kinds of written documents, scientific literature includes mathematics, natural sciences, social sciences"
@@ -5770,6 +9593,9 @@ def get_context_data(self, **kwargs):
return context
class Scientific_literatureDetailView(generic.DetailView):
+ """
+
+ """
model = Scientific_literature
template_name = "sc/scientific_literature/scientific_literature_detail.html"
@@ -5819,14 +9645,38 @@ def scientific_literature_meta_download(request):
class FictionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Fiction
form_class = FictionForm
template_name = "sc/fiction/fiction_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fiction-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5840,18 +9690,41 @@ def get_context_data(self, **kwargs):
class FictionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Fiction
form_class = FictionForm
template_name = "sc/fiction/fiction_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Fiction"
return context
class FictionDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Fiction object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Fiction
success_url = reverse_lazy('fictions')
template_name = "core/delete_general.html"
@@ -5859,14 +9732,34 @@ class FictionDelete(PermissionRequiredMixin, DeleteView):
class FictionListView(generic.ListView):
+ """
+ Paginated view for listing all the Fiction objects.
+ """
model = Fiction
template_name = "sc/fiction/fiction_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fictions')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Fiction"
context["var_main_desc"] = "Talking about kinds of written documents, fiction includes poetry."
@@ -5880,10 +9773,19 @@ def get_context_data(self, **kwargs):
class FictionListViewAll(generic.ListView):
+ """
+
+ """
model = Fiction
template_name = "sc/fiction/fiction_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fictions_all')
def get_queryset(self):
@@ -5894,6 +9796,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Fiction"
context["var_main_desc"] = "Talking about kinds of written documents, fiction includes poetry."
@@ -5907,6 +9820,9 @@ def get_context_data(self, **kwargs):
return context
class FictionDetailView(generic.DetailView):
+ """
+
+ """
model = Fiction
template_name = "sc/fiction/fiction_detail.html"
@@ -5956,14 +9872,38 @@ def fiction_meta_download(request):
class ArticleCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Article
form_class = ArticleForm
template_name = "sc/article/article_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('article-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -5977,12 +9917,29 @@ def get_context_data(self, **kwargs):
class ArticleUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Article
form_class = ArticleForm
template_name = "sc/article/article_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Article"
context["testvar"] = ["a", "bb", "ccc"]
@@ -5991,6 +9948,12 @@ def get_context_data(self, **kwargs):
return context
class ArticleDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Article object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Article
success_url = reverse_lazy('articles')
template_name = "core/delete_general.html"
@@ -5998,14 +9961,34 @@ class ArticleDelete(PermissionRequiredMixin, DeleteView):
class ArticleListView(generic.ListView):
+ """
+ Paginated view for listing all the Article objects.
+ """
model = Article
template_name = "sc/article/article_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('articles')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Article"
context["var_main_desc"] = "Talking about forms of money, articles are items that have both a regular use and are used as money (example: axes, cattle, measures of grain, ingots of non-precious metals)"
@@ -6019,10 +10002,19 @@ def get_context_data(self, **kwargs):
class ArticleListViewAll(generic.ListView):
+ """
+
+ """
model = Article
template_name = "sc/article/article_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('articles_all')
def get_queryset(self):
@@ -6033,6 +10025,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Article"
context["var_main_desc"] = "Talking about forms of money, articles are items that have both a regular use and are used as money (example: axes, cattle, measures of grain, ingots of non-precious metals)"
@@ -6046,6 +10049,9 @@ def get_context_data(self, **kwargs):
return context
class ArticleDetailView(generic.DetailView):
+ """
+
+ """
model = Article
template_name = "sc/article/article_detail.html"
@@ -6095,14 +10101,38 @@ def article_meta_download(request):
class TokenCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Token
form_class = TokenForm
template_name = "sc/token/token_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('token-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6116,18 +10146,38 @@ def get_context_data(self, **kwargs):
class TokenUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+ """
model = Token
form_class = TokenForm
template_name = "sc/token/token_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Token"
return context
class TokenDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Token object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Token
success_url = reverse_lazy('tokens')
template_name = "core/delete_general.html"
@@ -6135,14 +10185,34 @@ class TokenDelete(PermissionRequiredMixin, DeleteView):
class TokenListView(generic.ListView):
+ """
+ Paginated view for listing all the Token objects.
+ """
model = Token
template_name = "sc/token/token_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tokens')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Token"
context["var_main_desc"] = "Talking about forms of money, tokens, unlike articles, are used only for exchange, and unlike coins, are not manufactured (example: cowries)"
@@ -6156,10 +10226,19 @@ def get_context_data(self, **kwargs):
class TokenListViewAll(generic.ListView):
+ """
+
+ """
model = Token
template_name = "sc/token/token_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tokens_all')
def get_queryset(self):
@@ -6170,6 +10249,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Token"
context["var_main_desc"] = "Talking about forms of money, tokens, unlike articles, are used only for exchange, and unlike coins, are not manufactured (example: cowries)"
@@ -6183,6 +10273,9 @@ def get_context_data(self, **kwargs):
return context
class TokenDetailView(generic.DetailView):
+ """
+
+ """
model = Token
template_name = "sc/token/token_detail.html"
@@ -6232,14 +10325,38 @@ def token_meta_download(request):
class Precious_metalCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Precious_metal
form_class = Precious_metalForm
template_name = "sc/precious_metal/precious_metal_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('precious_metal-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6253,18 +10370,41 @@ def get_context_data(self, **kwargs):
class Precious_metalUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Precious_metal
form_class = Precious_metalForm
template_name = "sc/precious_metal/precious_metal_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Precious Metal"
return context
class Precious_metalDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Precious_metal object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Precious_metal
success_url = reverse_lazy('precious_metals')
template_name = "core/delete_general.html"
@@ -6272,14 +10412,34 @@ class Precious_metalDelete(PermissionRequiredMixin, DeleteView):
class Precious_metalListView(generic.ListView):
+ """
+ Paginated view for listing all the Precious_metal objects.
+ """
model = Precious_metal
template_name = "sc/precious_metal/precious_metal_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('precious_metals')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Precious Metal"
context["var_main_desc"] = "Talking about forms of money, precious metals are non-coined silver, gold, platinum"
@@ -6293,10 +10453,19 @@ def get_context_data(self, **kwargs):
class Precious_metalListViewAll(generic.ListView):
+ """
+
+ """
model = Precious_metal
template_name = "sc/precious_metal/precious_metal_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('precious_metals_all')
def get_queryset(self):
@@ -6307,6 +10476,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Precious Metal"
context["var_main_desc"] = "Talking about forms of money, precious metals are non-coined silver, gold, platinum"
@@ -6320,6 +10500,9 @@ def get_context_data(self, **kwargs):
return context
class Precious_metalDetailView(generic.DetailView):
+ """
+
+ """
model = Precious_metal
template_name = "sc/precious_metal/precious_metal_detail.html"
@@ -6369,14 +10552,38 @@ def precious_metal_meta_download(request):
class Foreign_coinCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Foreign_coin
form_class = Foreign_coinForm
template_name = "sc/foreign_coin/foreign_coin_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('foreign_coin-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6390,18 +10597,41 @@ def get_context_data(self, **kwargs):
class Foreign_coinUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Foreign_coin
form_class = Foreign_coinForm
template_name = "sc/foreign_coin/foreign_coin_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Foreign Coin"
return context
class Foreign_coinDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Foreign_coin object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Foreign_coin
success_url = reverse_lazy('foreign_coins')
template_name = "core/delete_general.html"
@@ -6409,14 +10639,34 @@ class Foreign_coinDelete(PermissionRequiredMixin, DeleteView):
class Foreign_coinListView(generic.ListView):
+ """
+ Paginated view for listing all the Foreign_coin objects.
+ """
model = Foreign_coin
template_name = "sc/foreign_coin/foreign_coin_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('foreign_coins')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Foreign Coin"
context["var_main_desc"] = "NO Descriptions IN Codebook"
@@ -6430,10 +10680,19 @@ def get_context_data(self, **kwargs):
class Foreign_coinListViewAll(generic.ListView):
+ """
+
+ """
model = Foreign_coin
template_name = "sc/foreign_coin/foreign_coin_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('foreign_coins_all')
def get_queryset(self):
@@ -6444,6 +10703,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Foreign Coin"
context["var_main_desc"] = "NO Descriptions IN Codebook"
@@ -6457,6 +10727,9 @@ def get_context_data(self, **kwargs):
return context
class Foreign_coinDetailView(generic.DetailView):
+ """
+
+ """
model = Foreign_coin
template_name = "sc/foreign_coin/foreign_coin_detail.html"
@@ -6506,14 +10779,38 @@ def foreign_coin_meta_download(request):
class Indigenous_coinCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Indigenous_coin
form_class = Indigenous_coinForm
template_name = "sc/indigenous_coin/indigenous_coin_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('indigenous_coin-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6527,18 +10824,41 @@ def get_context_data(self, **kwargs):
class Indigenous_coinUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Indigenous_coin
form_class = Indigenous_coinForm
template_name = "sc/indigenous_coin/indigenous_coin_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Indigenous Coin"
return context
class Indigenous_coinDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Indigenous_coin object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Indigenous_coin
success_url = reverse_lazy('indigenous_coins')
template_name = "core/delete_general.html"
@@ -6546,14 +10866,34 @@ class Indigenous_coinDelete(PermissionRequiredMixin, DeleteView):
class Indigenous_coinListView(generic.ListView):
+ """
+ Paginated view for listing all the Indigenous_coin objects.
+ """
model = Indigenous_coin
template_name = "sc/indigenous_coin/indigenous_coin_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('indigenous_coins')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Indigenous Coin"
context["var_main_desc"] = "NO Descriptions IN Codebook"
@@ -6567,10 +10907,19 @@ def get_context_data(self, **kwargs):
class Indigenous_coinListViewAll(generic.ListView):
+ """
+
+ """
model = Indigenous_coin
template_name = "sc/indigenous_coin/indigenous_coin_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('indigenous_coins_all')
def get_queryset(self):
@@ -6581,6 +10930,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Indigenous Coin"
context["var_main_desc"] = "NO Descriptions IN Codebook"
@@ -6594,6 +10954,9 @@ def get_context_data(self, **kwargs):
return context
class Indigenous_coinDetailView(generic.DetailView):
+ """
+
+ """
model = Indigenous_coin
template_name = "sc/indigenous_coin/indigenous_coin_detail.html"
@@ -6644,14 +11007,38 @@ def indigenous_coin_meta_download(request):
class Paper_currencyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Paper_currency
form_class = Paper_currencyForm
template_name = "sc/paper_currency/paper_currency_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('paper_currency-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6665,18 +11052,41 @@ def get_context_data(self, **kwargs):
class Paper_currencyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Paper_currency
form_class = Paper_currencyForm
template_name = "sc/paper_currency/paper_currency_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Paper Currency"
return context
class Paper_currencyDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Paper_currency object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Paper_currency
success_url = reverse_lazy('paper_currencys')
template_name = "core/delete_general.html"
@@ -6684,14 +11094,34 @@ class Paper_currencyDelete(PermissionRequiredMixin, DeleteView):
class Paper_currencyListView(generic.ListView):
+ """
+ Paginated view for listing all the Paper_currency objects.
+ """
model = Paper_currency
template_name = "sc/paper_currency/paper_currency_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('paper_currencys')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Paper Currency"
context["var_main_desc"] = "Paper currency or another kind of fiat money. note that this only refers to indigenously produced paper currency. code absent if colonial money is used."
@@ -6705,10 +11135,19 @@ def get_context_data(self, **kwargs):
class Paper_currencyListViewAll(generic.ListView):
+ """
+
+ """
model = Paper_currency
template_name = "sc/paper_currency/paper_currency_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('paper_currencys_all')
def get_queryset(self):
@@ -6719,6 +11158,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Paper Currency"
context["var_main_desc"] = "Paper currency or another kind of fiat money. note that this only refers to indigenously produced paper currency. code absent if colonial money is used."
@@ -6732,6 +11182,9 @@ def get_context_data(self, **kwargs):
return context
class Paper_currencyDetailView(generic.DetailView):
+ """
+
+ """
model = Paper_currency
template_name = "sc/paper_currency/paper_currency_detail.html"
@@ -6781,14 +11234,38 @@ def paper_currency_meta_download(request):
class CourierCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Courier
form_class = CourierForm
template_name = "sc/courier/courier_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('courier-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6802,6 +11279,12 @@ def get_context_data(self, **kwargs):
class CourierUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Courier
form_class = CourierForm
template_name = "sc/courier/courier_update.html"
@@ -6814,6 +11297,12 @@ def get_context_data(self, **kwargs):
return context
class CourierDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Courier object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Courier
success_url = reverse_lazy('couriers')
template_name = "core/delete_general.html"
@@ -6821,14 +11310,34 @@ class CourierDelete(PermissionRequiredMixin, DeleteView):
class CourierListView(generic.ListView):
+ """
+ Paginated view for listing all the Courier objects.
+ """
model = Courier
template_name = "sc/courier/courier_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('couriers')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Courier"
context["var_main_desc"] = "Full-time professional couriers."
@@ -6842,10 +11351,19 @@ def get_context_data(self, **kwargs):
class CourierListViewAll(generic.ListView):
+ """
+
+ """
model = Courier
template_name = "sc/courier/courier_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('couriers_all')
def get_queryset(self):
@@ -6856,6 +11374,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Courier"
context["var_main_desc"] = "Full-time professional couriers."
@@ -6869,6 +11398,9 @@ def get_context_data(self, **kwargs):
return context
class CourierDetailView(generic.DetailView):
+ """
+
+ """
model = Courier
template_name = "sc/courier/courier_detail.html"
@@ -6918,14 +11450,38 @@ def courier_meta_download(request):
class Postal_stationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Postal_station
form_class = Postal_stationForm
template_name = "sc/postal_station/postal_station_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('postal_station-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -6939,18 +11495,41 @@ def get_context_data(self, **kwargs):
class Postal_stationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Postal_station
form_class = Postal_stationForm
template_name = "sc/postal_station/postal_station_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Postal Station"
return context
class Postal_stationDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing Postal_station object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Postal_station
success_url = reverse_lazy('postal_stations')
template_name = "core/delete_general.html"
@@ -6958,14 +11537,34 @@ class Postal_stationDelete(PermissionRequiredMixin, DeleteView):
class Postal_stationListView(generic.ListView):
+ """
+ Paginated view for listing all the Postal_station objects.
+ """
model = Postal_station
template_name = "sc/postal_station/postal_station_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('postal_stations')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Postal Station"
context["var_main_desc"] = "Talking about postal sytems, postal stations are specialized buildings exclusively devoted to the postal service. if there is a special building that has other functions than a postal station, we still code postal station as present. the intent is to capture additional infrastructure beyond having a corps of messengers."
@@ -6979,10 +11578,19 @@ def get_context_data(self, **kwargs):
class Postal_stationListViewAll(generic.ListView):
+ """
+
+ """
model = Postal_station
template_name = "sc/postal_station/postal_station_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('postal_stations_all')
def get_queryset(self):
@@ -6993,6 +11601,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "Postal Station"
context["var_main_desc"] = "Talking about postal sytems, postal stations are specialized buildings exclusively devoted to the postal service. if there is a special building that has other functions than a postal station, we still code postal station as present. the intent is to capture additional infrastructure beyond having a corps of messengers."
@@ -7006,6 +11625,9 @@ def get_context_data(self, **kwargs):
return context
class Postal_stationDetailView(generic.DetailView):
+ """
+
+ """
model = Postal_station
template_name = "sc/postal_station/postal_station_detail.html"
@@ -7055,14 +11677,38 @@ def postal_station_meta_download(request):
class General_postal_serviceCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = General_postal_service
form_class = General_postal_serviceForm
template_name = "sc/general_postal_service/general_postal_service_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('general_postal_service-create')
+
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
# get the explanattion:
context["mysection"] = "General Variables"
@@ -7076,18 +11722,41 @@ def get_context_data(self, **kwargs):
class General_postal_serviceUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = General_postal_service
form_class = General_postal_serviceForm
template_name = "sc/general_postal_service/general_postal_service_update.html"
permission_required = 'core.add_capital'
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "General Postal Service"
return context
class General_postal_serviceDelete(PermissionRequiredMixin, DeleteView):
+ """
+ View for deleting an existing General_postal_service object.
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = General_postal_service
success_url = reverse_lazy('general_postal_services')
template_name = "core/delete_general.html"
@@ -7095,14 +11764,34 @@ class General_postal_serviceDelete(PermissionRequiredMixin, DeleteView):
class General_postal_serviceListView(generic.ListView):
+ """
+ Paginated view for listing all the General_postal_service objects.
+ """
model = General_postal_service
template_name = "sc/general_postal_service/general_postal_service_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('general_postal_services')
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "General Postal Service"
context["var_main_desc"] = "Talking about postal sytems, 'general postal service' refers to a postal service that not only serves the ruler's needs, but carries mail for private citizens."
@@ -7116,10 +11805,19 @@ def get_context_data(self, **kwargs):
class General_postal_serviceListViewAll(generic.ListView):
+ """
+
+ """
model = General_postal_service
template_name = "sc/general_postal_service/general_postal_service_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('general_postal_services_all')
def get_queryset(self):
@@ -7130,6 +11828,17 @@ def get_queryset(self):
return new_context
def get_context_data(self, **kwargs):
+ """
+ Get the context data of the view.
+
+ :noindex:
+
+ Args:
+ **kwargs: Arbitrary keyword arguments.
+
+ Returns:
+ dict: The context data of the view.
+ """
context = super().get_context_data(**kwargs)
context["myvar"] = "General Postal Service"
context["var_main_desc"] = "Talking about postal sytems, 'general postal service' refers to a postal service that not only serves the ruler's needs, but carries mail for private citizens."
@@ -7143,6 +11852,9 @@ def get_context_data(self, **kwargs):
return context
class General_postal_serviceDetailView(generic.DetailView):
+ """
+
+ """
model = General_postal_service
template_name = "sc/general_postal_service/general_postal_service_detail.html"
diff --git a/seshat/apps/seshat_api/models.py b/seshat/apps/seshat_api/models.py
index 4ea35ad63..d886d3c57 100644
--- a/seshat/apps/seshat_api/models.py
+++ b/seshat/apps/seshat_api/models.py
@@ -2,11 +2,33 @@
class Album(models.Model):
+ """
+ :private:
+ :noindex:
+
+ Note:
+ TODO
+
+ This model is used to store information about an album.
+
+ It does not seem to belong to the codebase. Remove it?
+ """
album_name = models.CharField(max_length=100)
artist = models.CharField(max_length=100)
class Track(models.Model):
+ """
+ :private:
+ :noindex:
+
+ Note:
+ TODO
+
+ This model is used to store information about tracks in an album.
+
+ It does not seem to belong to the codebase. Remove it?
+ """
album = models.ForeignKey(
Album, related_name='tracks', on_delete=models.CASCADE)
order = models.IntegerField()
@@ -14,6 +36,9 @@ class Track(models.Model):
duration = models.IntegerField()
class Meta:
+ """
+ :noindex:
+ """
unique_together = ['album', 'order']
ordering = ['order']
diff --git a/seshat/apps/seshat_api/serializers.py b/seshat/apps/seshat_api/serializers.py
index 96e83d765..3e814ddab 100644
--- a/seshat/apps/seshat_api/serializers.py
+++ b/seshat/apps/seshat_api/serializers.py
@@ -10,17 +10,35 @@
################ Beginning of Base Serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
+ """
+ The base serializer for the User model. It is used to serialize the User model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = User
fields = ['url', 'username', 'email', 'groups']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
+ """
+ The base serializer for the Group model. It is used to serialize the Group model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Group
fields = ['url', 'name']
class ReferenceSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Reference model. It is used to serialize the Reference model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Reference
fields = ['id', 'title', 'year', 'creator', 'zotero_link', 'long_name']
@@ -28,134 +46,266 @@ class Meta:
################ Beginning of Serializers Imports
class Human_sacrificeSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Human_sacrifice model. It is used to serialize the Human_sacrifice model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Human_sacrifice
fields = ['year_from', 'year_to', 'human_sacrifice', 'tag']
class External_conflictSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the External_conflict model. It is used to serialize the External_conflict model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = External_conflict
fields = ['year_from', 'year_to', 'conflict_name', 'tag']
class Internal_conflictSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Internal_conflict model. It is used to serialize the Internal_conflict model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Internal_conflict
fields = ['year_from', 'year_to', 'conflict', 'expenditure', 'leader', 'casualty', 'tag']
class External_conflict_sideSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the External_conflict_side model. It is used to serialize the External_conflict_side model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = External_conflict_side
fields = ['year_from', 'year_to', 'conflict_id', 'expenditure', 'leader', 'casualty', 'tag']
class Agricultural_populationSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Agricultural_population model. It is used to serialize the Agricultural_population model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Agricultural_population
fields = ['year_from', 'year_to', 'agricultural_population', 'tag']
class Arable_landSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Arable_land model. It is used to serialize the Arable_land model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Arable_land
fields = ['year_from', 'year_to', 'arable_land', 'tag']
class Arable_land_per_farmerSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Arable_land_per_farmer model. It is used to serialize the Arable_land_per_farmer model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Arable_land_per_farmer
fields = ['year_from', 'year_to', 'arable_land_per_farmer', 'tag']
class Gross_grain_shared_per_agricultural_populationSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Gross_grain_shared_per_agricultural_population model. It is used to serialize the Gross_grain_shared_per_agricultural_population model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gross_grain_shared_per_agricultural_population
fields = ['year_from', 'year_to', 'gross_grain_shared_per_agricultural_population', 'tag']
class Net_grain_shared_per_agricultural_populationSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Net_grain_shared_per_agricultural_population model. It is used to serialize the Net_grain_shared_per_agricultural_population model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Net_grain_shared_per_agricultural_population
fields = ['year_from', 'year_to', 'net_grain_shared_per_agricultural_population', 'tag']
class SurplusSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Surplus model. It is used to serialize the Surplus model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Surplus
fields = ['year_from', 'year_to', 'surplus', 'tag']
class Military_expenseSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Military_expense model. It is used to serialize the Military_expense model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Military_expense
fields = ['year_from', 'year_to', 'conflict', 'expenditure', 'tag']
class Silver_inflowSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Silver_inflow model. It is used to serialize the Silver_inflow model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Silver_inflow
fields = ['year_from', 'year_to', 'silver_inflow', 'tag']
class Silver_stockSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Silver_stock model. It is used to serialize the Silver_stock model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Silver_stock
fields = ['year_from', 'year_to', 'silver_stock', 'tag']
class Total_populationSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Total_population model. It is used to serialize the Total_population model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Total_population
fields = ['year_from', 'year_to', 'total_population', 'tag']
class Gdp_per_capitaSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Gdp_per_capita model. It is used to serialize the Gdp_per_capita model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gdp_per_capita
fields = ['year_from', 'year_to', 'gdp_per_capita', 'tag']
class Drought_eventSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Drought_event model. It is used to serialize the Drought_event model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Drought_event
fields = ['year_from', 'year_to', 'drought_event', 'tag']
class Locust_eventSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Locust_event model. It is used to serialize the Locust_event model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Locust_event
fields = ['year_from', 'year_to', 'locust_event', 'tag']
class Socioeconomic_turmoil_eventSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Socioeconomic_turmoil_event model. It is used to serialize the Socioeconomic_turmoil_event model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Socioeconomic_turmoil_event
fields = ['year_from', 'year_to', 'socioeconomic_turmoil_event', 'tag']
class Crop_failure_eventSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Crop_failure_event model. It is used to serialize the Crop_failure_event model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Crop_failure_event
fields = ['year_from', 'year_to', 'crop_failure_event', 'tag']
class Famine_eventSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Famine_event model. It is used to serialize the Famine_event model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Famine_event
fields = ['year_from', 'year_to', 'famine_event', 'tag']
class Disease_outbreakSerializer(serializers.ModelSerializer):
+ """
+ The base serializer for the Disease_outbreak model. It is used to serialize the Disease_outbreak model and return the serialized data in the API response.
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Disease_outbreak
fields = ['year_from', 'year_to', 'longitude', 'latitude', 'elevation', 'sub_category', 'magnitude', 'duration', 'tag']
class PolitySerializer(serializers.ModelSerializer):
- crisisdb_human_sacrifice_related = Human_sacrificeSerializer(many=True, read_only=True)
- crisisdb_external_conflict_related = External_conflictSerializer(many=True, read_only=True)
- crisisdb_internal_conflict_related = Internal_conflictSerializer(many=True, read_only=True)
- crisisdb_external_conflict_side_related = External_conflict_sideSerializer(many=True, read_only=True)
- crisisdb_agricultural_population_related = Agricultural_populationSerializer(many=True, read_only=True)
- crisisdb_arable_land_related = Arable_landSerializer(many=True, read_only=True)
- crisisdb_arable_land_per_farmer_related = Arable_land_per_farmerSerializer(many=True, read_only=True)
- crisisdb_gross_grain_shared_per_agricultural_population_related = Gross_grain_shared_per_agricultural_populationSerializer(many=True, read_only=True)
- crisisdb_net_grain_shared_per_agricultural_population_related = Net_grain_shared_per_agricultural_populationSerializer(many=True, read_only=True)
- crisisdb_surplus_related = SurplusSerializer(many=True, read_only=True)
- crisisdb_military_expense_related = Military_expenseSerializer(many=True, read_only=True)
- crisisdb_silver_inflow_related = Silver_inflowSerializer(many=True, read_only=True)
- crisisdb_silver_stock_related = Silver_stockSerializer(many=True, read_only=True)
- crisisdb_total_population_related = Total_populationSerializer(many=True, read_only=True)
- crisisdb_gdp_per_capita_related = Gdp_per_capitaSerializer(many=True, read_only=True)
- crisisdb_drought_event_related = Drought_eventSerializer(many=True, read_only=True)
- crisisdb_locust_event_related = Locust_eventSerializer(many=True, read_only=True)
- crisisdb_socioeconomic_turmoil_event_related = Socioeconomic_turmoil_eventSerializer(many=True, read_only=True)
- crisisdb_crop_failure_event_related = Crop_failure_eventSerializer(many=True, read_only=True)
- crisisdb_famine_event_related = Famine_eventSerializer(many=True, read_only=True)
- crisisdb_disease_outbreak_related = Disease_outbreakSerializer(many=True, read_only=True)
-
- class Meta:
- model = Polity
- fields = ['id', 'name', 'start_year', 'end_year', 'crisisdb_human_sacrifice_related', 'crisisdb_external_conflict_related', 'crisisdb_internal_conflict_related', 'crisisdb_external_conflict_side_related', 'crisisdb_agricultural_population_related', 'crisisdb_arable_land_related', 'crisisdb_arable_land_per_farmer_related', 'crisisdb_gross_grain_shared_per_agricultural_population_related', 'crisisdb_net_grain_shared_per_agricultural_population_related', 'crisisdb_surplus_related', 'crisisdb_military_expense_related', 'crisisdb_silver_inflow_related', 'crisisdb_silver_stock_related', 'crisisdb_total_population_related', 'crisisdb_gdp_per_capita_related', 'crisisdb_drought_event_related', 'crisisdb_locust_event_related', 'crisisdb_socioeconomic_turmoil_event_related', 'crisisdb_crop_failure_event_related', 'crisisdb_famine_event_related', 'crisisdb_disease_outbreak_related']
-
+ """
+ The base serializer for the Polity model. It is used to serialize the Polity model and return the serialized data in the API response.
+ """
+ crisisdb_human_sacrifice_related = Human_sacrificeSerializer(many=True, read_only=True)
+ crisisdb_external_conflict_related = External_conflictSerializer(many=True, read_only=True)
+ crisisdb_internal_conflict_related = Internal_conflictSerializer(many=True, read_only=True)
+ crisisdb_external_conflict_side_related = External_conflict_sideSerializer(many=True, read_only=True)
+ crisisdb_agricultural_population_related = Agricultural_populationSerializer(many=True, read_only=True)
+ crisisdb_arable_land_related = Arable_landSerializer(many=True, read_only=True)
+ crisisdb_arable_land_per_farmer_related = Arable_land_per_farmerSerializer(many=True, read_only=True)
+ crisisdb_gross_grain_shared_per_agricultural_population_related = Gross_grain_shared_per_agricultural_populationSerializer(many=True, read_only=True)
+ crisisdb_net_grain_shared_per_agricultural_population_related = Net_grain_shared_per_agricultural_populationSerializer(many=True, read_only=True)
+ crisisdb_surplus_related = SurplusSerializer(many=True, read_only=True)
+ crisisdb_military_expense_related = Military_expenseSerializer(many=True, read_only=True)
+ crisisdb_silver_inflow_related = Silver_inflowSerializer(many=True, read_only=True)
+ crisisdb_silver_stock_related = Silver_stockSerializer(many=True, read_only=True)
+ crisisdb_total_population_related = Total_populationSerializer(many=True, read_only=True)
+ crisisdb_gdp_per_capita_related = Gdp_per_capitaSerializer(many=True, read_only=True)
+ crisisdb_drought_event_related = Drought_eventSerializer(many=True, read_only=True)
+ crisisdb_locust_event_related = Locust_eventSerializer(many=True, read_only=True)
+ crisisdb_socioeconomic_turmoil_event_related = Socioeconomic_turmoil_eventSerializer(many=True, read_only=True)
+ crisisdb_crop_failure_event_related = Crop_failure_eventSerializer(many=True, read_only=True)
+ crisisdb_famine_event_related = Famine_eventSerializer(many=True, read_only=True)
+ crisisdb_disease_outbreak_related = Disease_outbreakSerializer(many=True, read_only=True)
+
+ class Meta:
+ """
+ :noindex:
+ """
+ model = Polity
+ fields = ['id', 'name', 'start_year', 'end_year', 'crisisdb_human_sacrifice_related', 'crisisdb_external_conflict_related', 'crisisdb_internal_conflict_related', 'crisisdb_external_conflict_side_related', 'crisisdb_agricultural_population_related', 'crisisdb_arable_land_related', 'crisisdb_arable_land_per_farmer_related', 'crisisdb_gross_grain_shared_per_agricultural_population_related', 'crisisdb_net_grain_shared_per_agricultural_population_related', 'crisisdb_surplus_related', 'crisisdb_military_expense_related', 'crisisdb_silver_inflow_related', 'crisisdb_silver_stock_related', 'crisisdb_total_population_related', 'crisisdb_gdp_per_capita_related', 'crisisdb_drought_event_related', 'crisisdb_locust_event_related', 'crisisdb_socioeconomic_turmoil_event_related', 'crisisdb_crop_failure_event_related', 'crisisdb_famine_event_related', 'crisisdb_disease_outbreak_related']
+
################ End of Serializers Imports
diff --git a/seshat/apps/seshat_api/tests.py b/seshat/apps/seshat_api/tests.py
index 7ce503c2d..e69de29bb 100644
--- a/seshat/apps/seshat_api/tests.py
+++ b/seshat/apps/seshat_api/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/seshat_api/views.py b/seshat/apps/seshat_api/views.py
index 6fae45490..6867fefcc 100644
--- a/seshat/apps/seshat_api/views.py
+++ b/seshat/apps/seshat_api/views.py
@@ -15,7 +15,7 @@
from .models import Album, Track
#from .serializers import PolitySerializer
-# Create your views here.
+
class UserViewSet(viewsets.ModelViewSet):
diff --git a/seshat/apps/wf/forms.py b/seshat/apps/wf/forms.py
index 3dac719b5..3f61f1edd 100644
--- a/seshat/apps/wf/forms.py
+++ b/seshat/apps/wf/forms.py
@@ -42,7 +42,13 @@
}
class Long_wallForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Long_wall
fields = commonfields.copy()
fields.append('long_wall_from')
@@ -55,7 +61,13 @@ class Meta:
class CopperForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Copper
fields = commonfields.copy()
fields.append('copper')
@@ -66,7 +78,13 @@ class Meta:
class BronzeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Bronze
fields = commonfields.copy()
fields.append('bronze')
@@ -77,7 +95,13 @@ class Meta:
class IronForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Iron
fields = commonfields.copy()
fields.append('iron')
@@ -88,7 +112,13 @@ class Meta:
class SteelForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Steel
fields = commonfields.copy()
fields.append('steel')
@@ -99,7 +129,13 @@ class Meta:
class JavelinForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Javelin
fields = commonfields.copy()
fields.append('javelin')
@@ -110,7 +146,13 @@ class Meta:
class AtlatlForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Atlatl
fields = commonfields.copy()
fields.append('atlatl')
@@ -121,7 +163,13 @@ class Meta:
class SlingForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Sling
fields = commonfields.copy()
fields.append('sling')
@@ -132,7 +180,13 @@ class Meta:
class Self_bowForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Self_bow
fields = commonfields.copy()
fields.append('self_bow')
@@ -143,7 +197,13 @@ class Meta:
class Composite_bowForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Composite_bow
fields = commonfields.copy()
fields.append('composite_bow')
@@ -154,7 +214,13 @@ class Meta:
class CrossbowForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Crossbow
fields = commonfields.copy()
fields.append('crossbow')
@@ -165,7 +231,13 @@ class Meta:
class Tension_siege_engineForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Tension_siege_engine
fields = commonfields.copy()
fields.append('tension_siege_engine')
@@ -176,7 +248,13 @@ class Meta:
class Sling_siege_engineForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Sling_siege_engine
fields = commonfields.copy()
fields.append('sling_siege_engine')
@@ -187,7 +265,13 @@ class Meta:
class Gunpowder_siege_artilleryForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Gunpowder_siege_artillery
fields = commonfields.copy()
fields.append('gunpowder_siege_artillery')
@@ -198,7 +282,13 @@ class Meta:
class Handheld_firearmForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Handheld_firearm
fields = commonfields.copy()
fields.append('handheld_firearm')
@@ -209,7 +299,13 @@ class Meta:
class War_clubForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = War_club
fields = commonfields.copy()
fields.append('war_club')
@@ -220,7 +316,13 @@ class Meta:
class Battle_axeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Battle_axe
fields = commonfields.copy()
fields.append('battle_axe')
@@ -231,7 +333,13 @@ class Meta:
class DaggerForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Dagger
fields = commonfields.copy()
fields.append('dagger')
@@ -242,7 +350,13 @@ class Meta:
class SwordForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Sword
fields = commonfields.copy()
fields.append('sword')
@@ -253,7 +367,13 @@ class Meta:
class SpearForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Spear
fields = commonfields.copy()
fields.append('spear')
@@ -264,7 +384,13 @@ class Meta:
class PolearmForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Polearm
fields = commonfields.copy()
fields.append('polearm')
@@ -275,7 +401,13 @@ class Meta:
class DogForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Dog
fields = commonfields.copy()
fields.append('dog')
@@ -286,7 +418,13 @@ class Meta:
class DonkeyForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Donkey
fields = commonfields.copy()
fields.append('donkey')
@@ -297,7 +435,13 @@ class Meta:
class HorseForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Horse
fields = commonfields.copy()
fields.append('horse')
@@ -308,7 +452,13 @@ class Meta:
class CamelForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Camel
fields = commonfields.copy()
fields.append('camel')
@@ -319,7 +469,13 @@ class Meta:
class ElephantForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Elephant
fields = commonfields.copy()
fields.append('elephant')
@@ -330,7 +486,13 @@ class Meta:
class Wood_bark_etcForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Wood_bark_etc
fields = commonfields.copy()
fields.append('wood_bark_etc')
@@ -341,7 +503,13 @@ class Meta:
class Leather_clothForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Leather_cloth
fields = commonfields.copy()
fields.append('leather_cloth')
@@ -352,7 +520,13 @@ class Meta:
class ShieldForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Shield
fields = commonfields.copy()
fields.append('shield')
@@ -363,7 +537,13 @@ class Meta:
class HelmetForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Helmet
fields = commonfields.copy()
fields.append('helmet')
@@ -374,7 +554,13 @@ class Meta:
class BreastplateForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Breastplate
fields = commonfields.copy()
fields.append('breastplate')
@@ -385,7 +571,13 @@ class Meta:
class Limb_protectionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Limb_protection
fields = commonfields.copy()
fields.append('limb_protection')
@@ -396,7 +588,13 @@ class Meta:
class Scaled_armorForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Scaled_armor
fields = commonfields.copy()
fields.append('scaled_armor')
@@ -407,7 +605,13 @@ class Meta:
class Laminar_armorForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Laminar_armor
fields = commonfields.copy()
fields.append('laminar_armor')
@@ -418,7 +622,13 @@ class Meta:
class Plate_armorForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Plate_armor
fields = commonfields.copy()
fields.append('plate_armor')
@@ -429,7 +639,13 @@ class Meta:
class Small_vessels_canoes_etcForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Small_vessels_canoes_etc
fields = commonfields.copy()
fields.append('small_vessels_canoes_etc')
@@ -440,7 +656,13 @@ class Meta:
class Merchant_ships_pressed_into_serviceForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Merchant_ships_pressed_into_service
fields = commonfields.copy()
fields.append('merchant_ships_pressed_into_service')
@@ -451,7 +673,13 @@ class Meta:
class Specialized_military_vesselForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Specialized_military_vessel
fields = commonfields.copy()
fields.append('specialized_military_vessel')
@@ -462,7 +690,13 @@ class Meta:
class Settlements_in_a_defensive_positionForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Settlements_in_a_defensive_position
fields = commonfields.copy()
fields.append('settlements_in_a_defensive_position')
@@ -473,7 +707,13 @@ class Meta:
class Wooden_palisadeForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Wooden_palisade
fields = commonfields.copy()
fields.append('wooden_palisade')
@@ -484,7 +724,13 @@ class Meta:
class Earth_rampartForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Earth_rampart
fields = commonfields.copy()
fields.append('earth_rampart')
@@ -495,7 +741,13 @@ class Meta:
class DitchForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Ditch
fields = commonfields.copy()
fields.append('ditch')
@@ -506,7 +758,13 @@ class Meta:
class MoatForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Moat
fields = commonfields.copy()
fields.append('moat')
@@ -517,7 +775,13 @@ class Meta:
class Stone_walls_non_mortaredForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Stone_walls_non_mortared
fields = commonfields.copy()
fields.append('stone_walls_non_mortared')
@@ -528,7 +792,13 @@ class Meta:
class Stone_walls_mortaredForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Stone_walls_mortared
fields = commonfields.copy()
fields.append('stone_walls_mortared')
@@ -539,7 +809,13 @@ class Meta:
class Fortified_campForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Fortified_camp
fields = commonfields.copy()
fields.append('fortified_camp')
@@ -550,7 +826,13 @@ class Meta:
class Complex_fortificationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Complex_fortification
fields = commonfields.copy()
fields.append('complex_fortification')
@@ -561,7 +843,13 @@ class Meta:
class Modern_fortificationForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Modern_fortification
fields = commonfields.copy()
fields.append('modern_fortification')
@@ -572,7 +860,13 @@ class Meta:
class ChainmailForm(forms.ModelForm):
+ """
+
+ """
class Meta:
+ """
+ :noindex:
+ """
model = Chainmail
fields = commonfields.copy()
fields.append('chainmail')
diff --git a/seshat/apps/wf/models.py b/seshat/apps/wf/models.py
index 0a660dc54..31de79129 100644
--- a/seshat/apps/wf/models.py
+++ b/seshat/apps/wf/models.py
@@ -39,6 +39,23 @@
########## Beginning of Function Definitions for Social Complexity (Vars) Models
def call_my_name(self):
+ """
+ This function is used to return the name of the model instance (in lieu of
+ the __str__ representation of the model instance).
+
+ Note:
+ The model instance must have the following attributes:
+ - name
+ - polity (and polity.name)
+ - year_from
+ - year_to
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The name of the model instance.
+ """
if self.year_from == self.year_to or ((not self.year_to) and self.year_from):
return self.name + " [for " + self.polity.name + " in " + str(self.year_from) + "]"
else:
@@ -46,10 +63,51 @@ def call_my_name(self):
def return_citations(self):
+ """
+ This function is used to return the citations of the model instance
+ (returning the value used in the display_citations method of the model
+ instance).
+
+ Note:
+ The model instance must have the following attribute:
+ - citations
+
+ The model instance must have the following methods:
+ - zoteroer
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return ', '.join(['' + citation.__str__() + ' ' for citation in self.citations.all()[:2]])
def clean_times(self):
+ """
+ This function is used to validate the year_from and year_to fields of the
+ model instance (called from each model's clean method).
+
+ Note:
+ The model instance must have the following attributes:
+ - year_from
+ - year_to
+ - polity (and polity.start_year and polity.end_year)
+
+ Args:
+ self (model instance): The model instance.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
if (self.year_from and self.year_to) and self.year_from > self.year_to:
raise ValidationError({
'year_from': mark_safe(' The start year is bigger than the end year!'),
@@ -92,18 +150,63 @@ class Long_wall(SeshatCommon):
long_wall_to = models.IntegerField(blank=True, null=True)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'long_wall'
verbose_name_plural = 'Long walls'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "long_wall"
def clean_name_spaced(self):
@@ -144,6 +247,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('long_wall-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -154,18 +265,63 @@ class Copper(SeshatCommon):
copper = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Copper'
verbose_name_plural = 'Coppers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "copper"
def clean_name_spaced(self):
@@ -191,6 +347,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('copper-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -202,18 +366,63 @@ class Bronze(SeshatCommon):
bronze = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Bronze'
verbose_name_plural = 'Bronzes'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "bronze"
def clean_name_spaced(self):
@@ -239,6 +448,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('bronze-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -250,18 +467,63 @@ class Iron(SeshatCommon):
iron = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Iron'
verbose_name_plural = 'Irons'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "iron"
def clean_name_spaced(self):
@@ -287,6 +549,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('iron-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -298,18 +568,63 @@ class Steel(SeshatCommon):
steel = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Steel'
verbose_name_plural = 'Steels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "steel"
def clean_name_spaced(self):
@@ -335,6 +650,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('steel-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -346,18 +669,63 @@ class Javelin(SeshatCommon):
javelin = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Javelin'
verbose_name_plural = 'Javelins'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "javelin"
def clean_name_spaced(self):
@@ -383,6 +751,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('javelin-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -394,18 +770,63 @@ class Atlatl(SeshatCommon):
atlatl = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Atlatl'
verbose_name_plural = 'Atlatls'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "atlatl"
def clean_name_spaced(self):
@@ -431,6 +852,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('atlatl-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -442,18 +871,63 @@ class Sling(SeshatCommon):
sling = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Sling'
verbose_name_plural = 'Slings'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "sling"
def clean_name_spaced(self):
@@ -479,6 +953,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('sling-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -490,18 +972,63 @@ class Self_bow(SeshatCommon):
self_bow = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Self_bow'
verbose_name_plural = 'Self_bows'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "self_bow"
def clean_name_spaced(self):
@@ -527,6 +1054,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('self_bow-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -538,18 +1073,63 @@ class Composite_bow(SeshatCommon):
composite_bow = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Composite_bow'
verbose_name_plural = 'Composite_bows'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "composite_bow"
def clean_name_spaced(self):
@@ -575,6 +1155,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('composite_bow-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -586,18 +1174,63 @@ class Crossbow(SeshatCommon):
crossbow = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Crossbow'
verbose_name_plural = 'Crossbows'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "crossbow"
def clean_name_spaced(self):
@@ -623,6 +1256,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('crossbow-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -634,18 +1275,63 @@ class Tension_siege_engine(SeshatCommon):
tension_siege_engine = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Tension_siege_engine'
verbose_name_plural = 'Tension_siege_engines'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "tension_siege_engine"
def clean_name_spaced(self):
@@ -671,6 +1357,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('tension_siege_engine-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -682,18 +1376,63 @@ class Sling_siege_engine(SeshatCommon):
sling_siege_engine = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Sling_siege_engine'
verbose_name_plural = 'Sling_siege_engines'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "sling_siege_engine"
def clean_name_spaced(self):
@@ -719,6 +1458,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('sling_siege_engine-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -730,18 +1477,63 @@ class Gunpowder_siege_artillery(SeshatCommon):
gunpowder_siege_artillery = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Gunpowder_siege_artillery'
verbose_name_plural = 'Gunpowder_siege_artilleries'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "gunpowder_siege_artillery"
def clean_name_spaced(self):
@@ -767,6 +1559,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('gunpowder_siege_artillery-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -778,18 +1578,63 @@ class Handheld_firearm(SeshatCommon):
handheld_firearm = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Handheld_firearm'
verbose_name_plural = 'Handheld_firearms'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "handheld_firearm"
def clean_name_spaced(self):
@@ -815,6 +1660,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('handheld_firearm-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -826,18 +1679,63 @@ class War_club(SeshatCommon):
war_club = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'War_club'
verbose_name_plural = 'War_clubs'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "war_club"
def clean_name_spaced(self):
@@ -863,6 +1761,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('war_club-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -874,18 +1780,63 @@ class Battle_axe(SeshatCommon):
battle_axe = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Battle_axe'
verbose_name_plural = 'Battle_axes'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "battle_axe"
def clean_name_spaced(self):
@@ -911,6 +1862,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('battle_axe-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -922,18 +1881,63 @@ class Dagger(SeshatCommon):
dagger = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Dagger'
verbose_name_plural = 'Daggers'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "dagger"
def clean_name_spaced(self):
@@ -959,6 +1963,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('dagger-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -970,18 +1982,63 @@ class Sword(SeshatCommon):
sword = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Sword'
verbose_name_plural = 'Swords'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "sword"
def clean_name_spaced(self):
@@ -1007,6 +2064,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('sword-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1018,18 +2083,63 @@ class Spear(SeshatCommon):
spear = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Spear'
verbose_name_plural = 'Spears'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "spear"
def clean_name_spaced(self):
@@ -1055,6 +2165,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('spear-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1066,18 +2184,63 @@ class Polearm(SeshatCommon):
polearm = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Polearm'
verbose_name_plural = 'Polearms'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "polearm"
def clean_name_spaced(self):
@@ -1103,6 +2266,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('polearm-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1114,18 +2285,63 @@ class Dog(SeshatCommon):
dog = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Dog'
verbose_name_plural = 'Dogs'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "dog"
def clean_name_spaced(self):
@@ -1151,6 +2367,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('dog-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1162,18 +2386,63 @@ class Donkey(SeshatCommon):
donkey = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Donkey'
verbose_name_plural = 'Donkeies'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "donkey"
def clean_name_spaced(self):
@@ -1199,6 +2468,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('donkey-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1210,18 +2487,63 @@ class Horse(SeshatCommon):
horse = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Horse'
verbose_name_plural = 'Horses'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "horse"
def clean_name_spaced(self):
@@ -1247,6 +2569,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('horse-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1258,18 +2588,63 @@ class Camel(SeshatCommon):
camel = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Camel'
verbose_name_plural = 'Camels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "camel"
def clean_name_spaced(self):
@@ -1295,6 +2670,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('camel-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1306,18 +2689,63 @@ class Elephant(SeshatCommon):
elephant = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Elephant'
verbose_name_plural = 'Elephants'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "elephant"
def clean_name_spaced(self):
@@ -1343,6 +2771,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('elephant-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1354,18 +2790,63 @@ class Wood_bark_etc(SeshatCommon):
wood_bark_etc = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Wood_bark_etc'
verbose_name_plural = 'Wood_bark_etcs'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "wood_bark_etc"
def clean_name_spaced(self):
@@ -1392,6 +2873,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('wood_bark_etc-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1403,18 +2892,63 @@ class Leather_cloth(SeshatCommon):
leather_cloth = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Leather_cloth'
verbose_name_plural = 'Leather_cloths'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "leather_cloth"
def clean_name_spaced(self):
@@ -1441,6 +2975,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('leather_cloth-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1452,18 +2994,63 @@ class Shield(SeshatCommon):
shield = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Shield'
verbose_name_plural = 'Shields'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "shield"
def clean_name_spaced(self):
@@ -1490,6 +3077,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('shield-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1501,18 +3096,63 @@ class Helmet(SeshatCommon):
helmet = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Helmet'
verbose_name_plural = 'Helmets'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "helmet"
def clean_name_spaced(self):
@@ -1539,6 +3179,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('helmet-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1550,18 +3198,63 @@ class Breastplate(SeshatCommon):
breastplate = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Breastplate'
verbose_name_plural = 'Breastplates'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "breastplate"
def clean_name_spaced(self):
@@ -1588,6 +3281,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('breastplate-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1599,18 +3300,63 @@ class Limb_protection(SeshatCommon):
limb_protection = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Limb_protection'
verbose_name_plural = 'Limb_protections'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "limb_protection"
def clean_name_spaced(self):
@@ -1637,6 +3383,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('limb_protection-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1648,18 +3402,63 @@ class Scaled_armor(SeshatCommon):
scaled_armor = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Scaled_armor'
verbose_name_plural = 'Scaled_armors'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "scaled_armor"
def clean_name_spaced(self):
@@ -1686,6 +3485,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('scaled_armor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1697,18 +3504,63 @@ class Laminar_armor(SeshatCommon):
laminar_armor = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Laminar_armor'
verbose_name_plural = 'Laminar_armors'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "laminar_armor"
def clean_name_spaced(self):
@@ -1735,6 +3587,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('laminar_armor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1746,18 +3606,63 @@ class Plate_armor(SeshatCommon):
plate_armor = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Plate_armor'
verbose_name_plural = 'Plate_armors'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "plate_armor"
def clean_name_spaced(self):
@@ -1784,6 +3689,14 @@ def sub_subsection(self):
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('plate_armor-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1795,18 +3708,63 @@ class Small_vessels_canoes_etc(SeshatCommon):
small_vessels_canoes_etc = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Small_vessels_canoes_etc'
verbose_name_plural = 'Small_vessels_canoes_etcs'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "small_vessels_canoes_etc"
def clean_name_spaced(self):
@@ -1832,6 +3790,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('small_vessels_canoes_etc-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1843,18 +3809,63 @@ class Merchant_ships_pressed_into_service(SeshatCommon):
merchant_ships_pressed_into_service = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Merchant_ships_pressed_into_service'
verbose_name_plural = 'Merchant_ships_pressed_into_services'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "merchant_ships_pressed_into_service"
def clean_name_spaced(self):
@@ -1880,6 +3891,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('merchant_ships_pressed_into_service-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1891,18 +3910,63 @@ class Specialized_military_vessel(SeshatCommon):
specialized_military_vessel = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Specialized_military_vessel'
verbose_name_plural = 'Specialized_military_vessels'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "specialized_military_vessel"
def clean_name_spaced(self):
@@ -1928,6 +3992,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('specialized_military_vessel-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1939,18 +4011,63 @@ class Settlements_in_a_defensive_position(SeshatCommon):
settlements_in_a_defensive_position = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Settlements_in_a_defensive_position'
verbose_name_plural = 'Settlements_in_a_defensive_positions'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "settlements_in_a_defensive_position"
def clean_name_spaced(self):
@@ -1976,6 +4093,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('settlements_in_a_defensive_position-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -1987,18 +4112,63 @@ class Wooden_palisade(SeshatCommon):
wooden_palisade = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Wooden_palisade'
verbose_name_plural = 'Wooden_palisades'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "wooden_palisade"
def clean_name_spaced(self):
@@ -2024,6 +4194,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('wooden_palisade-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2035,18 +4213,63 @@ class Earth_rampart(SeshatCommon):
earth_rampart = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Earth_rampart'
verbose_name_plural = 'Earth_ramparts'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "earth_rampart"
def clean_name_spaced(self):
@@ -2072,6 +4295,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('earth_rampart-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2083,18 +4314,63 @@ class Ditch(SeshatCommon):
ditch = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Ditch'
verbose_name_plural = 'Ditchs'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "ditch"
def clean_name_spaced(self):
@@ -2120,6 +4396,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('ditch-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2131,18 +4415,63 @@ class Moat(SeshatCommon):
moat = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Moat'
verbose_name_plural = 'Moats'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "moat"
def clean_name_spaced(self):
@@ -2168,6 +4497,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('moat-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2179,18 +4516,63 @@ class Stone_walls_non_mortared(SeshatCommon):
stone_walls_non_mortared = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Stone_walls_non_mortared'
verbose_name_plural = 'Stone_walls_non_mortareds'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "stone_walls_non_mortared"
def clean_name_spaced(self):
@@ -2216,6 +4598,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('stone_walls_non_mortared-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2227,18 +4617,63 @@ class Stone_walls_mortared(SeshatCommon):
stone_walls_mortared = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Stone_walls_mortared'
verbose_name_plural = 'Stone_walls_mortareds'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "stone_walls_mortared"
def clean_name_spaced(self):
@@ -2264,6 +4699,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('stone_walls_mortared-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2275,18 +4718,63 @@ class Fortified_camp(SeshatCommon):
fortified_camp = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Fortified_camp'
verbose_name_plural = 'Fortified_camps'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "fortified_camp"
def clean_name_spaced(self):
@@ -2312,6 +4800,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('fortified_camp-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2323,18 +4819,63 @@ class Complex_fortification(SeshatCommon):
complex_fortification = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Complex_fortification'
verbose_name_plural = 'Complex_fortifications'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "complex_fortification"
def clean_name_spaced(self):
@@ -2360,6 +4901,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('complex_fortification-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2371,18 +4920,63 @@ class Modern_fortification(SeshatCommon):
modern_fortification = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Modern_fortification'
verbose_name_plural = 'Modern_fortifications'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "modern_fortification"
def clean_name_spaced(self):
@@ -2408,6 +5002,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('modern_fortification-detail', args=[str(self.id)])
def __str__(self) -> str:
@@ -2419,18 +5021,63 @@ class Chainmail(SeshatCommon):
chainmail = models.CharField(max_length=500, choices=ABSENT_PRESENT_CHOICES)
class Meta:
+ """
+ :noindex:
+ """
verbose_name = 'Chainmail'
verbose_name_plural = 'Chainmails'
ordering = ['year_from', 'year_to']
@property
def display_citations(self):
+ """
+ Display the citations of the model instance.
+
+ :noindex:
+
+ Note:
+ The method is a property, and an alias for the return_citations
+ function.
+
+ Returns:
+ str: The citations of the model instance, separated by comma.
+ """
return return_citations(self)
def clean(self):
+ """
+ Validate the year_from and year_to fields of the model instance.
+
+ :noindex:
+
+ Note:
+ The method an alias for the clean_times function.
+
+ Returns:
+ None
+
+ Raises:
+ ValidationError: If the year_from is greater than the year_to.
+ ValidationError: If the year_from is out of range.
+ ValidationError: If the year_from is earlier than the start year of the corresponding polity.
+ ValidationError: If the year_to is later than the end year of the corresponding polity.
+ ValidationError: If the year_to is out of range.
+ """
clean_times(self)
def clean_name(self):
+ """
+ Return the name of the model instance.
+
+ :noindex:
+
+ Note:
+ TODO This method should probably just be an attribute set on the
+ model instead.
+
+ Returns:
+ str: The name of the model instance.
+ """
return "chainmail"
def clean_name_spaced(self):
@@ -2456,6 +5103,14 @@ def sub_subsection(self):
return None
def get_absolute_url(self):
+ """
+ Returns the url to access a particular instance of the model.
+
+ :noindex:
+
+ Returns:
+ str: A string of the url to access a particular instance of the model.
+ """
return reverse('chainmail-detail', args=[str(self.id)])
def __str__(self) -> str:
diff --git a/seshat/apps/wf/tests.py b/seshat/apps/wf/tests.py
index 7ce503c2d..e69de29bb 100644
--- a/seshat/apps/wf/tests.py
+++ b/seshat/apps/wf/tests.py
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/seshat/apps/wf/views.py b/seshat/apps/wf/views.py
index defc0ebed..773e13871 100644
--- a/seshat/apps/wf/views.py
+++ b/seshat/apps/wf/views.py
@@ -48,13 +48,26 @@
##########################
class Long_wallCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Long_wall
form_class = Long_wallForm
template_name = "wf/long_wall/long_wall_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('long_wall-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -69,6 +82,12 @@ def get_context_data(self, **kwargs):
class Long_wallUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Long_wall
form_class = Long_wallForm
template_name = "wf/long_wall/long_wall_update.html"
@@ -84,6 +103,12 @@ def get_context_data(self, **kwargs):
return context
class Long_wallDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Long_wall
success_url = reverse_lazy('long_walls')
template_name = "core/delete_general.html"
@@ -91,11 +116,20 @@ class Long_wallDelete(PermissionRequiredMixin, DeleteView):
class Long_wallListView(generic.ListView):
+ """
+
+ """
model = Long_wall
template_name = "wf/long_wall/long_wall_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('long_walls')
def get_context_data(self, **kwargs):
@@ -112,10 +146,19 @@ def get_context_data(self, **kwargs):
class Long_wallListViewAll(generic.ListView):
+ """
+
+ """
model = Long_wall
template_name = "wf/long_wall/long_wall_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('long_walls_all')
def get_queryset(self):
@@ -150,6 +193,9 @@ def get_context_data(self, **kwargs):
return context
class Long_wallDetailView(generic.DetailView):
+ """
+
+ """
model = Long_wall
template_name = "wf/long_wall/long_wall_detail.html"
@@ -216,13 +262,26 @@ def long_wall_meta_download(request):
class CopperCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Copper
form_class = CopperForm
template_name = "wf/copper/copper_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('copper-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -237,6 +296,12 @@ def get_context_data(self, **kwargs):
class CopperUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Copper
form_class = CopperForm
template_name = "wf/copper/copper_update.html"
@@ -251,6 +316,12 @@ def get_context_data(self, **kwargs):
return context
class CopperDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Copper
success_url = reverse_lazy('coppers')
template_name = "core/delete_general.html"
@@ -258,11 +329,20 @@ class CopperDelete(PermissionRequiredMixin, DeleteView):
class CopperListView(generic.ListView):
+ """
+
+ """
model = Copper
template_name = "wf/copper/copper_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('coppers')
def get_context_data(self, **kwargs):
@@ -279,10 +359,19 @@ def get_context_data(self, **kwargs):
class CopperListViewAll(generic.ListView):
+ """
+
+ """
model = Copper
template_name = "wf/copper/copper_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('coppers_all')
def get_queryset(self):
@@ -317,6 +406,9 @@ def get_context_data(self, **kwargs):
return context
class CopperDetailView(generic.DetailView):
+ """
+
+ """
model = Copper
template_name = "wf/copper/copper_detail.html"
@@ -364,13 +456,26 @@ def copper_meta_download(request):
class BronzeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bronze
form_class = BronzeForm
template_name = "wf/bronze/bronze_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bronze-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -385,6 +490,12 @@ def get_context_data(self, **kwargs):
class BronzeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bronze
form_class = BronzeForm
template_name = "wf/bronze/bronze_update.html"
@@ -399,6 +510,12 @@ def get_context_data(self, **kwargs):
return context
class BronzeDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Bronze
success_url = reverse_lazy('bronzes')
template_name = "core/delete_general.html"
@@ -406,11 +523,20 @@ class BronzeDelete(PermissionRequiredMixin, DeleteView):
class BronzeListView(generic.ListView):
+ """
+
+ """
model = Bronze
template_name = "wf/bronze/bronze_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bronzes')
def get_context_data(self, **kwargs):
@@ -427,10 +553,19 @@ def get_context_data(self, **kwargs):
class BronzeListViewAll(generic.ListView):
+ """
+
+ """
model = Bronze
template_name = "wf/bronze/bronze_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('bronzes_all')
def get_queryset(self):
@@ -465,6 +600,9 @@ def get_context_data(self, **kwargs):
return context
class BronzeDetailView(generic.DetailView):
+ """
+
+ """
model = Bronze
template_name = "wf/bronze/bronze_detail.html"
@@ -512,13 +650,26 @@ def bronze_meta_download(request):
class IronCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Iron
form_class = IronForm
template_name = "wf/iron/iron_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('iron-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -533,6 +684,12 @@ def get_context_data(self, **kwargs):
class IronUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Iron
form_class = IronForm
template_name = "wf/iron/iron_update.html"
@@ -547,6 +704,12 @@ def get_context_data(self, **kwargs):
return context
class IronDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Iron
success_url = reverse_lazy('irons')
template_name = "core/delete_general.html"
@@ -554,11 +717,20 @@ class IronDelete(PermissionRequiredMixin, DeleteView):
class IronListView(generic.ListView):
+ """
+
+ """
model = Iron
template_name = "wf/iron/iron_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('irons')
def get_context_data(self, **kwargs):
@@ -575,10 +747,19 @@ def get_context_data(self, **kwargs):
class IronListViewAll(generic.ListView):
+ """
+
+ """
model = Iron
template_name = "wf/iron/iron_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('irons_all')
def get_queryset(self):
@@ -613,6 +794,9 @@ def get_context_data(self, **kwargs):
return context
class IronDetailView(generic.DetailView):
+ """
+
+ """
model = Iron
template_name = "wf/iron/iron_detail.html"
@@ -660,13 +844,26 @@ def iron_meta_download(request):
class SteelCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Steel
form_class = SteelForm
template_name = "wf/steel/steel_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('steel-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -681,6 +878,12 @@ def get_context_data(self, **kwargs):
class SteelUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Steel
form_class = SteelForm
template_name = "wf/steel/steel_update.html"
@@ -695,6 +898,12 @@ def get_context_data(self, **kwargs):
return context
class SteelDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Steel
success_url = reverse_lazy('steels')
template_name = "core/delete_general.html"
@@ -702,11 +911,20 @@ class SteelDelete(PermissionRequiredMixin, DeleteView):
class SteelListView(generic.ListView):
+ """
+
+ """
model = Steel
template_name = "wf/steel/steel_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('steels')
def get_context_data(self, **kwargs):
@@ -723,10 +941,19 @@ def get_context_data(self, **kwargs):
class SteelListViewAll(generic.ListView):
+ """
+
+ """
model = Steel
template_name = "wf/steel/steel_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('steels_all')
def get_queryset(self):
@@ -761,6 +988,9 @@ def get_context_data(self, **kwargs):
return context
class SteelDetailView(generic.DetailView):
+ """
+
+ """
model = Steel
template_name = "wf/steel/steel_detail.html"
@@ -808,13 +1038,26 @@ def steel_meta_download(request):
class JavelinCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Javelin
form_class = JavelinForm
template_name = "wf/javelin/javelin_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('javelin-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -829,6 +1072,12 @@ def get_context_data(self, **kwargs):
class JavelinUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Javelin
form_class = JavelinForm
template_name = "wf/javelin/javelin_update.html"
@@ -843,6 +1092,12 @@ def get_context_data(self, **kwargs):
return context
class JavelinDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Javelin
success_url = reverse_lazy('javelins')
template_name = "core/delete_general.html"
@@ -850,11 +1105,20 @@ class JavelinDelete(PermissionRequiredMixin, DeleteView):
class JavelinListView(generic.ListView):
+ """
+
+ """
model = Javelin
template_name = "wf/javelin/javelin_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('javelins')
def get_context_data(self, **kwargs):
@@ -871,10 +1135,19 @@ def get_context_data(self, **kwargs):
class JavelinListViewAll(generic.ListView):
+ """
+
+ """
model = Javelin
template_name = "wf/javelin/javelin_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('javelins_all')
def get_queryset(self):
@@ -909,6 +1182,9 @@ def get_context_data(self, **kwargs):
return context
class JavelinDetailView(generic.DetailView):
+ """
+
+ """
model = Javelin
template_name = "wf/javelin/javelin_detail.html"
@@ -956,13 +1232,26 @@ def javelin_meta_download(request):
class AtlatlCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Atlatl
form_class = AtlatlForm
template_name = "wf/atlatl/atlatl_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('atlatl-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -977,6 +1266,12 @@ def get_context_data(self, **kwargs):
class AtlatlUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Atlatl
form_class = AtlatlForm
template_name = "wf/atlatl/atlatl_update.html"
@@ -991,6 +1286,12 @@ def get_context_data(self, **kwargs):
return context
class AtlatlDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Atlatl
success_url = reverse_lazy('atlatls')
template_name = "core/delete_general.html"
@@ -998,11 +1299,20 @@ class AtlatlDelete(PermissionRequiredMixin, DeleteView):
class AtlatlListView(generic.ListView):
+ """
+
+ """
model = Atlatl
template_name = "wf/atlatl/atlatl_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('atlatls')
def get_context_data(self, **kwargs):
@@ -1019,10 +1329,19 @@ def get_context_data(self, **kwargs):
class AtlatlListViewAll(generic.ListView):
+ """
+
+ """
model = Atlatl
template_name = "wf/atlatl/atlatl_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('atlatls_all')
def get_queryset(self):
@@ -1057,6 +1376,9 @@ def get_context_data(self, **kwargs):
return context
class AtlatlDetailView(generic.DetailView):
+ """
+
+ """
model = Atlatl
template_name = "wf/atlatl/atlatl_detail.html"
@@ -1104,13 +1426,26 @@ def atlatl_meta_download(request):
class SlingCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling
form_class = SlingForm
template_name = "wf/sling/sling_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sling-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1125,6 +1460,12 @@ def get_context_data(self, **kwargs):
class SlingUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling
form_class = SlingForm
template_name = "wf/sling/sling_update.html"
@@ -1139,6 +1480,12 @@ def get_context_data(self, **kwargs):
return context
class SlingDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling
success_url = reverse_lazy('slings')
template_name = "core/delete_general.html"
@@ -1146,11 +1493,20 @@ class SlingDelete(PermissionRequiredMixin, DeleteView):
class SlingListView(generic.ListView):
+ """
+
+ """
model = Sling
template_name = "wf/sling/sling_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('slings')
def get_context_data(self, **kwargs):
@@ -1167,10 +1523,19 @@ def get_context_data(self, **kwargs):
class SlingListViewAll(generic.ListView):
+ """
+
+ """
model = Sling
template_name = "wf/sling/sling_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('slings_all')
def get_queryset(self):
@@ -1205,6 +1570,9 @@ def get_context_data(self, **kwargs):
return context
class SlingDetailView(generic.DetailView):
+ """
+
+ """
model = Sling
template_name = "wf/sling/sling_detail.html"
@@ -1252,13 +1620,26 @@ def sling_meta_download(request):
class Self_bowCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Self_bow
form_class = Self_bowForm
template_name = "wf/self_bow/self_bow_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('self_bow-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1273,6 +1654,12 @@ def get_context_data(self, **kwargs):
class Self_bowUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Self_bow
form_class = Self_bowForm
template_name = "wf/self_bow/self_bow_update.html"
@@ -1287,6 +1674,12 @@ def get_context_data(self, **kwargs):
return context
class Self_bowDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Self_bow
success_url = reverse_lazy('self_bows')
template_name = "core/delete_general.html"
@@ -1294,11 +1687,20 @@ class Self_bowDelete(PermissionRequiredMixin, DeleteView):
class Self_bowListView(generic.ListView):
+ """
+
+ """
model = Self_bow
template_name = "wf/self_bow/self_bow_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('self_bows')
def get_context_data(self, **kwargs):
@@ -1315,10 +1717,19 @@ def get_context_data(self, **kwargs):
class Self_bowListViewAll(generic.ListView):
+ """
+
+ """
model = Self_bow
template_name = "wf/self_bow/self_bow_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('self_bows_all')
def get_queryset(self):
@@ -1353,6 +1764,9 @@ def get_context_data(self, **kwargs):
return context
class Self_bowDetailView(generic.DetailView):
+ """
+
+ """
model = Self_bow
template_name = "wf/self_bow/self_bow_detail.html"
@@ -1400,13 +1814,26 @@ def self_bow_meta_download(request):
class Composite_bowCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Composite_bow
form_class = Composite_bowForm
template_name = "wf/composite_bow/composite_bow_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('composite_bow-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1421,6 +1848,12 @@ def get_context_data(self, **kwargs):
class Composite_bowUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Composite_bow
form_class = Composite_bowForm
template_name = "wf/composite_bow/composite_bow_update.html"
@@ -1435,6 +1868,12 @@ def get_context_data(self, **kwargs):
return context
class Composite_bowDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Composite_bow
success_url = reverse_lazy('composite_bows')
template_name = "core/delete_general.html"
@@ -1442,11 +1881,20 @@ class Composite_bowDelete(PermissionRequiredMixin, DeleteView):
class Composite_bowListView(generic.ListView):
+ """
+
+ """
model = Composite_bow
template_name = "wf/composite_bow/composite_bow_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('composite_bows')
def get_context_data(self, **kwargs):
@@ -1463,10 +1911,19 @@ def get_context_data(self, **kwargs):
class Composite_bowListViewAll(generic.ListView):
+ """
+
+ """
model = Composite_bow
template_name = "wf/composite_bow/composite_bow_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('composite_bows_all')
def get_queryset(self):
@@ -1501,6 +1958,9 @@ def get_context_data(self, **kwargs):
return context
class Composite_bowDetailView(generic.DetailView):
+ """
+
+ """
model = Composite_bow
template_name = "wf/composite_bow/composite_bow_detail.html"
@@ -1548,13 +2008,26 @@ def composite_bow_meta_download(request):
class CrossbowCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Crossbow
form_class = CrossbowForm
template_name = "wf/crossbow/crossbow_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('crossbow-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1569,6 +2042,12 @@ def get_context_data(self, **kwargs):
class CrossbowUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Crossbow
form_class = CrossbowForm
template_name = "wf/crossbow/crossbow_update.html"
@@ -1583,6 +2062,12 @@ def get_context_data(self, **kwargs):
return context
class CrossbowDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Crossbow
success_url = reverse_lazy('crossbows')
template_name = "core/delete_general.html"
@@ -1590,11 +2075,20 @@ class CrossbowDelete(PermissionRequiredMixin, DeleteView):
class CrossbowListView(generic.ListView):
+ """
+
+ """
model = Crossbow
template_name = "wf/crossbow/crossbow_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('crossbows')
def get_context_data(self, **kwargs):
@@ -1611,10 +2105,19 @@ def get_context_data(self, **kwargs):
class CrossbowListViewAll(generic.ListView):
+ """
+
+ """
model = Crossbow
template_name = "wf/crossbow/crossbow_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('crossbows_all')
def get_queryset(self):
@@ -1649,6 +2152,9 @@ def get_context_data(self, **kwargs):
return context
class CrossbowDetailView(generic.DetailView):
+ """
+
+ """
model = Crossbow
template_name = "wf/crossbow/crossbow_detail.html"
@@ -1696,13 +2202,26 @@ def crossbow_meta_download(request):
class Tension_siege_engineCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Tension_siege_engine
form_class = Tension_siege_engineForm
template_name = "wf/tension_siege_engine/tension_siege_engine_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tension_siege_engine-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1717,6 +2236,12 @@ def get_context_data(self, **kwargs):
class Tension_siege_engineUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Tension_siege_engine
form_class = Tension_siege_engineForm
template_name = "wf/tension_siege_engine/tension_siege_engine_update.html"
@@ -1731,6 +2256,12 @@ def get_context_data(self, **kwargs):
return context
class Tension_siege_engineDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Tension_siege_engine
success_url = reverse_lazy('tension_siege_engines')
template_name = "core/delete_general.html"
@@ -1738,11 +2269,20 @@ class Tension_siege_engineDelete(PermissionRequiredMixin, DeleteView):
class Tension_siege_engineListView(generic.ListView):
+ """
+
+ """
model = Tension_siege_engine
template_name = "wf/tension_siege_engine/tension_siege_engine_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tension_siege_engines')
def get_context_data(self, **kwargs):
@@ -1759,10 +2299,19 @@ def get_context_data(self, **kwargs):
class Tension_siege_engineListViewAll(generic.ListView):
+ """
+
+ """
model = Tension_siege_engine
template_name = "wf/tension_siege_engine/tension_siege_engine_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('tension_siege_engines_all')
def get_queryset(self):
@@ -1797,6 +2346,9 @@ def get_context_data(self, **kwargs):
return context
class Tension_siege_engineDetailView(generic.DetailView):
+ """
+
+ """
model = Tension_siege_engine
template_name = "wf/tension_siege_engine/tension_siege_engine_detail.html"
@@ -1844,13 +2396,26 @@ def tension_siege_engine_meta_download(request):
class Sling_siege_engineCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling_siege_engine
form_class = Sling_siege_engineForm
template_name = "wf/sling_siege_engine/sling_siege_engine_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sling_siege_engine-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -1865,6 +2430,12 @@ def get_context_data(self, **kwargs):
class Sling_siege_engineUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling_siege_engine
form_class = Sling_siege_engineForm
template_name = "wf/sling_siege_engine/sling_siege_engine_update.html"
@@ -1879,6 +2450,12 @@ def get_context_data(self, **kwargs):
return context
class Sling_siege_engineDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sling_siege_engine
success_url = reverse_lazy('sling_siege_engines')
template_name = "core/delete_general.html"
@@ -1886,11 +2463,20 @@ class Sling_siege_engineDelete(PermissionRequiredMixin, DeleteView):
class Sling_siege_engineListView(generic.ListView):
+ """
+
+ """
model = Sling_siege_engine
template_name = "wf/sling_siege_engine/sling_siege_engine_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sling_siege_engines')
def get_context_data(self, **kwargs):
@@ -1907,10 +2493,19 @@ def get_context_data(self, **kwargs):
class Sling_siege_engineListViewAll(generic.ListView):
+ """
+
+ """
model = Sling_siege_engine
template_name = "wf/sling_siege_engine/sling_siege_engine_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sling_siege_engines_all')
def get_queryset(self):
@@ -1945,6 +2540,9 @@ def get_context_data(self, **kwargs):
return context
class Sling_siege_engineDetailView(generic.DetailView):
+ """
+
+ """
model = Sling_siege_engine
template_name = "wf/sling_siege_engine/sling_siege_engine_detail.html"
@@ -1992,13 +2590,26 @@ def sling_siege_engine_meta_download(request):
class Gunpowder_siege_artilleryCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Gunpowder_siege_artillery
form_class = Gunpowder_siege_artilleryForm
template_name = "wf/gunpowder_siege_artillery/gunpowder_siege_artillery_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('gunpowder_siege_artillery-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2013,6 +2624,12 @@ def get_context_data(self, **kwargs):
class Gunpowder_siege_artilleryUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Gunpowder_siege_artillery
form_class = Gunpowder_siege_artilleryForm
template_name = "wf/gunpowder_siege_artillery/gunpowder_siege_artillery_update.html"
@@ -2027,6 +2644,12 @@ def get_context_data(self, **kwargs):
return context
class Gunpowder_siege_artilleryDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Gunpowder_siege_artillery
success_url = reverse_lazy('gunpowder_siege_artillerys')
template_name = "core/delete_general.html"
@@ -2034,11 +2657,20 @@ class Gunpowder_siege_artilleryDelete(PermissionRequiredMixin, DeleteView):
class Gunpowder_siege_artilleryListView(generic.ListView):
+ """
+
+ """
model = Gunpowder_siege_artillery
template_name = "wf/gunpowder_siege_artillery/gunpowder_siege_artillery_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('gunpowder_siege_artillerys')
def get_context_data(self, **kwargs):
@@ -2055,10 +2687,19 @@ def get_context_data(self, **kwargs):
class Gunpowder_siege_artilleryListViewAll(generic.ListView):
+ """
+
+ """
model = Gunpowder_siege_artillery
template_name = "wf/gunpowder_siege_artillery/gunpowder_siege_artillery_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('gunpowder_siege_artillerys_all')
def get_queryset(self):
@@ -2093,6 +2734,9 @@ def get_context_data(self, **kwargs):
return context
class Gunpowder_siege_artilleryDetailView(generic.DetailView):
+ """
+
+ """
model = Gunpowder_siege_artillery
template_name = "wf/gunpowder_siege_artillery/gunpowder_siege_artillery_detail.html"
@@ -2140,13 +2784,26 @@ def gunpowder_siege_artillery_meta_download(request):
class Handheld_firearmCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Handheld_firearm
form_class = Handheld_firearmForm
template_name = "wf/handheld_firearm/handheld_firearm_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('handheld_firearm-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2161,6 +2818,12 @@ def get_context_data(self, **kwargs):
class Handheld_firearmUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Handheld_firearm
form_class = Handheld_firearmForm
template_name = "wf/handheld_firearm/handheld_firearm_update.html"
@@ -2175,6 +2838,12 @@ def get_context_data(self, **kwargs):
return context
class Handheld_firearmDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Handheld_firearm
success_url = reverse_lazy('handheld_firearms')
template_name = "core/delete_general.html"
@@ -2182,11 +2851,20 @@ class Handheld_firearmDelete(PermissionRequiredMixin, DeleteView):
class Handheld_firearmListView(generic.ListView):
+ """
+
+ """
model = Handheld_firearm
template_name = "wf/handheld_firearm/handheld_firearm_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('handheld_firearms')
def get_context_data(self, **kwargs):
@@ -2203,10 +2881,19 @@ def get_context_data(self, **kwargs):
class Handheld_firearmListViewAll(generic.ListView):
+ """
+
+ """
model = Handheld_firearm
template_name = "wf/handheld_firearm/handheld_firearm_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('handheld_firearms_all')
def get_queryset(self):
@@ -2241,6 +2928,9 @@ def get_context_data(self, **kwargs):
return context
class Handheld_firearmDetailView(generic.DetailView):
+ """
+
+ """
model = Handheld_firearm
template_name = "wf/handheld_firearm/handheld_firearm_detail.html"
@@ -2288,13 +2978,26 @@ def handheld_firearm_meta_download(request):
class War_clubCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = War_club
form_class = War_clubForm
template_name = "wf/war_club/war_club_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('war_club-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2309,6 +3012,12 @@ def get_context_data(self, **kwargs):
class War_clubUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = War_club
form_class = War_clubForm
template_name = "wf/war_club/war_club_update.html"
@@ -2323,6 +3032,12 @@ def get_context_data(self, **kwargs):
return context
class War_clubDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = War_club
success_url = reverse_lazy('war_clubs')
template_name = "core/delete_general.html"
@@ -2330,11 +3045,20 @@ class War_clubDelete(PermissionRequiredMixin, DeleteView):
class War_clubListView(generic.ListView):
+ """
+
+ """
model = War_club
template_name = "wf/war_club/war_club_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('war_clubs')
def get_context_data(self, **kwargs):
@@ -2351,10 +3075,19 @@ def get_context_data(self, **kwargs):
class War_clubListViewAll(generic.ListView):
+ """
+
+ """
model = War_club
template_name = "wf/war_club/war_club_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('war_clubs_all')
def get_queryset(self):
@@ -2389,6 +3122,9 @@ def get_context_data(self, **kwargs):
return context
class War_clubDetailView(generic.DetailView):
+ """
+
+ """
model = War_club
template_name = "wf/war_club/war_club_detail.html"
@@ -2436,13 +3172,26 @@ def war_club_meta_download(request):
class Battle_axeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Battle_axe
form_class = Battle_axeForm
template_name = "wf/battle_axe/battle_axe_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('battle_axe-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2457,6 +3206,12 @@ def get_context_data(self, **kwargs):
class Battle_axeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Battle_axe
form_class = Battle_axeForm
template_name = "wf/battle_axe/battle_axe_update.html"
@@ -2471,6 +3226,12 @@ def get_context_data(self, **kwargs):
return context
class Battle_axeDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Battle_axe
success_url = reverse_lazy('battle_axes')
template_name = "core/delete_general.html"
@@ -2478,11 +3239,20 @@ class Battle_axeDelete(PermissionRequiredMixin, DeleteView):
class Battle_axeListView(generic.ListView):
+ """
+
+ """
model = Battle_axe
template_name = "wf/battle_axe/battle_axe_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('battle_axes')
def get_context_data(self, **kwargs):
@@ -2499,10 +3269,19 @@ def get_context_data(self, **kwargs):
class Battle_axeListViewAll(generic.ListView):
+ """
+
+ """
model = Battle_axe
template_name = "wf/battle_axe/battle_axe_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('battle_axes_all')
def get_queryset(self):
@@ -2537,6 +3316,9 @@ def get_context_data(self, **kwargs):
return context
class Battle_axeDetailView(generic.DetailView):
+ """
+
+ """
model = Battle_axe
template_name = "wf/battle_axe/battle_axe_detail.html"
@@ -2584,13 +3366,26 @@ def battle_axe_meta_download(request):
class DaggerCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dagger
form_class = DaggerForm
template_name = "wf/dagger/dagger_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('dagger-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2605,6 +3400,12 @@ def get_context_data(self, **kwargs):
class DaggerUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dagger
form_class = DaggerForm
template_name = "wf/dagger/dagger_update.html"
@@ -2619,6 +3420,12 @@ def get_context_data(self, **kwargs):
return context
class DaggerDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dagger
success_url = reverse_lazy('daggers')
template_name = "core/delete_general.html"
@@ -2626,11 +3433,20 @@ class DaggerDelete(PermissionRequiredMixin, DeleteView):
class DaggerListView(generic.ListView):
+ """
+
+ """
model = Dagger
template_name = "wf/dagger/dagger_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('daggers')
def get_context_data(self, **kwargs):
@@ -2647,10 +3463,19 @@ def get_context_data(self, **kwargs):
class DaggerListViewAll(generic.ListView):
+ """
+
+ """
model = Dagger
template_name = "wf/dagger/dagger_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('daggers_all')
def get_queryset(self):
@@ -2685,6 +3510,9 @@ def get_context_data(self, **kwargs):
return context
class DaggerDetailView(generic.DetailView):
+ """
+
+ """
model = Dagger
template_name = "wf/dagger/dagger_detail.html"
@@ -2732,13 +3560,26 @@ def dagger_meta_download(request):
class SwordCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sword
form_class = SwordForm
template_name = "wf/sword/sword_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('sword-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2753,6 +3594,12 @@ def get_context_data(self, **kwargs):
class SwordUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sword
form_class = SwordForm
template_name = "wf/sword/sword_update.html"
@@ -2767,6 +3614,12 @@ def get_context_data(self, **kwargs):
return context
class SwordDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Sword
success_url = reverse_lazy('swords')
template_name = "core/delete_general.html"
@@ -2774,11 +3627,20 @@ class SwordDelete(PermissionRequiredMixin, DeleteView):
class SwordListView(generic.ListView):
+ """
+
+ """
model = Sword
template_name = "wf/sword/sword_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('swords')
def get_context_data(self, **kwargs):
@@ -2795,10 +3657,19 @@ def get_context_data(self, **kwargs):
class SwordListViewAll(generic.ListView):
+ """
+
+ """
model = Sword
template_name = "wf/sword/sword_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('swords_all')
def get_queryset(self):
@@ -2833,6 +3704,9 @@ def get_context_data(self, **kwargs):
return context
class SwordDetailView(generic.DetailView):
+ """
+
+ """
model = Sword
template_name = "wf/sword/sword_detail.html"
@@ -2880,13 +3754,26 @@ def sword_meta_download(request):
class SpearCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Spear
form_class = SpearForm
template_name = "wf/spear/spear_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('spear-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -2901,6 +3788,12 @@ def get_context_data(self, **kwargs):
class SpearUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Spear
form_class = SpearForm
template_name = "wf/spear/spear_update.html"
@@ -2915,6 +3808,12 @@ def get_context_data(self, **kwargs):
return context
class SpearDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Spear
success_url = reverse_lazy('spears')
template_name = "core/delete_general.html"
@@ -2922,11 +3821,20 @@ class SpearDelete(PermissionRequiredMixin, DeleteView):
class SpearListView(generic.ListView):
+ """
+
+ """
model = Spear
template_name = "wf/spear/spear_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('spears')
def get_context_data(self, **kwargs):
@@ -2943,10 +3851,19 @@ def get_context_data(self, **kwargs):
class SpearListViewAll(generic.ListView):
+ """
+
+ """
model = Spear
template_name = "wf/spear/spear_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('spears_all')
def get_queryset(self):
@@ -2981,6 +3898,9 @@ def get_context_data(self, **kwargs):
return context
class SpearDetailView(generic.DetailView):
+ """
+
+ """
model = Spear
template_name = "wf/spear/spear_detail.html"
@@ -3028,13 +3948,26 @@ def spear_meta_download(request):
class PolearmCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polearm
form_class = PolearmForm
template_name = "wf/polearm/polearm_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polearm-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3049,6 +3982,12 @@ def get_context_data(self, **kwargs):
class PolearmUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polearm
form_class = PolearmForm
template_name = "wf/polearm/polearm_update.html"
@@ -3063,6 +4002,12 @@ def get_context_data(self, **kwargs):
return context
class PolearmDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Polearm
success_url = reverse_lazy('polearms')
template_name = "core/delete_general.html"
@@ -3070,11 +4015,20 @@ class PolearmDelete(PermissionRequiredMixin, DeleteView):
class PolearmListView(generic.ListView):
+ """
+
+ """
model = Polearm
template_name = "wf/polearm/polearm_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polearms')
def get_context_data(self, **kwargs):
@@ -3091,10 +4045,19 @@ def get_context_data(self, **kwargs):
class PolearmListViewAll(generic.ListView):
+ """
+
+ """
model = Polearm
template_name = "wf/polearm/polearm_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('polearms_all')
def get_queryset(self):
@@ -3129,6 +4092,9 @@ def get_context_data(self, **kwargs):
return context
class PolearmDetailView(generic.DetailView):
+ """
+
+ """
model = Polearm
template_name = "wf/polearm/polearm_detail.html"
@@ -3176,13 +4142,26 @@ def polearm_meta_download(request):
class DogCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dog
form_class = DogForm
template_name = "wf/dog/dog_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('dog-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3197,6 +4176,12 @@ def get_context_data(self, **kwargs):
class DogUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dog
form_class = DogForm
template_name = "wf/dog/dog_update.html"
@@ -3211,6 +4196,12 @@ def get_context_data(self, **kwargs):
return context
class DogDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Dog
success_url = reverse_lazy('dogs')
template_name = "core/delete_general.html"
@@ -3218,11 +4209,20 @@ class DogDelete(PermissionRequiredMixin, DeleteView):
class DogListView(generic.ListView):
+ """
+
+ """
model = Dog
template_name = "wf/dog/dog_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('dogs')
def get_context_data(self, **kwargs):
@@ -3239,10 +4239,19 @@ def get_context_data(self, **kwargs):
class DogListViewAll(generic.ListView):
+ """
+
+ """
model = Dog
template_name = "wf/dog/dog_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('dogs_all')
def get_queryset(self):
@@ -3277,6 +4286,9 @@ def get_context_data(self, **kwargs):
return context
class DogDetailView(generic.DetailView):
+ """
+
+ """
model = Dog
template_name = "wf/dog/dog_detail.html"
@@ -3324,13 +4336,26 @@ def dog_meta_download(request):
class DonkeyCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Donkey
form_class = DonkeyForm
template_name = "wf/donkey/donkey_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('donkey-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3345,6 +4370,12 @@ def get_context_data(self, **kwargs):
class DonkeyUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Donkey
form_class = DonkeyForm
template_name = "wf/donkey/donkey_update.html"
@@ -3359,6 +4390,12 @@ def get_context_data(self, **kwargs):
return context
class DonkeyDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Donkey
success_url = reverse_lazy('donkeys')
template_name = "core/delete_general.html"
@@ -3366,11 +4403,20 @@ class DonkeyDelete(PermissionRequiredMixin, DeleteView):
class DonkeyListView(generic.ListView):
+ """
+
+ """
model = Donkey
template_name = "wf/donkey/donkey_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('donkeys')
def get_context_data(self, **kwargs):
@@ -3387,10 +4433,19 @@ def get_context_data(self, **kwargs):
class DonkeyListViewAll(generic.ListView):
+ """
+
+ """
model = Donkey
template_name = "wf/donkey/donkey_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('donkeys_all')
def get_queryset(self):
@@ -3425,6 +4480,9 @@ def get_context_data(self, **kwargs):
return context
class DonkeyDetailView(generic.DetailView):
+ """
+
+ """
model = Donkey
template_name = "wf/donkey/donkey_detail.html"
@@ -3472,13 +4530,26 @@ def donkey_meta_download(request):
class HorseCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Horse
form_class = HorseForm
template_name = "wf/horse/horse_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('horse-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3493,6 +4564,12 @@ def get_context_data(self, **kwargs):
class HorseUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Horse
form_class = HorseForm
template_name = "wf/horse/horse_update.html"
@@ -3507,6 +4584,12 @@ def get_context_data(self, **kwargs):
return context
class HorseDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Horse
success_url = reverse_lazy('horses')
template_name = "core/delete_general.html"
@@ -3514,11 +4597,20 @@ class HorseDelete(PermissionRequiredMixin, DeleteView):
class HorseListView(generic.ListView):
+ """
+
+ """
model = Horse
template_name = "wf/horse/horse_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('horses')
def get_context_data(self, **kwargs):
@@ -3535,10 +4627,19 @@ def get_context_data(self, **kwargs):
class HorseListViewAll(generic.ListView):
+ """
+
+ """
model = Horse
template_name = "wf/horse/horse_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('horses_all')
def get_queryset(self):
@@ -3573,6 +4674,9 @@ def get_context_data(self, **kwargs):
return context
class HorseDetailView(generic.DetailView):
+ """
+
+ """
model = Horse
template_name = "wf/horse/horse_detail.html"
@@ -3620,13 +4724,26 @@ def horse_meta_download(request):
class CamelCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Camel
form_class = CamelForm
template_name = "wf/camel/camel_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('camel-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3641,6 +4758,12 @@ def get_context_data(self, **kwargs):
class CamelUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Camel
form_class = CamelForm
template_name = "wf/camel/camel_update.html"
@@ -3655,6 +4778,12 @@ def get_context_data(self, **kwargs):
return context
class CamelDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Camel
success_url = reverse_lazy('camels')
template_name = "core/delete_general.html"
@@ -3662,11 +4791,20 @@ class CamelDelete(PermissionRequiredMixin, DeleteView):
class CamelListView(generic.ListView):
+ """
+
+ """
model = Camel
template_name = "wf/camel/camel_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('camels')
def get_context_data(self, **kwargs):
@@ -3683,10 +4821,19 @@ def get_context_data(self, **kwargs):
class CamelListViewAll(generic.ListView):
+ """
+
+ """
model = Camel
template_name = "wf/camel/camel_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('camels_all')
def get_queryset(self):
@@ -3721,6 +4868,9 @@ def get_context_data(self, **kwargs):
return context
class CamelDetailView(generic.DetailView):
+ """
+
+ """
model = Camel
template_name = "wf/camel/camel_detail.html"
@@ -3768,13 +4918,26 @@ def camel_meta_download(request):
class ElephantCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Elephant
form_class = ElephantForm
template_name = "wf/elephant/elephant_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('elephant-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3789,6 +4952,12 @@ def get_context_data(self, **kwargs):
class ElephantUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Elephant
form_class = ElephantForm
template_name = "wf/elephant/elephant_update.html"
@@ -3803,6 +4972,12 @@ def get_context_data(self, **kwargs):
return context
class ElephantDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Elephant
success_url = reverse_lazy('elephants')
template_name = "core/delete_general.html"
@@ -3810,11 +4985,20 @@ class ElephantDelete(PermissionRequiredMixin, DeleteView):
class ElephantListView(generic.ListView):
+ """
+
+ """
model = Elephant
template_name = "wf/elephant/elephant_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('elephants')
def get_context_data(self, **kwargs):
@@ -3831,10 +5015,19 @@ def get_context_data(self, **kwargs):
class ElephantListViewAll(generic.ListView):
+ """
+
+ """
model = Elephant
template_name = "wf/elephant/elephant_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('elephants_all')
def get_queryset(self):
@@ -3869,6 +5062,9 @@ def get_context_data(self, **kwargs):
return context
class ElephantDetailView(generic.DetailView):
+ """
+
+ """
model = Elephant
template_name = "wf/elephant/elephant_detail.html"
@@ -3916,13 +5112,26 @@ def elephant_meta_download(request):
class Wood_bark_etcCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wood_bark_etc
form_class = Wood_bark_etcForm
template_name = "wf/wood_bark_etc/wood_bark_etc_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wood_bark_etc-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -3937,6 +5146,12 @@ def get_context_data(self, **kwargs):
class Wood_bark_etcUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wood_bark_etc
form_class = Wood_bark_etcForm
template_name = "wf/wood_bark_etc/wood_bark_etc_update.html"
@@ -3951,6 +5166,12 @@ def get_context_data(self, **kwargs):
return context
class Wood_bark_etcDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wood_bark_etc
success_url = reverse_lazy('wood_bark_etcs')
template_name = "core/delete_general.html"
@@ -3958,11 +5179,20 @@ class Wood_bark_etcDelete(PermissionRequiredMixin, DeleteView):
class Wood_bark_etcListView(generic.ListView):
+ """
+
+ """
model = Wood_bark_etc
template_name = "wf/wood_bark_etc/wood_bark_etc_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wood_bark_etcs')
def get_context_data(self, **kwargs):
@@ -3979,10 +5209,19 @@ def get_context_data(self, **kwargs):
class Wood_bark_etcListViewAll(generic.ListView):
+ """
+
+ """
model = Wood_bark_etc
template_name = "wf/wood_bark_etc/wood_bark_etc_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wood_bark_etcs_all')
def get_queryset(self):
@@ -4017,6 +5256,9 @@ def get_context_data(self, **kwargs):
return context
class Wood_bark_etcDetailView(generic.DetailView):
+ """
+
+ """
model = Wood_bark_etc
template_name = "wf/wood_bark_etc/wood_bark_etc_detail.html"
@@ -4064,13 +5306,26 @@ def wood_bark_etc_meta_download(request):
class Leather_clothCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Leather_cloth
form_class = Leather_clothForm
template_name = "wf/leather_cloth/leather_cloth_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('leather_cloth-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4085,6 +5340,12 @@ def get_context_data(self, **kwargs):
class Leather_clothUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Leather_cloth
form_class = Leather_clothForm
template_name = "wf/leather_cloth/leather_cloth_update.html"
@@ -4099,6 +5360,12 @@ def get_context_data(self, **kwargs):
return context
class Leather_clothDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Leather_cloth
success_url = reverse_lazy('leather_cloths')
template_name = "core/delete_general.html"
@@ -4106,11 +5373,20 @@ class Leather_clothDelete(PermissionRequiredMixin, DeleteView):
class Leather_clothListView(generic.ListView):
+ """
+
+ """
model = Leather_cloth
template_name = "wf/leather_cloth/leather_cloth_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('leather_cloths')
def get_context_data(self, **kwargs):
@@ -4127,10 +5403,19 @@ def get_context_data(self, **kwargs):
class Leather_clothListViewAll(generic.ListView):
+ """
+
+ """
model = Leather_cloth
template_name = "wf/leather_cloth/leather_cloth_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('leather_cloths_all')
def get_queryset(self):
@@ -4165,6 +5450,9 @@ def get_context_data(self, **kwargs):
return context
class Leather_clothDetailView(generic.DetailView):
+ """
+
+ """
model = Leather_cloth
template_name = "wf/leather_cloth/leather_cloth_detail.html"
@@ -4212,13 +5500,26 @@ def leather_cloth_meta_download(request):
class ShieldCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Shield
form_class = ShieldForm
template_name = "wf/shield/shield_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('shield-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4233,6 +5534,12 @@ def get_context_data(self, **kwargs):
class ShieldUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Shield
form_class = ShieldForm
template_name = "wf/shield/shield_update.html"
@@ -4247,6 +5554,12 @@ def get_context_data(self, **kwargs):
return context
class ShieldDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Shield
success_url = reverse_lazy('shields')
template_name = "core/delete_general.html"
@@ -4254,11 +5567,20 @@ class ShieldDelete(PermissionRequiredMixin, DeleteView):
class ShieldListView(generic.ListView):
+ """
+
+ """
model = Shield
template_name = "wf/shield/shield_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('shields')
def get_context_data(self, **kwargs):
@@ -4275,10 +5597,19 @@ def get_context_data(self, **kwargs):
class ShieldListViewAll(generic.ListView):
+ """
+
+ """
model = Shield
template_name = "wf/shield/shield_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('shields_all')
def get_queryset(self):
@@ -4313,6 +5644,9 @@ def get_context_data(self, **kwargs):
return context
class ShieldDetailView(generic.DetailView):
+ """
+
+ """
model = Shield
template_name = "wf/shield/shield_detail.html"
@@ -4360,13 +5694,26 @@ def shield_meta_download(request):
class HelmetCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Helmet
form_class = HelmetForm
template_name = "wf/helmet/helmet_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('helmet-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4381,6 +5728,12 @@ def get_context_data(self, **kwargs):
class HelmetUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Helmet
form_class = HelmetForm
template_name = "wf/helmet/helmet_update.html"
@@ -4395,6 +5748,12 @@ def get_context_data(self, **kwargs):
return context
class HelmetDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Helmet
success_url = reverse_lazy('helmets')
template_name = "core/delete_general.html"
@@ -4402,11 +5761,20 @@ class HelmetDelete(PermissionRequiredMixin, DeleteView):
class HelmetListView(generic.ListView):
+ """
+
+ """
model = Helmet
template_name = "wf/helmet/helmet_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('helmets')
def get_context_data(self, **kwargs):
@@ -4423,10 +5791,19 @@ def get_context_data(self, **kwargs):
class HelmetListViewAll(generic.ListView):
+ """
+
+ """
model = Helmet
template_name = "wf/helmet/helmet_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('helmets_all')
def get_queryset(self):
@@ -4461,6 +5838,9 @@ def get_context_data(self, **kwargs):
return context
class HelmetDetailView(generic.DetailView):
+ """
+
+ """
model = Helmet
template_name = "wf/helmet/helmet_detail.html"
@@ -4508,13 +5888,26 @@ def helmet_meta_download(request):
class BreastplateCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Breastplate
form_class = BreastplateForm
template_name = "wf/breastplate/breastplate_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('breastplate-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4529,6 +5922,12 @@ def get_context_data(self, **kwargs):
class BreastplateUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Breastplate
form_class = BreastplateForm
template_name = "wf/breastplate/breastplate_update.html"
@@ -4543,6 +5942,12 @@ def get_context_data(self, **kwargs):
return context
class BreastplateDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Breastplate
success_url = reverse_lazy('breastplates')
template_name = "core/delete_general.html"
@@ -4550,11 +5955,20 @@ class BreastplateDelete(PermissionRequiredMixin, DeleteView):
class BreastplateListView(generic.ListView):
+ """
+
+ """
model = Breastplate
template_name = "wf/breastplate/breastplate_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('breastplates')
def get_context_data(self, **kwargs):
@@ -4571,10 +5985,19 @@ def get_context_data(self, **kwargs):
class BreastplateListViewAll(generic.ListView):
+ """
+
+ """
model = Breastplate
template_name = "wf/breastplate/breastplate_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('breastplates_all')
def get_queryset(self):
@@ -4609,6 +6032,9 @@ def get_context_data(self, **kwargs):
return context
class BreastplateDetailView(generic.DetailView):
+ """
+
+ """
model = Breastplate
template_name = "wf/breastplate/breastplate_detail.html"
@@ -4656,13 +6082,26 @@ def breastplate_meta_download(request):
class Limb_protectionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Limb_protection
form_class = Limb_protectionForm
template_name = "wf/limb_protection/limb_protection_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('limb_protection-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4677,6 +6116,12 @@ def get_context_data(self, **kwargs):
class Limb_protectionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Limb_protection
form_class = Limb_protectionForm
template_name = "wf/limb_protection/limb_protection_update.html"
@@ -4691,6 +6136,12 @@ def get_context_data(self, **kwargs):
return context
class Limb_protectionDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Limb_protection
success_url = reverse_lazy('limb_protections')
template_name = "core/delete_general.html"
@@ -4698,11 +6149,20 @@ class Limb_protectionDelete(PermissionRequiredMixin, DeleteView):
class Limb_protectionListView(generic.ListView):
+ """
+
+ """
model = Limb_protection
template_name = "wf/limb_protection/limb_protection_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('limb_protections')
def get_context_data(self, **kwargs):
@@ -4719,10 +6179,19 @@ def get_context_data(self, **kwargs):
class Limb_protectionListViewAll(generic.ListView):
+ """
+
+ """
model = Limb_protection
template_name = "wf/limb_protection/limb_protection_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('limb_protections_all')
def get_queryset(self):
@@ -4757,6 +6226,9 @@ def get_context_data(self, **kwargs):
return context
class Limb_protectionDetailView(generic.DetailView):
+ """
+
+ """
model = Limb_protection
template_name = "wf/limb_protection/limb_protection_detail.html"
@@ -4804,13 +6276,26 @@ def limb_protection_meta_download(request):
class Scaled_armorCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scaled_armor
form_class = Scaled_armorForm
template_name = "wf/scaled_armor/scaled_armor_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scaled_armor-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4825,6 +6310,12 @@ def get_context_data(self, **kwargs):
class Scaled_armorUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scaled_armor
form_class = Scaled_armorForm
template_name = "wf/scaled_armor/scaled_armor_update.html"
@@ -4839,6 +6330,12 @@ def get_context_data(self, **kwargs):
return context
class Scaled_armorDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Scaled_armor
success_url = reverse_lazy('scaled_armors')
template_name = "core/delete_general.html"
@@ -4846,11 +6343,20 @@ class Scaled_armorDelete(PermissionRequiredMixin, DeleteView):
class Scaled_armorListView(generic.ListView):
+ """
+
+ """
model = Scaled_armor
template_name = "wf/scaled_armor/scaled_armor_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scaled_armors')
def get_context_data(self, **kwargs):
@@ -4867,10 +6373,19 @@ def get_context_data(self, **kwargs):
class Scaled_armorListViewAll(generic.ListView):
+ """
+
+ """
model = Scaled_armor
template_name = "wf/scaled_armor/scaled_armor_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('scaled_armors_all')
def get_queryset(self):
@@ -4905,6 +6420,9 @@ def get_context_data(self, **kwargs):
return context
class Scaled_armorDetailView(generic.DetailView):
+ """
+
+ """
model = Scaled_armor
template_name = "wf/scaled_armor/scaled_armor_detail.html"
@@ -4952,13 +6470,26 @@ def scaled_armor_meta_download(request):
class Laminar_armorCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Laminar_armor
form_class = Laminar_armorForm
template_name = "wf/laminar_armor/laminar_armor_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('laminar_armor-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -4973,6 +6504,12 @@ def get_context_data(self, **kwargs):
class Laminar_armorUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Laminar_armor
form_class = Laminar_armorForm
template_name = "wf/laminar_armor/laminar_armor_update.html"
@@ -4987,6 +6524,12 @@ def get_context_data(self, **kwargs):
return context
class Laminar_armorDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Laminar_armor
success_url = reverse_lazy('laminar_armors')
template_name = "core/delete_general.html"
@@ -4994,11 +6537,20 @@ class Laminar_armorDelete(PermissionRequiredMixin, DeleteView):
class Laminar_armorListView(generic.ListView):
+ """
+
+ """
model = Laminar_armor
template_name = "wf/laminar_armor/laminar_armor_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('laminar_armors')
def get_context_data(self, **kwargs):
@@ -5015,10 +6567,19 @@ def get_context_data(self, **kwargs):
class Laminar_armorListViewAll(generic.ListView):
+ """
+
+ """
model = Laminar_armor
template_name = "wf/laminar_armor/laminar_armor_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('laminar_armors_all')
def get_queryset(self):
@@ -5053,6 +6614,9 @@ def get_context_data(self, **kwargs):
return context
class Laminar_armorDetailView(generic.DetailView):
+ """
+
+ """
model = Laminar_armor
template_name = "wf/laminar_armor/laminar_armor_detail.html"
@@ -5100,13 +6664,26 @@ def laminar_armor_meta_download(request):
class Plate_armorCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Plate_armor
form_class = Plate_armorForm
template_name = "wf/plate_armor/plate_armor_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('plate_armor-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5121,6 +6698,12 @@ def get_context_data(self, **kwargs):
class Plate_armorUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Plate_armor
form_class = Plate_armorForm
template_name = "wf/plate_armor/plate_armor_update.html"
@@ -5135,6 +6718,12 @@ def get_context_data(self, **kwargs):
return context
class Plate_armorDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Plate_armor
success_url = reverse_lazy('plate_armors')
template_name = "core/delete_general.html"
@@ -5142,11 +6731,20 @@ class Plate_armorDelete(PermissionRequiredMixin, DeleteView):
class Plate_armorListView(generic.ListView):
+ """
+
+ """
model = Plate_armor
template_name = "wf/plate_armor/plate_armor_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('plate_armors')
def get_context_data(self, **kwargs):
@@ -5163,10 +6761,19 @@ def get_context_data(self, **kwargs):
class Plate_armorListViewAll(generic.ListView):
+ """
+
+ """
model = Plate_armor
template_name = "wf/plate_armor/plate_armor_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('plate_armors_all')
def get_queryset(self):
@@ -5201,6 +6808,9 @@ def get_context_data(self, **kwargs):
return context
class Plate_armorDetailView(generic.DetailView):
+ """
+
+ """
model = Plate_armor
template_name = "wf/plate_armor/plate_armor_detail.html"
@@ -5248,13 +6858,26 @@ def plate_armor_meta_download(request):
class Small_vessels_canoes_etcCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Small_vessels_canoes_etc
form_class = Small_vessels_canoes_etcForm
template_name = "wf/small_vessels_canoes_etc/small_vessels_canoes_etc_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('small_vessels_canoes_etc-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5269,6 +6892,12 @@ def get_context_data(self, **kwargs):
class Small_vessels_canoes_etcUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Small_vessels_canoes_etc
form_class = Small_vessels_canoes_etcForm
template_name = "wf/small_vessels_canoes_etc/small_vessels_canoes_etc_update.html"
@@ -5283,6 +6912,12 @@ def get_context_data(self, **kwargs):
return context
class Small_vessels_canoes_etcDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Small_vessels_canoes_etc
success_url = reverse_lazy('small_vessels_canoes_etcs')
template_name = "core/delete_general.html"
@@ -5290,11 +6925,20 @@ class Small_vessels_canoes_etcDelete(PermissionRequiredMixin, DeleteView):
class Small_vessels_canoes_etcListView(generic.ListView):
+ """
+
+ """
model = Small_vessels_canoes_etc
template_name = "wf/small_vessels_canoes_etc/small_vessels_canoes_etc_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('small_vessels_canoes_etcs')
def get_context_data(self, **kwargs):
@@ -5311,10 +6955,19 @@ def get_context_data(self, **kwargs):
class Small_vessels_canoes_etcListViewAll(generic.ListView):
+ """
+
+ """
model = Small_vessels_canoes_etc
template_name = "wf/small_vessels_canoes_etc/small_vessels_canoes_etc_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('small_vessels_canoes_etcs_all')
def get_queryset(self):
@@ -5349,6 +7002,9 @@ def get_context_data(self, **kwargs):
return context
class Small_vessels_canoes_etcDetailView(generic.DetailView):
+ """
+
+ """
model = Small_vessels_canoes_etc
template_name = "wf/small_vessels_canoes_etc/small_vessels_canoes_etc_detail.html"
@@ -5396,13 +7052,26 @@ def small_vessels_canoes_etc_meta_download(request):
class Merchant_ships_pressed_into_serviceCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merchant_ships_pressed_into_service
form_class = Merchant_ships_pressed_into_serviceForm
template_name = "wf/merchant_ships_pressed_into_service/merchant_ships_pressed_into_service_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merchant_ships_pressed_into_service-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5417,6 +7086,12 @@ def get_context_data(self, **kwargs):
class Merchant_ships_pressed_into_serviceUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merchant_ships_pressed_into_service
form_class = Merchant_ships_pressed_into_serviceForm
template_name = "wf/merchant_ships_pressed_into_service/merchant_ships_pressed_into_service_update.html"
@@ -5431,6 +7106,12 @@ def get_context_data(self, **kwargs):
return context
class Merchant_ships_pressed_into_serviceDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Merchant_ships_pressed_into_service
success_url = reverse_lazy('merchant_ships_pressed_into_services')
template_name = "core/delete_general.html"
@@ -5438,11 +7119,20 @@ class Merchant_ships_pressed_into_serviceDelete(PermissionRequiredMixin, DeleteV
class Merchant_ships_pressed_into_serviceListView(generic.ListView):
+ """
+
+ """
model = Merchant_ships_pressed_into_service
template_name = "wf/merchant_ships_pressed_into_service/merchant_ships_pressed_into_service_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merchant_ships_pressed_into_services')
def get_context_data(self, **kwargs):
@@ -5459,10 +7149,19 @@ def get_context_data(self, **kwargs):
class Merchant_ships_pressed_into_serviceListViewAll(generic.ListView):
+ """
+
+ """
model = Merchant_ships_pressed_into_service
template_name = "wf/merchant_ships_pressed_into_service/merchant_ships_pressed_into_service_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('merchant_ships_pressed_into_services_all')
def get_queryset(self):
@@ -5497,6 +7196,9 @@ def get_context_data(self, **kwargs):
return context
class Merchant_ships_pressed_into_serviceDetailView(generic.DetailView):
+ """
+
+ """
model = Merchant_ships_pressed_into_service
template_name = "wf/merchant_ships_pressed_into_service/merchant_ships_pressed_into_service_detail.html"
@@ -5544,13 +7246,26 @@ def merchant_ships_pressed_into_service_meta_download(request):
class Specialized_military_vesselCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_military_vessel
form_class = Specialized_military_vesselForm
template_name = "wf/specialized_military_vessel/specialized_military_vessel_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_military_vessel-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5565,6 +7280,12 @@ def get_context_data(self, **kwargs):
class Specialized_military_vesselUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_military_vessel
form_class = Specialized_military_vesselForm
template_name = "wf/specialized_military_vessel/specialized_military_vessel_update.html"
@@ -5579,6 +7300,12 @@ def get_context_data(self, **kwargs):
return context
class Specialized_military_vesselDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Specialized_military_vessel
success_url = reverse_lazy('specialized_military_vessels')
template_name = "core/delete_general.html"
@@ -5586,11 +7313,20 @@ class Specialized_military_vesselDelete(PermissionRequiredMixin, DeleteView):
class Specialized_military_vesselListView(generic.ListView):
+ """
+
+ """
model = Specialized_military_vessel
template_name = "wf/specialized_military_vessel/specialized_military_vessel_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_military_vessels')
def get_context_data(self, **kwargs):
@@ -5607,10 +7343,19 @@ def get_context_data(self, **kwargs):
class Specialized_military_vesselListViewAll(generic.ListView):
+ """
+
+ """
model = Specialized_military_vessel
template_name = "wf/specialized_military_vessel/specialized_military_vessel_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('specialized_military_vessels_all')
def get_queryset(self):
@@ -5645,6 +7390,9 @@ def get_context_data(self, **kwargs):
return context
class Specialized_military_vesselDetailView(generic.DetailView):
+ """
+
+ """
model = Specialized_military_vessel
template_name = "wf/specialized_military_vessel/specialized_military_vessel_detail.html"
@@ -5692,13 +7440,26 @@ def specialized_military_vessel_meta_download(request):
class Settlements_in_a_defensive_positionCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlements_in_a_defensive_position
form_class = Settlements_in_a_defensive_positionForm
template_name = "wf/settlements_in_a_defensive_position/settlements_in_a_defensive_position_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlements_in_a_defensive_position-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5713,6 +7474,12 @@ def get_context_data(self, **kwargs):
class Settlements_in_a_defensive_positionUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlements_in_a_defensive_position
form_class = Settlements_in_a_defensive_positionForm
template_name = "wf/settlements_in_a_defensive_position/settlements_in_a_defensive_position_update.html"
@@ -5727,6 +7494,12 @@ def get_context_data(self, **kwargs):
return context
class Settlements_in_a_defensive_positionDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Settlements_in_a_defensive_position
success_url = reverse_lazy('settlements_in_a_defensive_positions')
template_name = "core/delete_general.html"
@@ -5734,11 +7507,20 @@ class Settlements_in_a_defensive_positionDelete(PermissionRequiredMixin, DeleteV
class Settlements_in_a_defensive_positionListView(generic.ListView):
+ """
+
+ """
model = Settlements_in_a_defensive_position
template_name = "wf/settlements_in_a_defensive_position/settlements_in_a_defensive_position_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlements_in_a_defensive_positions')
def get_context_data(self, **kwargs):
@@ -5755,10 +7537,19 @@ def get_context_data(self, **kwargs):
class Settlements_in_a_defensive_positionListViewAll(generic.ListView):
+ """
+
+ """
model = Settlements_in_a_defensive_position
template_name = "wf/settlements_in_a_defensive_position/settlements_in_a_defensive_position_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('settlements_in_a_defensive_positions_all')
def get_queryset(self):
@@ -5793,6 +7584,9 @@ def get_context_data(self, **kwargs):
return context
class Settlements_in_a_defensive_positionDetailView(generic.DetailView):
+ """
+
+ """
model = Settlements_in_a_defensive_position
template_name = "wf/settlements_in_a_defensive_position/settlements_in_a_defensive_position_detail.html"
@@ -5840,13 +7634,26 @@ def settlements_in_a_defensive_position_meta_download(request):
class Wooden_palisadeCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wooden_palisade
form_class = Wooden_palisadeForm
template_name = "wf/wooden_palisade/wooden_palisade_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wooden_palisade-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -5861,6 +7668,12 @@ def get_context_data(self, **kwargs):
class Wooden_palisadeUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wooden_palisade
form_class = Wooden_palisadeForm
template_name = "wf/wooden_palisade/wooden_palisade_update.html"
@@ -5875,6 +7688,12 @@ def get_context_data(self, **kwargs):
return context
class Wooden_palisadeDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Wooden_palisade
success_url = reverse_lazy('wooden_palisades')
template_name = "core/delete_general.html"
@@ -5882,11 +7701,20 @@ class Wooden_palisadeDelete(PermissionRequiredMixin, DeleteView):
class Wooden_palisadeListView(generic.ListView):
+ """
+
+ """
model = Wooden_palisade
template_name = "wf/wooden_palisade/wooden_palisade_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wooden_palisades')
def get_context_data(self, **kwargs):
@@ -5903,10 +7731,19 @@ def get_context_data(self, **kwargs):
class Wooden_palisadeListViewAll(generic.ListView):
+ """
+
+ """
model = Wooden_palisade
template_name = "wf/wooden_palisade/wooden_palisade_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('wooden_palisades_all')
def get_queryset(self):
@@ -5941,6 +7778,9 @@ def get_context_data(self, **kwargs):
return context
class Wooden_palisadeDetailView(generic.DetailView):
+ """
+
+ """
model = Wooden_palisade
template_name = "wf/wooden_palisade/wooden_palisade_detail.html"
@@ -5988,13 +7828,26 @@ def wooden_palisade_meta_download(request):
class Earth_rampartCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Earth_rampart
form_class = Earth_rampartForm
template_name = "wf/earth_rampart/earth_rampart_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('earth_rampart-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6009,6 +7862,12 @@ def get_context_data(self, **kwargs):
class Earth_rampartUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Earth_rampart
form_class = Earth_rampartForm
template_name = "wf/earth_rampart/earth_rampart_update.html"
@@ -6023,6 +7882,12 @@ def get_context_data(self, **kwargs):
return context
class Earth_rampartDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Earth_rampart
success_url = reverse_lazy('earth_ramparts')
template_name = "core/delete_general.html"
@@ -6030,11 +7895,20 @@ class Earth_rampartDelete(PermissionRequiredMixin, DeleteView):
class Earth_rampartListView(generic.ListView):
+ """
+
+ """
model = Earth_rampart
template_name = "wf/earth_rampart/earth_rampart_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('earth_ramparts')
def get_context_data(self, **kwargs):
@@ -6051,10 +7925,19 @@ def get_context_data(self, **kwargs):
class Earth_rampartListViewAll(generic.ListView):
+ """
+
+ """
model = Earth_rampart
template_name = "wf/earth_rampart/earth_rampart_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('earth_ramparts_all')
def get_queryset(self):
@@ -6089,6 +7972,9 @@ def get_context_data(self, **kwargs):
return context
class Earth_rampartDetailView(generic.DetailView):
+ """
+
+ """
model = Earth_rampart
template_name = "wf/earth_rampart/earth_rampart_detail.html"
@@ -6136,13 +8022,26 @@ def earth_rampart_meta_download(request):
class DitchCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ditch
form_class = DitchForm
template_name = "wf/ditch/ditch_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ditch-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6157,6 +8056,12 @@ def get_context_data(self, **kwargs):
class DitchUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ditch
form_class = DitchForm
template_name = "wf/ditch/ditch_update.html"
@@ -6171,6 +8076,12 @@ def get_context_data(self, **kwargs):
return context
class DitchDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Ditch
success_url = reverse_lazy('ditchs')
template_name = "core/delete_general.html"
@@ -6178,11 +8089,20 @@ class DitchDelete(PermissionRequiredMixin, DeleteView):
class DitchListView(generic.ListView):
+ """
+
+ """
model = Ditch
template_name = "wf/ditch/ditch_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ditchs')
def get_context_data(self, **kwargs):
@@ -6199,10 +8119,19 @@ def get_context_data(self, **kwargs):
class DitchListViewAll(generic.ListView):
+ """
+
+ """
model = Ditch
template_name = "wf/ditch/ditch_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('ditchs_all')
def get_queryset(self):
@@ -6237,6 +8166,9 @@ def get_context_data(self, **kwargs):
return context
class DitchDetailView(generic.DetailView):
+ """
+
+ """
model = Ditch
template_name = "wf/ditch/ditch_detail.html"
@@ -6284,13 +8216,26 @@ def ditch_meta_download(request):
class MoatCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Moat
form_class = MoatForm
template_name = "wf/moat/moat_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('moat-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6305,6 +8250,12 @@ def get_context_data(self, **kwargs):
class MoatUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Moat
form_class = MoatForm
template_name = "wf/moat/moat_update.html"
@@ -6319,6 +8270,12 @@ def get_context_data(self, **kwargs):
return context
class MoatDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Moat
success_url = reverse_lazy('moats')
template_name = "core/delete_general.html"
@@ -6326,11 +8283,20 @@ class MoatDelete(PermissionRequiredMixin, DeleteView):
class MoatListView(generic.ListView):
+ """
+
+ """
model = Moat
template_name = "wf/moat/moat_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('moats')
def get_context_data(self, **kwargs):
@@ -6347,10 +8313,19 @@ def get_context_data(self, **kwargs):
class MoatListViewAll(generic.ListView):
+ """
+
+ """
model = Moat
template_name = "wf/moat/moat_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('moats_all')
def get_queryset(self):
@@ -6385,6 +8360,9 @@ def get_context_data(self, **kwargs):
return context
class MoatDetailView(generic.DetailView):
+ """
+
+ """
model = Moat
template_name = "wf/moat/moat_detail.html"
@@ -6432,13 +8410,26 @@ def moat_meta_download(request):
class Stone_walls_non_mortaredCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_non_mortared
form_class = Stone_walls_non_mortaredForm
template_name = "wf/stone_walls_non_mortared/stone_walls_non_mortared_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_non_mortared-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6453,6 +8444,12 @@ def get_context_data(self, **kwargs):
class Stone_walls_non_mortaredUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_non_mortared
form_class = Stone_walls_non_mortaredForm
template_name = "wf/stone_walls_non_mortared/stone_walls_non_mortared_update.html"
@@ -6467,6 +8464,12 @@ def get_context_data(self, **kwargs):
return context
class Stone_walls_non_mortaredDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_non_mortared
success_url = reverse_lazy('stone_walls_non_mortareds')
template_name = "core/delete_general.html"
@@ -6474,11 +8477,20 @@ class Stone_walls_non_mortaredDelete(PermissionRequiredMixin, DeleteView):
class Stone_walls_non_mortaredListView(generic.ListView):
+ """
+
+ """
model = Stone_walls_non_mortared
template_name = "wf/stone_walls_non_mortared/stone_walls_non_mortared_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_non_mortareds')
def get_context_data(self, **kwargs):
@@ -6495,10 +8507,19 @@ def get_context_data(self, **kwargs):
class Stone_walls_non_mortaredListViewAll(generic.ListView):
+ """
+
+ """
model = Stone_walls_non_mortared
template_name = "wf/stone_walls_non_mortared/stone_walls_non_mortared_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_non_mortareds_all')
def get_queryset(self):
@@ -6533,6 +8554,9 @@ def get_context_data(self, **kwargs):
return context
class Stone_walls_non_mortaredDetailView(generic.DetailView):
+ """
+
+ """
model = Stone_walls_non_mortared
template_name = "wf/stone_walls_non_mortared/stone_walls_non_mortared_detail.html"
@@ -6580,13 +8604,26 @@ def stone_walls_non_mortared_meta_download(request):
class Stone_walls_mortaredCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_mortared
form_class = Stone_walls_mortaredForm
template_name = "wf/stone_walls_mortared/stone_walls_mortared_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_mortared-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6601,6 +8638,12 @@ def get_context_data(self, **kwargs):
class Stone_walls_mortaredUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_mortared
form_class = Stone_walls_mortaredForm
template_name = "wf/stone_walls_mortared/stone_walls_mortared_update.html"
@@ -6615,6 +8658,12 @@ def get_context_data(self, **kwargs):
return context
class Stone_walls_mortaredDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Stone_walls_mortared
success_url = reverse_lazy('stone_walls_mortareds')
template_name = "core/delete_general.html"
@@ -6622,11 +8671,20 @@ class Stone_walls_mortaredDelete(PermissionRequiredMixin, DeleteView):
class Stone_walls_mortaredListView(generic.ListView):
+ """
+
+ """
model = Stone_walls_mortared
template_name = "wf/stone_walls_mortared/stone_walls_mortared_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_mortareds')
def get_context_data(self, **kwargs):
@@ -6643,10 +8701,19 @@ def get_context_data(self, **kwargs):
class Stone_walls_mortaredListViewAll(generic.ListView):
+ """
+
+ """
model = Stone_walls_mortared
template_name = "wf/stone_walls_mortared/stone_walls_mortared_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('stone_walls_mortareds_all')
def get_queryset(self):
@@ -6681,6 +8748,9 @@ def get_context_data(self, **kwargs):
return context
class Stone_walls_mortaredDetailView(generic.DetailView):
+ """
+
+ """
model = Stone_walls_mortared
template_name = "wf/stone_walls_mortared/stone_walls_mortared_detail.html"
@@ -6728,13 +8798,26 @@ def stone_walls_mortared_meta_download(request):
class Fortified_campCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Fortified_camp
form_class = Fortified_campForm
template_name = "wf/fortified_camp/fortified_camp_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fortified_camp-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6749,6 +8832,12 @@ def get_context_data(self, **kwargs):
class Fortified_campUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Fortified_camp
form_class = Fortified_campForm
template_name = "wf/fortified_camp/fortified_camp_update.html"
@@ -6763,6 +8852,9 @@ def get_context_data(self, **kwargs):
return context
class Fortified_campDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+ """
model = Fortified_camp
success_url = reverse_lazy('fortified_camps')
template_name = "core/delete_general.html"
@@ -6770,11 +8862,20 @@ class Fortified_campDelete(PermissionRequiredMixin, DeleteView):
class Fortified_campListView(generic.ListView):
+ """
+
+ """
model = Fortified_camp
template_name = "wf/fortified_camp/fortified_camp_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fortified_camps')
def get_context_data(self, **kwargs):
@@ -6791,10 +8892,19 @@ def get_context_data(self, **kwargs):
class Fortified_campListViewAll(generic.ListView):
+ """
+
+ """
model = Fortified_camp
template_name = "wf/fortified_camp/fortified_camp_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('fortified_camps_all')
def get_queryset(self):
@@ -6829,6 +8939,9 @@ def get_context_data(self, **kwargs):
return context
class Fortified_campDetailView(generic.DetailView):
+ """
+
+ """
model = Fortified_camp
template_name = "wf/fortified_camp/fortified_camp_detail.html"
@@ -6876,13 +8989,23 @@ def fortified_camp_meta_download(request):
class Complex_fortificationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+ """
model = Complex_fortification
form_class = Complex_fortificationForm
template_name = "wf/complex_fortification/complex_fortification_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('complex_fortification-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -6897,6 +9020,12 @@ def get_context_data(self, **kwargs):
class Complex_fortificationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Complex_fortification
form_class = Complex_fortificationForm
template_name = "wf/complex_fortification/complex_fortification_update.html"
@@ -6911,6 +9040,9 @@ def get_context_data(self, **kwargs):
return context
class Complex_fortificationDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+ """
model = Complex_fortification
success_url = reverse_lazy('complex_fortifications')
template_name = "core/delete_general.html"
@@ -6918,11 +9050,20 @@ class Complex_fortificationDelete(PermissionRequiredMixin, DeleteView):
class Complex_fortificationListView(generic.ListView):
+ """
+
+ """
model = Complex_fortification
template_name = "wf/complex_fortification/complex_fortification_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('complex_fortifications')
def get_context_data(self, **kwargs):
@@ -6939,10 +9080,19 @@ def get_context_data(self, **kwargs):
class Complex_fortificationListViewAll(generic.ListView):
+ """
+
+ """
model = Complex_fortification
template_name = "wf/complex_fortification/complex_fortification_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('complex_fortifications_all')
def get_queryset(self):
@@ -6977,6 +9127,9 @@ def get_context_data(self, **kwargs):
return context
class Complex_fortificationDetailView(generic.DetailView):
+ """
+
+ """
model = Complex_fortification
template_name = "wf/complex_fortification/complex_fortification_detail.html"
@@ -7024,13 +9177,23 @@ def complex_fortification_meta_download(request):
class Modern_fortificationCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+ """
model = Modern_fortification
form_class = Modern_fortificationForm
template_name = "wf/modern_fortification/modern_fortification_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('modern_fortification-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -7045,6 +9208,12 @@ def get_context_data(self, **kwargs):
class Modern_fortificationUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Modern_fortification
form_class = Modern_fortificationForm
template_name = "wf/modern_fortification/modern_fortification_update.html"
@@ -7059,6 +9228,9 @@ def get_context_data(self, **kwargs):
return context
class Modern_fortificationDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+ """
model = Modern_fortification
success_url = reverse_lazy('modern_fortifications')
template_name = "core/delete_general.html"
@@ -7066,11 +9238,20 @@ class Modern_fortificationDelete(PermissionRequiredMixin, DeleteView):
class Modern_fortificationListView(generic.ListView):
+ """
+
+ """
model = Modern_fortification
template_name = "wf/modern_fortification/modern_fortification_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('modern_fortifications')
def get_context_data(self, **kwargs):
@@ -7087,10 +9268,19 @@ def get_context_data(self, **kwargs):
class Modern_fortificationListViewAll(generic.ListView):
+ """
+
+ """
model = Modern_fortification
template_name = "wf/modern_fortification/modern_fortification_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('modern_fortifications_all')
def get_queryset(self):
@@ -7125,6 +9315,9 @@ def get_context_data(self, **kwargs):
return context
class Modern_fortificationDetailView(generic.DetailView):
+ """
+
+ """
model = Modern_fortification
template_name = "wf/modern_fortification/modern_fortification_detail.html"
@@ -7172,13 +9365,23 @@ def modern_fortification_meta_download(request):
class ChainmailCreate(PermissionRequiredMixin, PolityIdMixin, CreateView):
+ """
+
+ """
model = Chainmail
form_class = ChainmailForm
template_name = "wf/chainmail/chainmail_form.html"
permission_required = 'core.add_capital'
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('chainmail-create')
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
# get the explanattion:
@@ -7193,6 +9396,12 @@ def get_context_data(self, **kwargs):
class ChainmailUpdate(PermissionRequiredMixin, UpdateView):
+ """
+
+
+ Note:
+ This view is restricted to users with the 'add_capital' permission.
+ """
model = Chainmail
form_class = ChainmailForm
template_name = "wf/chainmail/chainmail_update.html"
@@ -7207,6 +9416,9 @@ def get_context_data(self, **kwargs):
return context
class ChainmailDelete(PermissionRequiredMixin, DeleteView):
+ """
+
+ """
model = Chainmail
success_url = reverse_lazy('chainmails')
template_name = "core/delete_general.html"
@@ -7214,11 +9426,20 @@ class ChainmailDelete(PermissionRequiredMixin, DeleteView):
class ChainmailListView(generic.ListView):
+ """
+
+ """
model = Chainmail
template_name = "wf/chainmail/chainmail_list.html"
paginate_by = 10
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('chainmails')
def get_context_data(self, **kwargs):
@@ -7235,10 +9456,19 @@ def get_context_data(self, **kwargs):
class ChainmailListViewAll(generic.ListView):
+ """
+
+ """
model = Chainmail
template_name = "wf/chainmail/chainmail_list_all.html"
def get_absolute_url(self):
+ """
+ Get the absolute URL of the view.
+
+ Returns:
+ str: The absolute URL of the view.
+ """
return reverse('chainmails_all')
def get_queryset(self):
@@ -7273,6 +9503,9 @@ def get_context_data(self, **kwargs):
return context
class ChainmailDetailView(generic.DetailView):
+ """
+
+ """
model = Chainmail
template_name = "wf/chainmail/chainmail_detail.html"
@@ -7411,22 +9644,22 @@ def show_problematic_wf_data_table(request):
return render(request, 'wf/problematic_wf_data_table.html', {'data': data})
-@permission_required('core.view_capital')
-def show_problematic_wf_data_table(request):
- # Fetch all models in the "socomp" app
- app_name = 'wf' # Replace with your app name
- app_models = apps.get_app_config(app_name).get_models()
+# @permission_required('core.view_capital')
+# def show_problematic_wf_data_table(request):
+# # Fetch all models in the "socomp" app
+# app_name = 'wf' # Replace with your app name
+# app_models = apps.get_app_config(app_name).get_models()
- # Collect data from all models
- data = []
- for model in app_models:
- items = model.objects.all()
- for obj in items:
- if obj.polity.start_year is not None and obj.year_from is not None and obj.polity.start_year > obj.year_from:
- data.append(obj)
+# # Collect data from all models
+# data = []
+# for model in app_models:
+# items = model.objects.all()
+# for obj in items:
+# if obj.polity.start_year is not None and obj.year_from is not None and obj.polity.start_year > obj.year_from:
+# data.append(obj)
- # Render the template with the data
- return render(request, 'wf/problematic_wf_data_table.html', {'data': data})
+# # Render the template with the data
+# return render(request, 'wf/problematic_wf_data_table.html', {'data': data})
@permission_required('core.view_capital')
diff --git a/seshat/asgi.py b/seshat/asgi.py
index b901c4ff5..20d0abd14 100644
--- a/seshat/asgi.py
+++ b/seshat/asgi.py
@@ -1,5 +1,4 @@
-"""
-ASGI config for seshat project.
+"""ASGI config for seshat project.
It exposes the ASGI callable as a module-level variable named ``application``.
diff --git a/seshat/settings/base.py b/seshat/settings/base.py
index a1f7f70ff..3b458e60d 100644
--- a/seshat/settings/base.py
+++ b/seshat/settings/base.py
@@ -1,3 +1,11 @@
+"""
+The base settings for the Seshat project.
+
+They are used by the development and production environment settings,
+available in :doc:`/api/seshat/settings/local/index` and
+:doc:`/api/seshat/settings/production/index`.
+"""
+
from pathlib import Path
######EMAIL_CONFIRMATION_BRANCH is the keyword that needs to be searched
@@ -7,6 +15,7 @@
import dj_database_url
from decouple import Csv, config
+import sys
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
@@ -17,6 +26,8 @@
messages.ERROR: 'alert-danger',
}
+local_env_path = str(Path.cwd()) + "/seshat/settings/.env"
+
# base_dir is calculated based on this file (base.py) and then goes to parents above.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -73,8 +84,9 @@
'allauth.socialaccount',
#'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.google',
+ 'django.contrib.gis',
+ 'leaflet',
#'easyaudit',
- 'django_recaptcha',
]
AUTHENTICATION_BACKENDS = [
@@ -87,9 +99,10 @@
]
-
-RECAPTCHA_PUBLIC_KEY = config('GOOGLE_RECAPTCHA_SITE_KEY')
-RECAPTCHA_PRIVATE_KEY = config('GOOGLE_RECAPTCHA_SECRET_KEY')
+if not os.path.exists(local_env_path) and not os.getenv('GITHUB_ACTIONS') == 'true':
+ RECAPTCHA_PUBLIC_KEY = config('GOOGLE_RECAPTCHA_SITE_KEY')
+ RECAPTCHA_PRIVATE_KEY = config('GOOGLE_RECAPTCHA_SECRET_KEY')
+ INSTALLED_APPS.append('django_recaptcha')
# all-auth
LOGIN_REDIRECT_URL = 'seshat-index'
@@ -113,34 +126,39 @@
#SOCIALACCOUNT_AUTO_SIGNUP = False
-SOCIALACCOUNT_PROVIDERS = {
- 'google': {
- 'APP': {
- 'client_id': config('GOOGLE_APP_CLIENT_ID'),
- 'secret': config('GOOGLE_APP_SECRET_KEY'),
- 'redirect_uris': ['https://seshat-db.com/accounts/google/login/callback/'],
- # 'key': ''
- },
-
- 'SCOPE': [
- 'profile',
- 'email',
- ],
- 'AUTH_PARAMS': {
- 'access_type': 'online',
+if not os.path.exists(local_env_path) and not os.getenv('GITHUB_ACTIONS') == 'true':
+ SOCIALACCOUNT_PROVIDERS = {
+ 'google': {
+ 'APP': {
+ 'client_id': config('GOOGLE_APP_CLIENT_ID'),
+ 'secret': config('GOOGLE_APP_SECRET_KEY'),
+ 'redirect_uris': ['https://seshat-db.com/accounts/google/login/callback/'],
+ # 'key': ''
+ },
+
+ 'SCOPE': [
+ 'profile',
+ 'email',
+ ],
+ 'AUTH_PARAMS': {
+ 'access_type': 'online',
+ }
}
}
-}
+ """SOCIALACCOUNT_PROVIDERS defines the social account providers for the Django all-auth package."""
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
+"""DEFAULT_AUTO_FIELD is set to `django.db.models.BigAutoField`."""
#ROOT_URLCONF = "urls"
ROOT_URLCONF = "seshat.urls"
-
+"""ROOT_URLCONF is set to the URL configuration for the Seshat project."""
INTERNAL_IPS = ["127.0.0.1"]
+"""INTERNAL_IPS defines the list of IP addresses that are allowed to visit the debug toolbar."""
WSGI_APPLICATION = "seshat.wsgi.application"
+"""WSGI_APPLICATION is set to the WSGI application for the Seshat project."""
#AUTH_USER_MODEL = 'accounts.CustomUser'
@@ -161,6 +179,7 @@
"whitenoise.middleware.WhiteNoiseMiddleware",
]
+"""MIDDLEWARE defines the list of middleware classes that Django will use."""
#DJANGO_EASY_AUDIT_REGISTERED_CLASSES = ['sc.script']
@@ -184,6 +203,7 @@
},
},
]
+"""TEMPLATES defines the list of engines that Django can use to render templates."""
# ==============================================================================
@@ -200,16 +220,21 @@
# DATABASES['default'].update(db_from_env)
# Qing data database
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql',
- 'NAME': config('DB_NAME'),
- 'USER': config('DB_USER'),
- 'PASSWORD': config('DB_PASSWORD'),
- 'HOST': 'localhost',
- 'PORT': 5432,
+if not os.path.exists(local_env_path) and not os.getenv('GITHUB_ACTIONS') == 'true':
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.contrib.gis.db.backends.postgis',
+ 'NAME': config('DB_NAME'),
+ 'USER': config('DB_USER'),
+ 'PASSWORD': config('DB_PASSWORD'),
+ 'HOST': 'localhost',
+ 'PORT': 5432,
+ }
}
-}
+ """
+ Database settings for local development.
+ """
+
#DATABASES['default'] = dj_database_url.config(conn_max_age=600)
# ==============================================================================
@@ -230,11 +255,13 @@
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
-
+"""
+AUTH_PASSWORD_VALIDATORS defines the validators that are used to check the strength of passwords.
+"""
CSRF_TRUSTED_ORIGINS = ['https://majidbenam.com', 'http://*.majidbenam.com', 'http://majidbenam.com',
'https://seshatdb.herokuapp.com', 'http://seshatdb.herokuapp.com', 'https://*.majidbenam.com', ] # the most important one is the last one.
-
+"""CSRF_TRUSTED_ORIGINS defines the trusted origins for Cross-Site Request Forgery (CSRF) protection."""
#USE_X_FORWARDED_HOST = True
#SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
@@ -243,24 +270,37 @@
# ==============================================================================
LANGUAGE_CODE = config("LANGUAGE_CODE", default="en-us")
+"""LANGUAGE_CODE is set to en-us by default."""
TIME_ZONE = config("TIME_ZONE", default="UTC")
+"""TIME_ZONE is set to UTC by default."""
USE_I18N = True
+"""USE_I18N is set to True to enable internationalization."""
USE_L10N = True
+"""USE_L10N is set to True to enable localization."""
USE_TZ = True
+"""USE_TZ is set to True to enable time zone support."""
LOCALE_PATHS = [BASE_DIR / "locale"]
+"""LOCALE_PATHS defines the directories in which Django will search for translation files."""
# Email config BACKUP:
-EMAIL_FROM_USER = config('EMAIL_FROM_USER')
-EMAIL_HOST = config('EMAIL_HOST')
-EMAIL_HOST_USER = config('EMAIL_HOST_USER')
-EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
-EMAIL_USE_TLS = True
-EMAIL_PORT = 587
+if not os.path.exists(local_env_path) and not os.getenv('GITHUB_ACTIONS') == 'true':
+ EMAIL_FROM_USER = config('EMAIL_FROM_USER')
+ """The email address from which the emails will be sent."""
+ EMAIL_HOST = config('EMAIL_HOST')
+ """The email host."""
+ EMAIL_HOST_USER = config('EMAIL_HOST_USER')
+ """The email host user."""
+ EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
+ """The email host password."""
+ EMAIL_USE_TLS = True
+ """Defines whether email will use TLS."""
+ EMAIL_PORT = 587
+ """The email port."""
######EMAIL_CONFIRMATION_BRANCH is the keyword that needs to be searched
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
@@ -276,14 +316,22 @@
# ==============================================================================
#STATIC_URL = "/static/"
-# this is all browser stuff, what you need to type in the address bar to see the image and stuff
+# this is all browser stuff, what you need to type in the address bar to see the image and stuff
STATIC_URL = "static/"
-
+"""
+The URL to use when referring to static files located in the `static` directory.
+"""
# this is not needed: the actual value is the default valu:
# /home/majid/dev/seshat/seshat/seshat/staticfiles
# and the files are actually stored there when we COLLECTSTATIC them
STATIC_ROOT = BASE_DIR.parent.parent / "static"
+"""
+The absolute path to the directory where `collectstatic` will collect static files for deployment.
+
+Note:
+ The value set here is the `static` directory in the base directory of the project.
+"""
#STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
@@ -292,11 +340,23 @@
# I believe this says: anything under the base directory that is inside a directory called 'static' will be collected as statidfile,
# regardless of how deep down in the directory hierarchy it might be. It just needs to be a in a older called media in any of the apps, etc.
STATICFILES_DIRS = [BASE_DIR / "static"]
-#print(STATICFILES_DIRS)
+"""
+Defines the directories in which Django will search for additional static files.
+"""
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
+"""
+The static files storage is set to the whitenoise storage, which is a compressed manifest static files storage.
+"""
+
#STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
+if 'test' in sys.argv:
+ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
+ """The static files storage is set to the Django static files storage for testing environments.
+
+ :noindex:
+ """
# We might need to turn these on in production!
# STATICFILES_FINDERS = (
@@ -310,8 +370,10 @@
# ==============================================================================
MEDIA_URL = "/media/"
+"""The URL to use when referring to media files located in the `media` directory."""
MEDIA_ROOT = BASE_DIR.parent.parent / "media"
+"""The absolute path to the directory where uploaded files will be saved."""
# ==============================================================================
@@ -324,13 +386,19 @@
# ==============================================================================
SESHAT_ENVIRONMENT = config("SESHAT_ENVIRONMENT", default="local")
+"""
+The environment in which the Seshat application is running.
+Note:
+ The value is set to `local` by default. This value can be changed in the
+ environment variable SESHAT_ENVIRONMENT.
+"""
# =================
# Login Redirect
# =================
-LOGIN_REDIRECT_URL = 'seshat-index'
+# LOGIN_REDIRECT_URL = 'seshat-index' # (see L100 above)
# REST Framework
@@ -341,11 +409,18 @@
'rest_framework.permissions.AllowAny',
],
}
+"""
+REST_FRAMEWORK defines the default settings for the Django REST framework.
+
+The default pagination class is set to `PageNumberPagination` with a page size
+of 1000.
+"""
# CORS ALLOWED ORIGINS
CORS_ALLOWED_ORIGINS = [
"http://localhost:3000", "http://127.0.0.1:3000",
]
+"""CORS_ALLOWED_ORIGINS defines the allowed origins for Cross-Origin Resource Sharing (CORS)."""
# =================
# Logout Redirect
@@ -357,4 +432,25 @@
#print("###################")
#print(STATICFILES_DIRS)
#print(STATIC_ROOT)
-#print(STATIC_URL)
\ No newline at end of file
+#print(STATIC_URL)
+
+# Geospatial stuff: modify the paths to the libraries for your system setup
+GEOGRAPHIC_DB = True
+"""GEOGRAPHIC_DB is set to True to enable the geographic database."""
+
+if sys.platform.startswith('darwin'): # macOS
+ GDAL_LIBRARY_PATH = '/opt/homebrew/opt/gdal/lib/libgdal.dylib'
+ GEOS_LIBRARY_PATH = '/opt/homebrew/opt/geos/lib/libgeos_c.dylib'
+else: # linux
+ GDAL_LIBRARY_PATH = '/usr/lib/libgdal.so'
+ if os.getenv('GITHUB_ACTIONS') == 'true':
+ GEOS_LIBRARY_PATH = '/usr/lib/x86_64-linux-gnu/libgeos_c.so'
+ else:
+ # TODO: find a way to specify this based on the VM: aarch64 or x86_64
+ # GEOS_LIBRARY_PATH = '/usr/lib/aarch64-linux-gnu/libgeos_c.so'
+ GEOS_LIBRARY_PATH = '/usr/lib/x86_64-linux-gnu/libgeos_c.so'
+
+SECURE_CROSS_ORIGIN_OPENER_POLICY = None
+"""
+SECURE_CROSS_ORIGIN_OPENER_POLICY is set to None to disable the Cross-Origin Opener Policy.
+"""
diff --git a/seshat/settings/local.py b/seshat/settings/local.py
index 3fe6f781f..cc8cff03c 100644
--- a/seshat/settings/local.py
+++ b/seshat/settings/local.py
@@ -1,24 +1,56 @@
+"""
+Settings for local development of the Seshat project.
+"""
+
# flake8: noqa
from .base import *
-
-#INSTALLED_APPS += ["debug_toolbar"]
+import environ
+import os
+import sys
#MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
#MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
-
# Databases
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
- 'NAME': config('DB_NAME'),
- 'USER': config('DB_USER'),
- 'PASSWORD': config('DB_PASSWORD'),
- 'HOST': config('DB_HOST'),
- 'PORT': '',
+# We use the local database for development and the GitHub Actions database for testing
+if os.getenv('GITHUB_ACTIONS') == 'true':
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.contrib.gis.db.backends.postgis',
+ 'NAME': 'github_actions',
+ 'USER': 'postgres',
+ 'HOST': 'localhost',
+ 'PORT': '5432',
+ 'PASSWORD': 'postgres'
+ }
}
-}
+ """
+ Database settings for GitHub Actions.
+
+ :noindex:
+ """
+else:
+
+ # Initialise environment variables
+ env = environ.Env()
+ environ.Env.read_env()
+
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.contrib.gis.db.backends.postgis',
+ 'NAME': env('NAME'),
+ 'USER': 'postgres',
+ 'HOST': env('HOST'),
+ 'PORT': env('PORT'),
+ 'PASSWORD': env('PASSWORD')
+ }
+ }
+ """
+ Database settings for local development.
+
+ :noindex:
+ """
django_settings_module = os.environ.get('DJANGO_SETTINGS_MODULE')
@@ -32,4 +64,16 @@
#EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
######EMAIL_CONFIRMATION_BRANCH is the keyword that needs to be searched
-EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
\ No newline at end of file
+#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
+
+ALLOWED_HOSTS = ['127.0.0.1',
+ 'localhost']
+"""Set ALLOWED_HOSTS to allow the server to run without a domain name for local testing."""
+
+if 'test' in sys.argv:
+ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
+ """
+ Specifies static files storage for testing environments.
+
+ :noindex:
+ """
\ No newline at end of file
diff --git a/seshat/settings/production.py b/seshat/settings/production.py
index 7f82f2c29..4206d131c 100644
--- a/seshat/settings/production.py
+++ b/seshat/settings/production.py
@@ -1,3 +1,7 @@
+"""
+Settings for production development of the Seshat project.
+"""
+
# flake8: noqa
# import sentry_sdk
@@ -38,3 +42,7 @@
# Secret Key
SECRET_KEY = config('SECRET_KEY')
+"""
+Set the secret key for the production environment.
+:noindex:
+"""
diff --git a/seshat/urls.py b/seshat/urls.py
index 65826b665..cf44b942c 100644
--- a/seshat/urls.py
+++ b/seshat/urls.py
@@ -1,17 +1,7 @@
"""seshat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/3.2/topics/http/urls/
-Examples:
-Function views
- 1. Add an import: from my_app import views
- 2. Add a URL to urlpatterns: path('', views.home, name='home')
-Class-based views
- 1. Add an import: from other_app.views import Home
- 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
-Including another URLconf
- 1. Import the include() function: from django.urls import include, path
- 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+https://docs.djangoproject.com/en/3.2/topics/http/urls/
"""
from django.contrib import admin
from django.urls import path, include
diff --git a/seshat/utils/utils.py b/seshat/utils/utils.py
index b6418f619..01a2cef46 100644
--- a/seshat/utils/utils.py
+++ b/seshat/utils/utils.py
@@ -1,8 +1,9 @@
-from seshat.apps.core.models import Polity, Variablehierarchy
-from seshat.apps.crisisdb.models import *
+from seshat.apps.core.models import Polity, Variablehierarchy, Section, Subsection
+# from seshat.apps.crisisdb.models import *
import django.apps
import pprint
from seshat.apps.crisisdb.models import Crisis_consequence, Power_transition, Human_sacrifice
+# from seshat.apps.crisisdb.models import Us_location, Us_violence_subtype, Us_violence_data_source, Us_violence, External_conflict, Internal_conflict, External_conflict_side, Agricultural_population, Arable_land, Arable_land_per_farmer, Gross_grain_shared_per_agricultural_population, Net_grain_shared_per_agricultural_population, Surplus, Military_expense, Silver_inflow, Silver_stock, Total_population, Gdp_per_capita, Drought_event, Locust_event, Socioeconomic_turmoil_event, Crop_failure_event, Famine_event, Disease_outbreak
from django.contrib.contenttypes.models import ContentType
from django.apps import apps
@@ -19,14 +20,43 @@
"internal_conflict": {"notes": "This is a new model definition fror internal conflicts", "main_desc": "Main Descriptions for the Variable internal_conflict are missing!", "main_desc_source": "", "cols": 4, "section": "Conflict Variables", "subsection": "Internal Conflicts Subsection", "null_meaning": "The value is not available.", "col1": {"dtype": ["CharField", "TextInput"], "varname": "conflict", "var_exp": "The name of the conflict", "var_exp_source": None}, "col2": {"dtype": ["DecimalField", "NumberInput"], "varname": "expenditure", "var_exp": "The military expenses in millions silver taels.", "units": "millions silver taels", "min": None, "max": None, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}, "col3": {"dtype": ["CharField", "TextInput"], "varname": "leader", "var_exp": "The leader of the conflict", "var_exp_source": None}, "col4": {"dtype": ["IntegerField", "NumberInput"], "varname": "casualty", "var_exp": "The number of people who died in this conflict.", "units": "People", "min": None, "max": None, "scale": 1, "var_exp_source": None}}, "external_conflict_side": {"notes": "This is a new model definition fror External conflict sides", "main_desc": "Main Descriptions for the Variable external_conflict_side are missing!", "main_desc_source": "", "cols": 4, "section": "Conflict Variables", "subsection": "External Conflicts Subsection", "null_meaning": "The value is not available.", "col1": {"dtype": ["CharField", "TextInput"], "varname": "conflict", "var_exp": "The unique name of the conflict", "var_exp_source": None}, "col2": {"dtype": ["DecimalField", "NumberInput"], "varname": "expenditure", "var_exp": "The military expenses (from this side) in silver taels.", "units": "silver taels", "min": None, "max": None, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}, "col3": {"dtype": ["CharField", "TextInput"], "varname": "leader", "var_exp": "The leader of this side of conflict", "var_exp_source": None}, "col4": {"dtype": ["IntegerField", "NumberInput"], "varname": "casualty", "var_exp": "The number of people who died (from this side) in this conflict.", "units": "People", "min": None, "max": None, "scale": 1, "var_exp_source": None}},
"agricultural_population": {"notes": "Notes for the Variable agricultural_population are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "agricultural_population", "var_exp": "No Explanations.", "units": "People", "min": 0, "max": None, "scale": 1000, "var_exp_source": None}}, "arable_land": {"notes": "Notes for the Variable arable_land are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "arable_land", "var_exp": "No Explanations.", "units": "mu?", "min": None, "max": None, "scale": 1000, "var_exp_source": None}}, "arable_land_per_farmer": {"notes": "Notes for the Variable arable_land_per_farmer are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "arable_land_per_farmer", "var_exp": "No Explanations.", "units": "mu?", "min": None, "max": None, "scale": 1, "var_exp_source": None}}, "gross_grain_shared_per_agricultural_population": {"notes": "Notes for the Variable gross_grain_shared_per_agricultural_population are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "gross_grain_shared_per_agricultural_population", "var_exp": "No Explanations.", "units": "(catties per capita)", "min": None, "max": None, "scale": 1, "var_exp_source": None}}, "net_grain_shared_per_agricultural_population": {"notes": "Notes for the Variable net_grain_shared_per_agricultural_population are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "net_grain_shared_per_agricultural_population", "var_exp": "No Explanations.", "units": "(catties per capita)", "min": None, "max": None, "scale": 1, "var_exp_source": None}}, "surplus": {"notes": "Notes for the Variable surplus are missing!", "main_desc": "No Explanations.", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "surplus", "var_exp": "No Explanations.", "units": "(catties per capita)", "min": None, "max": None, "scale": 1, "var_exp_source": None}}, "military_expense": {"notes": "Not sure about Section and Subsection.", "main_desc": "Main Descriptions for the Variable military_expense are missing!", "main_desc_source": "https://en.wikipedia.org/wiki/Disease_outbreak", "cols": 2, "section": "Economy Variables", "subsection": "State Finances", "null_meaning": "The value is not available.", "col1": {"dtype": ["CharField", "TextInput"], "varname": "conflict", "var_exp": "The name of the conflict", "var_exp_source": None}, "col2": {"dtype": ["DecimalField", "NumberInput"], "varname": "expenditure", "var_exp": "The military expenses in millions silver taels.", "units": "millions silver taels", "min": None, "max": None, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}}, "silver_inflow": {"notes": "Needs suoervision on the units and scale.", "main_desc": "Silver inflow in Millions of silver taels??", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "State Finances", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "silver_inflow", "var_exp": "Silver inflow in Millions of silver taels??", "units": "Millions of silver taels??", "min": None, "max": None, "scale": 1000000, "var_exp_source": None}}, "silver_stock": {"notes": "Needs suoervision on the units and scale.", "main_desc": "Silver stock in Millions of silver taels??", "main_desc_source": "", "cols": 1, "section": "Economy Variables", "subsection": "State Finances", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "silver_stock", "var_exp": "Silver stock in Millions of silver taels??", "units": "Millions of silver taels??", "min": None, "max": None, "scale": 1000000, "var_exp_source": None}}, "total_population": {"notes": "Note that the population values are scaled.", "main_desc": "Total population or simply population, of a given area is the total number of people in that area at a given time.", "main_desc_source": "", "cols": 1, "section": "Social Complexity Variables", "subsection": "Social Scale", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "total_population", "var_exp": "The total population of a country (or a polity).", "units": "People", "min": 0, "max": None, "scale": 1000, "var_exp_source": None}}, "gdp_per_capita": {"notes": "The exact year based on which the value of Dollar is taken into account is not clear.", "main_desc": "The Gross Domestic Product per capita, or GDP per capita, is a measure of a country's economic output that accounts for its number of people. It divides the country's gross domestic product by its total population.", "main_desc_source": "https://www.thebalance.com/gdp-per-capita-formula-u-s-compared-to-highest-and-lowest-3305848", "cols": 1, "section": "Economy Variables", "subsection": "Productivity", "null_meaning": "The value is not available.", "col1": {
"dtype": ["DecimalField", "NumberInput"], "varname": "gdp_per_capita", "var_exp": "The Gross Domestic Product per capita, or GDP per capita, is a measure of a country's economic output that accounts for its number of people. It divides the country's gross domestic product by its total population.", "units": "Dollars (in 2009?)", "min": None, "max": None, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": "https://www.thebalance.com/gdp-per-capita-formula-u-s-compared-to-highest-and-lowest-3305848"}}, "drought_event": {"notes": "Notes for the Variable drought_event are missing!", "main_desc": "number of geographic sites indicating drought", "main_desc_source": "https://www1.ncdc.noaa.gov/pub/data/paleo/historical/asia/china/reaches2020drought-category-sites.txt", "cols": 1, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "drought_event", "var_exp": "number of geographic sites indicating drought", "units": "Numbers", "min": 0, "max": None, "scale": 1, "var_exp_source": None}}, "locust_event": {"notes": "Notes for the Variable locust_event are missing!", "main_desc": "number of geographic sites indicating locusts", "main_desc_source": "https://www1.ncdc.noaa.gov/pub/data/paleo/historical/asia/china/reaches2020drought-category-sites.txt", "cols": 1, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "locust_event", "var_exp": "number of geographic sites indicating locusts", "units": "Numbers", "min": 0, "max": None, "scale": 1, "var_exp_source": None}}, "socioeconomic_turmoil_event": {"notes": "Notes for the Variable socioeconomic_turmoil_event are missing!", "main_desc": "number of geographic sites indicating socioeconomic turmoil", "main_desc_source": "https://www1.ncdc.noaa.gov/pub/data/paleo/historical/asia/china/reaches2020drought-category-sites.txt", "cols": 1, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "socioeconomic_turmoil_event", "var_exp": "number of geographic sites indicating socioeconomic turmoil", "units": "Numbers", "min": 0, "max": None, "scale": 1, "var_exp_source": None}}, "crop_failure_event": {"notes": "Notes for the Variable crop_failure_event are missing!", "main_desc": "number of geographic sites indicating crop failure", "main_desc_source": "https://www1.ncdc.noaa.gov/pub/data/paleo/historical/asia/china/reaches2020drought-category-sites.txt", "cols": 1, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "crop_failure_event", "var_exp": "number of geographic sites indicating crop failure", "units": "Numbers", "min": 0, "max": None, "scale": 1, "var_exp_source": None}}, "famine_event": {"notes": "Notes for the Variable famine_event are missing!", "main_desc": "number of geographic sites indicating famine", "main_desc_source": "https://www1.ncdc.noaa.gov/pub/data/paleo/historical/asia/china/reaches2020drought-category-sites.txt", "cols": 1, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": "The value is not available.", "col1": {"dtype": ["IntegerField", "NumberInput"], "varname": "famine_event", "var_exp": "number of geographic sites indicating famine", "units": "Numbers", "min": 0, "max": None, "scale": 1, "var_exp_source": None}}, "disease_outbreak": {"notes": "Notes for the Variable disease_outbreak are missing!", "main_desc": "A sudden increase in occurrences of a disease when cases are in excess of normal expectancy for the location or season.", "main_desc_source": "https://en.wikipedia.org/wiki/Disease_outbreak", "cols": 6, "section": "Well Being", "subsection": "Biological Well-Being", "null_meaning": 'The value is not available.', "col1": {"dtype": ["DecimalField", "NumberInput"], "varname": "longitude", "var_exp": "The longitude (in degrees) of the place where the disease was spread.", "units": "Degrees", "min": -180, "max": 180, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}, "col2": {"dtype": ["DecimalField", "NumberInput"], "varname": "latitude", "var_exp": "The latitude (in degrees) of the place where the disease was spread.", "units": "Degrees", "min": -180, "max": 180, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}, "col3": {"dtype": ["DecimalField", "NumberInput"], "varname": "elevation", "var_exp": "Elevation from mean sea level (in meters) of the place where the disease was spread.", "units": "Meters", "min": 0, "max": 5000, "scale": 1, "decimal_places": 15, "max_digits": 20, "var_exp_source": None}, "col4": {"dtype": ["CharField", "Select"], "varname": "sub_category", "var_exp": "The category of the disease.", "var_exp_source": None, "choices": ["Peculiar Epidemics", "Pestilence", "Miasm", "Pox", "Uncertain Pestilence", "Dysentery", "Malaria", "Influenza", "Cholera", "Diptheria", "Plague"]}, "col5": {"dtype": ["CharField", "Select"], "varname": "magnitude", "var_exp": "How heavy the disease was.", "var_exp_source": None, "choices": ["Uncertain", "Light", "Heavy", "No description", "Heavy- Multiple Times", "No Happening", "Moderate"]}, "col6": {"dtype": ["CharField", "Select"], "varname": "duration", "var_exp": "How long the disease lasted.", "var_exp_source": None, "choices": ["No description", "Over 90 Days", "Uncertain", "30-60 Days", "1-10 Days", "60-90 Days"]}}}
+"""
+vars_dic_for_utils is a dictionary that contains the definitions of all the variables in the database. It is used to generate the models and views for the variables. It is a dictionary of dictionaries, where the key is the name of the variable and the value is a dictionary that contains the following keys:
+- notes: A description of the variable.
+- main_desc: The main description of the variable.
+- main_desc_source: The source of the main description.
+- cols: The number of columns in the variable.
+- section: The section of the variable.
+- subsection: The subsection of the variable.
+- null_meaning: The meaning of a null value in the variable.
+- col1: A dictionary that contains the definition of the first column of the variable. It contains the following keys:
+ - dtype: The data type of the column.
+ - varname: The name of the column.
+ - var_exp: The explanation of the column.
+ - var_exp_source: The source of the explanation.
+ - units: The units of the column.
+ - min: The minimum value of the column.
+ - max: The maximum value of the column.
+ - scale: The scale of the column.
+ - decimal_places: The number of decimal places in the column.
+ - max_digits: The maximum number of digits in the column.
+- col2: A dictionary that contains the definition of the second column of the variable. It contains the same keys as col1.
+- col3: A dictionary that contains the definition of the third column of the variable. It contains the same keys as col1.
+- col4: A dictionary that contains the definition of the fourth column of the variable. It contains the same keys as col1.
+- col5: A dictionary that contains the definition of the fifth column of the variable. It contains the same keys as col1.
+- col6: A dictionary that contains the definition of the sixth column of the variable. It contains the same keys as col1.
+"""
def list_of_all_Polities():
- '''
- returns all the polity names in the database.
- '''
+ """
+ Returns a list of all polities in the database.
+
+ Returns:
+ list: A list of all polity names.
+ """
all_pols = Polity.objects.all()
pol_names = []
for pol in all_pols:
@@ -34,7 +64,14 @@ def list_of_all_Polities():
return(pol_names)
+
def dic_of_all_vars():
+ """
+ Returns a dictionary of all variables in the database.
+
+ Returns:
+ dict: A dictionary of all variables.
+ """
myvars = django.apps.apps.get_models()
# my_vars = {
# 'total_tax': 'Total Tax',
@@ -59,6 +96,14 @@ def dic_of_all_vars():
def dic_of_all_vars_with_varhier():
+ """
+ Returns a dictionary of all variables in the database. This dictionary is
+ structured in a way that it can be used to generate a hierarchical
+ representation of the variables.
+
+ Returns:
+ dict: A dictionary of all variables.
+ """
my_secs = {'Economy Variables': {'Productivity': ['agricultural_population',
'arable_land',
'arable_land_per_farmer',
@@ -79,6 +124,18 @@ def dic_of_all_vars_with_varhier():
def dic_of_all_vars_in_sections():
+ """
+ Returns a dictionary of all variables in the database. This dictionary is
+ structured in a way that it can be used to generate a hierarchical
+ representation of the variables.
+
+ Note:
+ This function does not seem to be used in the current version of the
+ application.
+
+ Returns:
+ dict: A dictionary of all variables.
+ """
my_vars = {
'finances': {
'total_tax': 'Total Tax',
@@ -94,26 +151,48 @@ def dic_of_all_vars_in_sections():
def adder(a, b):
+ """
+ Adds two numbers together.
+
+ Args:
+ a (int): The first number to be added.
+ b (int): The second number to be added.
+
+ Returns:
+ int: The sum of the two numbers.
+ """
print(a+b)
def section_dic_extractor():
+ """
+ Extracts a dictionary of all sections in the database.
+
+ Returns:
+ dict: A dictionary of all sections.
+ """
from seshat.apps.core.models import Section
my_list = Section.objects.all()
dic_to_be_returned = {}
for item in list(my_list):
dic_to_be_returned[item.name] = item.id
-
+
print(dic_to_be_returned)
return dic_to_be_returned
def subsection_dic_extractor():
+ """
+ Extracts a dictionary of all subsections in the database.
+
+ Returns:
+ dict: A dictionary of all subsections.
+ """
from seshat.apps.core.models import Subsection
my_list = Subsection.objects.all()
dic_to_be_returned = {}
for item in list(my_list):
dic_to_be_returned[item.name] = item.id
-
+
print(dic_to_be_returned)
return dic_to_be_returned
@@ -152,6 +231,14 @@ def subsection_dic_extractor():
# GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOD Function
def test_for_varhier_dic():
+ """
+ Extracts a dictionary of all variables in the database. This dictionary is
+ structured in a way that it can be used to generate a hierarchical
+ representation of the variables.
+
+ Returns:
+ dict: A dictionary of all variables.
+ """
all_sections = Section.objects.all()
all_subsections = Subsection.objects.all()
all_varhiers = Variablehierarchy.objects.all()
@@ -186,6 +273,17 @@ def test_for_varhier_dic():
# is to call this function from the shell, and feed it with the vars_dic on top of this page (which has to be a copy of the original vars_dic that we are using in generating models and virews and all)
# I then copy and paste the output to the QingVars function in Views. Sounds weird.
def qing_vars_links_creator(vars_dic_for_here):
+ """
+ Creates a dictionary of all variables in the database. This dictionary is
+ structured in a way that it can be used to generate a hierarchical
+ representation of the variables.
+
+ Args:
+ vars_dic_for_here (dict): A dictionary of all variables.
+
+ Returns:
+ dict: A dictionary of all variables.
+ """
varhier_dic = {
"Other_Sections": {
"Other_Subsections":[]
@@ -207,6 +305,16 @@ def qing_vars_links_creator(vars_dic_for_here):
def get_all_data_for_a_polity(polity_id, db_name):
+ """
+ Gets all data for a given polity ID.
+
+ Args:
+ polity_id (int): The ID of the polity.
+ db_name (str): The name of the database.
+
+ Returns:
+ dict: A dictionary of all data for the polity.
+ """
#####
all_vars = []
a_huge_context_data_dic = {}
@@ -229,6 +337,20 @@ def get_all_data_for_a_polity(polity_id, db_name):
def get_all_general_data_for_a_polity_old(polity_id):
+ """
+ Gets all general data for a given polity ID.
+
+ :private:
+
+ Note:
+ This function is not used in the current version of the application.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ dict: A dictionary of all general data for the polity.
+ """
a_huge_context_data_dic = {}
for ct in ContentType.objects.all():
m = ct.model_class()
@@ -251,6 +373,15 @@ def get_all_general_data_for_a_polity_old(polity_id):
def get_all_general_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "general" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ tuple: A tuple containing a dictionary of all data for the polity and a boolean value indicating whether the polity has any data.
+ """
app_name = 'general' # Replace with your app name
models_1 = apps.get_app_config(app_name).get_models()
has_any_data = False
@@ -316,6 +447,15 @@ def get_all_general_data_for_a_polity(polity_id):
return all_vars_grouped_g, has_any_data
def get_all_sc_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "sc" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ tuple: A tuple containing a dictionary of all data for the polity and a boolean value indicating whether the polity has any data.
+ """
app_name = 'sc' # Replace with your app name
models_1 = apps.get_app_config(app_name).get_models()
has_any_data = False
@@ -389,6 +529,15 @@ def get_all_sc_data_for_a_polity(polity_id):
# return False
def get_all_wf_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "wf" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ tuple: A tuple containing a dictionary of all data for the polity and a boolean value indicating whether the polity has any data.
+ """
app_name = 'wf' # Replace with your app name
models_1 = apps.get_app_config(app_name).get_models()
@@ -445,6 +594,15 @@ def get_all_wf_data_for_a_polity(polity_id):
def get_all_rt_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "rt" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ tuple: A tuple containing a dictionary of all data for the polity and a boolean value indicating whether the polity has any data.
+ """
app_name = 'rt' # Replace with your app name
models_1 = apps.get_app_config(app_name).get_models()
@@ -497,6 +655,20 @@ def get_all_rt_data_for_a_polity(polity_id):
#####################################################
def get_all_wf_data_for_a_polity_old(polity_id):
+ """
+ Gets all data for a given polity ID from the "wf" app.
+
+ :private:
+
+ Note:
+ This function is not used in the current version of the application.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ dict: A dictionary of all data for the polity.
+ """
a_huge_context_data_dic = {}
for ct in ContentType.objects.all():
m = ct.model_class()
@@ -517,6 +689,15 @@ def get_all_wf_data_for_a_polity_old(polity_id):
# get crsisi cocases data
def get_all_crisis_cases_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "crisisdb" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ dict: A dictionary of all data for the polity.
+ """
a_data_dic = {}
#my_data = Crisis_consequence.objects.filter(polity = polity_id)
my_data = Crisis_consequence.objects.filter(Q(polity=polity_id) | Q(other_polity=polity_id))
@@ -530,6 +711,15 @@ def get_all_crisis_cases_data_for_a_polity(polity_id):
# return Crisis_consequence.objects.filter(polity=polity_id).exists()
def get_all_power_transitions_data_for_a_polity(polity_id):
+ """
+ Gets all data for a given polity ID from the "rt" app.
+
+ Args:
+ polity_id (int): The ID of the polity.
+
+ Returns:
+ dict: A dictionary of all data for the polity.
+ """
a_data_dic = {}
my_data = Power_transition.objects.filter(polity = polity_id)
if my_data:
diff --git a/seshat/wsgi.py b/seshat/wsgi.py
index 5d21cfa12..ee4c6de81 100644
--- a/seshat/wsgi.py
+++ b/seshat/wsgi.py
@@ -1,5 +1,4 @@
-"""
-WSGI config for seshat project.
+"""WSGI config for seshat project.
It exposes the WSGI callable as a module-level variable named ``application``.
diff --git a/setup.py b/setup.py
new file mode 100644
index 000000000..d58510590
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,13 @@
+from setuptools import setup, find_packages
+
+setup(
+ name='seshat',
+ version='0.1.0',
+ description='Seshat: Global History Databank brings together the most current and comprehensive body of knowledge about human history in one place',
+ url='https://github.com/MajidBenam/seshat',
+ author='Majid Benam',
+ author_email='benam@csh.ac.at',
+ license='', # TODO
+ packages=find_packages(),
+ install_requires=[''], # TODO
+)