diff --git a/uipa_org/fixtures/regular.user.json b/uipa_org/fixtures/regular.user.json new file mode 100644 index 000000000..ac4def540 --- /dev/null +++ b/uipa_org/fixtures/regular.user.json @@ -0,0 +1,33 @@ +[ +{ + "model": "account.user", + "pk": 2, + "fields": { + "password": "pbkdf2_sha256$600000$4RkadkjMlrpld6VzlCKmKU$F1iqZCndTSwbanwfbg6sZgjsuW2coh4uKUgzOobaJJU=", + "last_login": "2024-05-01T18:37:21Z", + "is_superuser": true, + "username": "lani", + "first_name": "Lani", + "last_name": "Aloha", + "email": "lani@uipa.org", + "is_staff": false, + "is_active": true, + "date_joined": "2024-04-30T22:40:55Z", + "organization_name": "", + "organization_url": "", + "language": "en", + "private": false, + "terms": true, + "profile_text": "", + "profile_photo": "", + "is_trusted": false, + "is_blocked": false, + "date_deactivated": null, + "is_deleted": false, + "date_left": null, + "notes": "", + "groups": [], + "user_permissions": [] + } +} +] diff --git a/uipa_org/settings/base.py b/uipa_org/settings/base.py index 31b6cf5f2..df1c54eb1 100644 --- a/uipa_org/settings/base.py +++ b/uipa_org/settings/base.py @@ -35,16 +35,16 @@ class UipaOrgThemeBase(Base): SITE_NAME = "UIPA.org" SITE_EMAIL = "info@uipa.org" SITE_URL = 'http://localhost:8000' - + FRONTEND_BUILD_DIR = THEME_ROOT.parent / "build" STATIC_ROOT = values.Value(THEME_ROOT.parent / "public") - + FIXTURE_DIRS = ('fixtures',) @property def STATICFILES_DIRS(self): return [THEME_ROOT / "theme/static"] + super().STATICFILES_DIRS - + @property def TEMPLATES(self): TEMP = super().TEMPLATES @@ -53,20 +53,13 @@ def TEMPLATES(self): TEMP[0]["DIRS"] = [ THEME_ROOT / "templates", ] + list(TEMP[0]["DIRS"]) - cps = TEMP[0]["OPTIONS"]["context_processors"] - cps.extend( - [ - # "sekizai.context_processors.sekizai", - # "cms.context_processors.cms_settings", - ] - ) return TEMP @property def INSTALLED_APPS(self): installed = super(UipaOrgThemeBase, self).INSTALLED_APPS installed = ( - installed.default + + installed.default + [ "django.contrib.postgres", "django.db.backends.postgresql", @@ -77,7 +70,7 @@ def INSTALLED_APPS(self): ] ) return installed - + MIDDLEWARE = [ "django.middleware.locale.LocaleMiddleware", # needs to be before CommonMiddleware "django.middleware.common.CommonMiddleware", diff --git a/uipa_org/settings/development.py b/uipa_org/settings/development.py index 2d5fa4ff0..1571ea7f8 100644 --- a/uipa_org/settings/development.py +++ b/uipa_org/settings/development.py @@ -14,15 +14,10 @@ class Dev(UipaOrgThemeBase): CACHES = {"default": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"}} - # setup GDAL and GEOS - GDAL_LIBRARY_PATH = values.Value('/usr/lib/libgdal.so.34', environ=True, environ_name="GDAL_LIBRARY_PATH", - environ_prefix="") - GEOS_LIBRARY_PATH = values.PathValue('/usr/lib/libgeos_c.so.1', environ=True, environ_name="GEOS_LIBRARY_PATH", - environ_prefix="") - - ELASTICSEARCH_HOST = values.Value("localhost", environ=True, environ_name="ELASTICSEARCH_HOST") - ELASTICSEARCH_USER = values.Value("elastic", environ=True, environ_name="ELASTICSEARCH_USER") - ELASTICSEARCH_PASSWORD = values.Value("****", environ=True, environ_name="ELASTICSEARCH_PASSWORD") + ELASTICSEARCH_HOST = values.Value("localhost", environ_prefix=None, environ_name="ELASTICSEARCH_HOST") + ELASTICSEARCH_USER = values.Value("elastic", environ_prefix=None, environ_name="ELASTICSEARCH_USER") + ELASTICSEARCH_PASSWORD = values.Value("froide", environ_prefix=None, environ_name="ELASTICSEARCH_PASSWORD") + ELASTICSEARCH_DSL = { "default": { "hosts": "http://%s:9200" % ELASTICSEARCH_HOST, @@ -36,6 +31,86 @@ def TEMPLATES(self): TEMP[0]["OPTIONS"]["debug"] = True return TEMP + LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'root': { + 'level': 'DEBUG', + 'handlers': ['uipa_org_logfile',], + }, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + }, + 'require_debug_true': { + '()': 'django.utils.log.RequireDebugTrue', + }, + }, + 'formatters': { + 'verbose': { + 'format': '[%(asctime)s] %(levelname)s (pid: %(process)d) [%(name)s.%(module)s: %(funcName)s:%(lineno)d] %(message)s', + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'filters': ['require_debug_true'], + 'class': 'logging.StreamHandler', + }, + 'uipa_org_logfile': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': 'uipa_org_dev_app.log', # put in the working directory + 'maxBytes': 1024*1024*5, # 5MB + 'backupCount': 10, + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'froide': { + 'handlers': ['uipa_org_logfile'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'django': { + 'handlers': ['uipa_org_logfile'], + 'level': 'DEBUG', + 'propagate': False, + }, + # Use instead of 'django.request' to log all requests; added in Django 1.11. + 'django.server': { + 'handlers': ['uipa_org_logfile'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'django.security': { + 'handlers': ['uipa_org_logfile'], + 'level': 'DEBUG', + 'propagate': False, + }, + 'django.db.backends': { + 'level': 'DEBUG', + 'handlers': ['uipa_org_logfile'], + 'propagate': False, + }, + 'django.template': { + 'level': 'INFO', + 'handlers': ['uipa_org_logfile'], + 'propagate': False, + }, + 'uipa_org': { + 'handlers': ['uipa_org_logfile'], + 'level': 'DEBUG', + 'propagate': False, + }, + } + } + # Start of email settings # Read the docs about these settings here: https://github.com/okfde/froide/blob/2dc1899cfe732c3f1d658f07ca86626dd5baa1a3/docs/configuration.rst#settings-for-sending-e-mail # The exact settings can be seen https://github.com/okfde/froide/blob/2dc1899cfe732c3f1d658f07ca86626dd5baa1a3/froide/settings.py#L618 diff --git a/uipa_org/templates/publicbody/show.html b/uipa_org/templates/publicbody/show.html new file mode 100644 index 000000000..954068c1e --- /dev/null +++ b/uipa_org/templates/publicbody/show.html @@ -0,0 +1,182 @@ +{% extends 'publicbody/base.html' %} +{% load i18n %} +{% load static %} +{% load markup %} +{% load permission_helper %} +{% block title %}{{ object.name }} - {{ SITE_NAME }}{% endblock %} +{% block metadescription %} + {% spaceless %} + {% if object.classification %} + {% blocktrans with name=object.name classification=object.classification juris=object.jurisdiction.name site_name=SITE_NAME %}{{ name }} is a public agency ({{ classification }}) in {{ juris }} on {{ site_name }}{% endblocktrans %} + {% else %} + {% blocktrans with name=object.name juris=object.jurisdiction.name site_name=SITE_NAME %}{{ name }} is a public agency in {{ juris }} on {{ site_name }}{% endblocktrans %} + {% endif %} + {% endspaceless %} +{% endblock %} +{% block extra_head %} + {% if not object.confirmed %}{% endif %} + + +{% endblock %} +{% block app_body %} +
+

{{ object.name }}

+ +

{{ object.description }}

+
+ + {% if object.email and object.confirmed %} +

+ {% blocktrans %}Make a Request to this public agency!{% endblocktrans %} +

+ {% endif %} +
+
+
+
{% blocktrans %}Jurisdiction{% endblocktrans %}:
+
+ {{ object.jurisdiction }} +
+ {% if object.classification %} +
{% blocktrans %}Classification:{% endblocktrans %}
+
+ {{ object.classification }} +
+ {% endif %} + {% with categories=object.categories.all %} + {% if categories %} +
{% blocktrans %}Categories:{% endblocktrans %}
+
+ {% for category in categories %} + {{ category.name }} + {% if not forloop.last %},{% endif %} + {% endfor %} +
+ {% endif %} + {% endwith %} + {% if object.url %} +
{% blocktrans %}Website:{% endblocktrans %}
+
+ {{ object.url|truncatechars:30 }} +
+ {% endif %} + {% if object.email %} +
{% blocktrans %}Email:{% endblocktrans %}
+
+ {{ object.email }} +
+ {% endif %} + {% if object.fax %} +
{% blocktrans %}Fax:{% endblocktrans %}
+
+ {{ object.fax }} +
+ {% endif %} +
{% blocktrans %}Contact:{% endblocktrans %}
+
+ {{ object.contact|urlizetrunc:35|linebreaksbr }} +
+ {% if object.file_index %} +
{% blocktrans %}File Index:{% endblocktrans %}
+
+ {{ object.file_index|urlizetrunc:40 }} +
+ {% endif %} + {% if object.org_chart %} +
{% blocktrans %}Organization Chart:{% endblocktrans %}
+
+ {{ object.org_chart|urlizetrunc:40 }} +
+ {% endif %} +
+ {% if request.user.is_staff and request.user|has_perm:"publicbody.view_publicbody" %} + {% if object.confirmed %} + {% url 'admin:publicbody_publicbody_change' object.id as admin_url %} + {% else %} + {% url 'admin:publicbody_proposedpublicbody_change' object.id as admin_url %} + {% endif %} +
+ + + {% trans "View on Admin site" %} + + {% endif %} +
+
+ {% if not object.confirmed %} +
+

{% trans "Proposal" %}

+ {% if object.created_by == request.user %} +

{% trans "You have proposed this public agency, but it has not been confirmed yet." %}

+ {% else %} +

{% trans "This public agency has been proposed and has not been confirmed yet." %}

+ {% endif %} +
+ {% endif %} + {% if object.request_note %} +
+
+

{% trans "Special note" %}

+
+
{{ object.request_note_html|safe }}
+
+ {% endif %} + {% if foirequest_count %} +

{% trans "Summary of Results" %}

+ + {% for res in resolutions %} + + + + + + {% endfor %} +
+ + + {% block result_image %} + {% endblock result_image %} + {{ res.name }} +
+ {{ res.description }} +
{{ res.count }}
+

+ {% blocktrans count count=foirequest_count %}One requests to this public agency{% plural %}{{ count }} requests to this public agency{% endblocktrans %} +

+
    + {% for object in foirequests %} +
  • {% include "foirequest/snippets/request_item.html" %}
  • + {% endfor %} +
+

+ + + {% trans "RSS Feed" %} + +
+ + + {% trans "Atom Feed" %} + +

+ {% if foirequest_count > foirequests|length %} +

+ + {% trans "See all FOI requests for this public agency" %} + +

+ {% endif %} + {% else %} +

{% trans "There are no requests for this public agency yet." %}

+ {% endif %} +
+
+
+{% endblock %}