Skip to content

Commit

Permalink
Merge pull request #9 from ppfeufer/allianceauth-v4
Browse files Browse the repository at this point in the history
  • Loading branch information
ppfeufer committed Mar 16, 2024
2 parents 43a971a + 2227f05 commit 7ae48fd
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ A clear and concise description of what the bug is.

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
2. Click on '...'
3. Scroll down to '...'
4. See error


Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ Fixes # (issue)
## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand areas
- [ ] I have checked my code and corrected any misspellings
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ updates:
directory: "/"
target-branch: "master"
schedule:
interval: "daily"
interval: "monthly"
24 changes: 14 additions & 10 deletions .github/workflows/automated-checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Checks
name: Tests

on:
push:
Expand Down Expand Up @@ -40,13 +40,14 @@ jobs:
runs-on: ubuntu-latest

strategy:
# Set Python and Django versions to test for the stable release of AllianceAuth
# Set Python and Django version to test for the stable release of AllianceAuth
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- name: Checkout
Expand Down Expand Up @@ -75,21 +76,24 @@ jobs:
# - name: Upload Coverage
# if: ${{
# (
# github.event_name == 'pull_request' ||
# (
# github.event_name == 'push' &&
# github.ref == 'refs/heads/master'
# github.event_name == 'pull_request'
# || (
# github.event_name == 'push'
# && github.ref == 'refs/heads/master'
# )
# )
# && (
# matrix.python-version == '3.10'
# && matrix.database == 'mariadb:10.11'
# )
# && matrix.python-version == '3.11'
# }}
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: coverage.xml # optional
# flags: unittests # optional
# name: codecov-umbrella # optional
# fail_ci_if_error: true # optional (default = false)
## flags: unittests # optional
## name: codecov-umbrella # optional
## fail_ci_if_error: true # optional (default = false)
# verbose: true # optional (default = false)

# Pypi Build Test
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
/dist/
/*.egg-info/
.idea/
.tox/
htmlcov/
node_modules/

*.log
*.tmp
*.bak
*.old
__pycache__

/.coverage
/htmlcov/
/.tox/
.coverage
/coverage.xml
alliance_auth.sqlite3
26 changes: 19 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repos:
)
- repo: https://github.com/eslint/eslint
rev: v8.56.0
rev: v8.57.0
hooks:
- id: eslint
exclude: |
Expand All @@ -86,6 +86,22 @@ repos:
# - [email protected] # https://github.com/eslint/eslint/releases/latest
# - [email protected] # https://github.com/sindresorhus/globals/releases/latest

- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v16.2.1
hooks:
- id: stylelint
exclude: |
(?x)(
.min(.css|.css.map)|
static/(.*)/libs/
)
args:
- --formatter=compact
additional_dependencies:
# stylelint itself needs to be here when using additional_dependencies.
- [email protected] # https://github.com/stylelint/stylelint/releases/latest
- [email protected] # https://github.com/stylelint/stylelint-config-standard/releases/latest

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand All @@ -112,7 +128,7 @@ repos:
hooks:
- id: django-upgrade
args:
- --target-version=4.0 # Minimum supported Django version for AA. Update as needed.
- --target-version=4.2 # Minimum supported Django version for AA. Update as needed.

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
Expand All @@ -135,10 +151,6 @@ repos:
rev: 5.13.2
hooks:
- id: isort
exclude: |
(?x)(
testauth/
)

- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
rev: v1.1.3
Expand All @@ -157,7 +169,7 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.12.1 # https://github.com/psf/black/releases/latest
- black==24.1.1 # https://github.com/psf/black/releases/latest
args:
- --target-version=py38 # Minimum required Python version for AA. Update as needed.

Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## \[In Development\] - Unreleased

## \[0.0.8\] - 2024-03-16

> \[!NOTE\]
>
> **This version needs at least Alliance Auth v4.0.0!**
### Added

- Compatibility to Alliance Auth v4
- Bootstrap 5
- Django 4.2

### Removed

- Compatibility to Alliance Auth v3

## \[0.0.7\] - 2023-09-27

> \[!NOTE\]
>
> **This is the last version compatible with Alliance Auth v3.**
### Changed

- Moved the build process to PEP 621 / pyproject.toml
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Examples of unacceptable behavior include:
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
- Other conducts which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities<a name="enforcement-responsibilities"></a>
Expand Down
2 changes: 1 addition & 1 deletion example/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Initialize the app"""

__version__ = "0.0.7"
__version__ = "0.0.8"
__title__ = "Example"
13 changes: 9 additions & 4 deletions example/templates/example/base.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{% extends 'allianceauth/base.html' %}
{% extends 'allianceauth/base-bs5.html' %}

{% load i18n %}

{% block page_title %}{% translate "Example Plugin" %}{% endblock %}
{% block page_title %}
{% translate "Example Plugin" %}
{% endblock %}

{% block header_nav_brand %}
{% translate "Example Plugin" %}
{% endblock header_nav_brand %}

{% block content %}
<div class="allianceauth-example-plugin">
<h1 class="page-header text-center">{% translate "Example Plugin" %}</h1>

{% block details %}{% endblock %}
</div>
{% endblock %}
9 changes: 5 additions & 4 deletions example/templates/example/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{% extends 'example/base.html' %}

{% load i18n %}
{% load humanize %}

{% block details %}
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">{% translate "Panel Headline" %}</div>
<div class="card card-primary">
<div class="card-header">
<div class="card-title">{% translate "Headline" %}</div>
</div>

<div class="panel-body">
<div class="card-body">
{{ text }}
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ requires-python = ">=3.8"
classifiers = [
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
Expand All @@ -30,14 +30,15 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
]
dynamic = [
"version",
]
dependencies = [
"allianceauth>=3.6.1",
"allianceauth<5.0.0,>=4",
]
[project.urls]
Changelog = "https://github.com/ppfeufer/aa-example-plugin/blob/master/CHANGELOG.md"
Expand Down
16 changes: 13 additions & 3 deletions testauth/base.py → testauth/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# Django
from django.contrib import messages

# pylint: disable=line-too-long
INSTALLED_APPS = [
"allianceauth", # needs to be on top of this list to support favicons in Django admin (see https://gitlab.com/allianceauth/allianceauth/-/issues/1301)
"django.contrib.admin",
Expand All @@ -27,15 +26,22 @@
"django.contrib.humanize",
"django_celery_beat",
"bootstrapform",
"django_bootstrap5", # https://github.com/zostera/django-bootstrap5
"sortedm2m",
"esi",
"allianceauth.framework",
"allianceauth.authentication",
"allianceauth.services",
"allianceauth.eveonline",
"allianceauth.groupmanagement",
"allianceauth.notifications",
"allianceauth.thirdparty.navhelper",
"allianceauth.analytics",
"allianceauth.menu",
"allianceauth.theme",
"allianceauth.theme.darkly",
"allianceauth.theme.flatly",
"allianceauth.theme.materia",
]

SECRET_KEY = "wow I'm a really bad default secret key"
Expand Down Expand Up @@ -80,7 +86,6 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"allianceauth.analytics.middleware.AnalyticsMiddleware",
]

ROOT_URLCONF = "allianceauth.urls"
Expand Down Expand Up @@ -173,7 +178,7 @@
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1", # change the 1 here to change the database used
"LOCATION": "redis://127.0.0.1:6379/1", # change the 1 here for the DB used
}
}

Expand All @@ -190,6 +195,9 @@

SITE_NAME = "Alliance Auth"

DEFAULT_THEME = "allianceauth.theme.flatly.auth_hooks.FlatlyThemeHook"
DEFAULT_THEME_DARK = "allianceauth.theme.darkly.auth_hooks.DarklyThemeHook" # Legacy AAv3 user.profile.night_mode=1

LOGIN_URL = "auth_login_user" # view that handles login logic

LOGIN_REDIRECT_URL = "authentication:dashboard" # default destination when logging in if no redirect specified
Expand All @@ -203,6 +211,8 @@
# scopes required on new tokens when logging in. Cannot be blank.
LOGIN_TOKEN_SCOPES = ["publicData"]

EMAIL_TIMEOUT = 15

# number of days email verification links are valid for
ACCOUNT_ACTIVATION_DAYS = 1

Expand Down
5 changes: 4 additions & 1 deletion testauth/local.py → testauth/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
STATICFILES_DIRS = [os.path.join(PROJECT_DIR, f"{PACKAGE}/static")]
# STATICFILES_DIRS = [os.path.join(PROJECT_DIR, f"{PACKAGE}/static")]
STATICFILES_DIRS = [
f"{PACKAGE}/static",
]

SITE_URL = "https://example.com"
CSRF_TRUSTED_ORIGINS = [SITE_URL]
Expand Down
11 changes: 2 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@
requires =
tox>=4.2
env_list =
py{311, 310, 39, 38}
py{312, 311, 310, 39, 38}

[testenv]
deps =
allianceauth
coverage
django-webtest
set_env =
DJANGO_SETTINGS_MODULE = testauth.local
DJANGO_SETTINGS_MODULE = testauth.settings.local
commands =
coverage run runtests.py example -v 2
coverage report
coverage xml
install_command = python -m pip install -U {opts} {packages}

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

0 comments on commit 7ae48fd

Please sign in to comment.