evewiki 0.0.1b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. evewiki-0.0.1b1/LICENSE +21 -0
  2. evewiki-0.0.1b1/PKG-INFO +95 -0
  3. evewiki-0.0.1b1/README.md +65 -0
  4. evewiki-0.0.1b1/evewiki/__init__.py +6 -0
  5. evewiki-0.0.1b1/evewiki/admin.py +16 -0
  6. evewiki-0.0.1b1/evewiki/app_settings.py +5 -0
  7. evewiki-0.0.1b1/evewiki/apps.py +9 -0
  8. evewiki-0.0.1b1/evewiki/auth_hooks.py +40 -0
  9. evewiki-0.0.1b1/evewiki/forms.py +45 -0
  10. evewiki-0.0.1b1/evewiki/migrations/0001_initial.py +190 -0
  11. evewiki-0.0.1b1/evewiki/migrations/0002_page_is_public.py +21 -0
  12. evewiki-0.0.1b1/evewiki/migrations/__init__.py +0 -0
  13. evewiki-0.0.1b1/evewiki/models/__init__.py +0 -0
  14. evewiki-0.0.1b1/evewiki/models/logs.py +15 -0
  15. evewiki-0.0.1b1/evewiki/models/page_versions.py +48 -0
  16. evewiki-0.0.1b1/evewiki/models/pages.py +261 -0
  17. evewiki-0.0.1b1/evewiki/models/settings.py +35 -0
  18. evewiki-0.0.1b1/evewiki/tasks.py +12 -0
  19. evewiki-0.0.1b1/evewiki/templates/evewiki/base.html +11 -0
  20. evewiki-0.0.1b1/evewiki/templates/evewiki/error.html +13 -0
  21. evewiki-0.0.1b1/evewiki/templates/evewiki/help.html +16 -0
  22. evewiki-0.0.1b1/evewiki/templates/evewiki/index.html +459 -0
  23. evewiki-0.0.1b1/evewiki/templates/evewiki/page.html +98 -0
  24. evewiki-0.0.1b1/evewiki/templates/evewiki/page_delete.html +41 -0
  25. evewiki-0.0.1b1/evewiki/templates/evewiki/page_tree.html +10 -0
  26. evewiki-0.0.1b1/evewiki/templates/evewiki/public.html +87 -0
  27. evewiki-0.0.1b1/evewiki/templates/evewiki/sidebar.html +5 -0
  28. evewiki-0.0.1b1/evewiki/tests/__init__.py +0 -0
  29. evewiki-0.0.1b1/evewiki/tests/test_tasks.py +11 -0
  30. evewiki-0.0.1b1/evewiki/urls.py +17 -0
  31. evewiki-0.0.1b1/evewiki/views.py +184 -0
  32. evewiki-0.0.1b1/pyproject.toml +77 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ryan Cunning
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: evewiki
3
+ Version: 0.0.1b1
4
+ Summary: Wiki plugin app for Alliance Auth.
5
+ Author-email: Ryan Cunning <ryan.cunning@gmail.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Environment :: Web Environment
9
+ Classifier: Framework :: Django
10
+ Classifier: Framework :: Django :: 4.0
11
+ Classifier: Framework :: Django :: 4.2
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Topic :: Internet :: WWW/HTTP
21
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
22
+ License-File: LICENSE
23
+ Requires-Dist: allianceauth>=3
24
+ Project-URL: Changelog, https://gitlab.com/cunningdesigns/evewiki/-/blob/main/CHANGELOG.md
25
+ Project-URL: Documentation, https://gitlab.com/cunningdesigns/evewiki
26
+ Project-URL: Homepage, https://gitlab.com/cunningdesigns/evewiki
27
+ Project-URL: Source, https://gitlab.com/cunningdesigns/evewiki
28
+ Project-URL: Tracker, https://gitlab.com/cunningdesigns/evewiki/-/issues
29
+
30
+ # evewiki
31
+
32
+ Wiki plugin for [AllianceAuth](https://gitlab.com/allianceauth/allianceauth) to curate content.
33
+
34
+ ## Features
35
+
36
+ - Create and organise pages in a hierarchical structure using `slugs`
37
+ - Supports markdown with both rich and raw editing modes
38
+ - Version History
39
+ - Event logging
40
+ - Restrict content by user's `groups` and/or `states`
41
+
42
+ ## Installation
43
+
44
+ ### Step 1 - Pre_Requisites
45
+
46
+ Evewiki is an App for Alliance Auth, Please make sure you have this installed. Evewiki is not a standalone Django Application
47
+
48
+ ### Step 2 - Install app
49
+
50
+ pip install evewiki
51
+
52
+ ### Step 3 - Configure Auth settings
53
+
54
+ Configure your Auth settings (`local.py`) as follows:
55
+
56
+ - Add the following `INSTALLED_APPS` in `local.py`
57
+
58
+ ```plaintext
59
+ 'evewiki',
60
+ ```
61
+
62
+ ### Step 4 - Maintain Alliance Auth
63
+
64
+ Run migrations `python manage.py migrate`
65
+ Restart Alliance Auth
66
+
67
+ ### Step 5
68
+
69
+ In AA admin site add Permissions
70
+ - `evewiki | general | Can access this app`
71
+ - `evewiki | general | Can edit this app`
72
+ to the desired `States` / `Groups`
73
+
74
+ i.e. you may wish to create a `wiki_editors` group to restrict the `Can edit this app` controls.
75
+
76
+ ## Permissions
77
+
78
+ Users need to have at least `basic_access` interactions with the application
79
+
80
+ | Name | Description |
81
+ |-----------------------|----------------------------------------------------------|
82
+ | `basic_access` | Basic access to load content |
83
+ | `editor_access` | Grant the necessary controls and access to edit content |
84
+
85
+
86
+ ## Settings
87
+
88
+ List of settings that can be modified for the application
89
+ You can alter them by adding a record to the `Settings` section/table in the `evewiki` section of the Admin site
90
+
91
+ | Name | Description | Default |
92
+ |-------------------------------|--------------------------------------------------------------------------------------------------|---------|
93
+ | `hierarchy_max_display_depth` | Limit the depth of the tree for the hierarchy on the main display | 10 |
94
+ | `max_versions` | No one has infinite disk space, a sensible limit which can be modified to clear down the history | 1000 |
95
+
@@ -0,0 +1,65 @@
1
+ # evewiki
2
+
3
+ Wiki plugin for [AllianceAuth](https://gitlab.com/allianceauth/allianceauth) to curate content.
4
+
5
+ ## Features
6
+
7
+ - Create and organise pages in a hierarchical structure using `slugs`
8
+ - Supports markdown with both rich and raw editing modes
9
+ - Version History
10
+ - Event logging
11
+ - Restrict content by user's `groups` and/or `states`
12
+
13
+ ## Installation
14
+
15
+ ### Step 1 - Pre_Requisites
16
+
17
+ Evewiki is an App for Alliance Auth, Please make sure you have this installed. Evewiki is not a standalone Django Application
18
+
19
+ ### Step 2 - Install app
20
+
21
+ pip install evewiki
22
+
23
+ ### Step 3 - Configure Auth settings
24
+
25
+ Configure your Auth settings (`local.py`) as follows:
26
+
27
+ - Add the following `INSTALLED_APPS` in `local.py`
28
+
29
+ ```plaintext
30
+ 'evewiki',
31
+ ```
32
+
33
+ ### Step 4 - Maintain Alliance Auth
34
+
35
+ Run migrations `python manage.py migrate`
36
+ Restart Alliance Auth
37
+
38
+ ### Step 5
39
+
40
+ In AA admin site add Permissions
41
+ - `evewiki | general | Can access this app`
42
+ - `evewiki | general | Can edit this app`
43
+ to the desired `States` / `Groups`
44
+
45
+ i.e. you may wish to create a `wiki_editors` group to restrict the `Can edit this app` controls.
46
+
47
+ ## Permissions
48
+
49
+ Users need to have at least `basic_access` interactions with the application
50
+
51
+ | Name | Description |
52
+ |-----------------------|----------------------------------------------------------|
53
+ | `basic_access` | Basic access to load content |
54
+ | `editor_access` | Grant the necessary controls and access to edit content |
55
+
56
+
57
+ ## Settings
58
+
59
+ List of settings that can be modified for the application
60
+ You can alter them by adding a record to the `Settings` section/table in the `evewiki` section of the Admin site
61
+
62
+ | Name | Description | Default |
63
+ |-------------------------------|--------------------------------------------------------------------------------------------------|---------|
64
+ | `hierarchy_max_display_depth` | Limit the depth of the tree for the hierarchy on the main display | 10 |
65
+ | `max_versions` | No one has infinite disk space, a sensible limit which can be modified to clear down the history | 1000 |
@@ -0,0 +1,6 @@
1
+ """Wiki plugin app for Alliance Auth."""
2
+
3
+ # pylint: disable = invalid-name
4
+ default_app_config = "evewiki.apps.EveWikiConfig"
5
+
6
+ __version__ = "0.0.1.b1"
@@ -0,0 +1,16 @@
1
+ """Admin site."""
2
+
3
+ from django.contrib import admin
4
+
5
+ from .models.logs import Log
6
+ from .models.page_versions import PageVersion
7
+ from .models.pages import Page
8
+ from .models.settings import Setting
9
+
10
+ # from django.contrib import admin
11
+
12
+ # Register your models for the admin site here.
13
+ admin.site.register(Page)
14
+ admin.site.register(Setting)
15
+ admin.site.register(PageVersion)
16
+ admin.site.register(Log)
@@ -0,0 +1,5 @@
1
+ """App settings."""
2
+
3
+ from django.conf import settings
4
+
5
+ EXAMPLE_SETTING_ONE = getattr(settings, "EXAMPLE_SETTING_ONE", None)
@@ -0,0 +1,9 @@
1
+ from django.apps import AppConfig
2
+
3
+ from . import __version__
4
+
5
+
6
+ class EveWikiConfig(AppConfig):
7
+ name = "evewiki"
8
+ label = "evewiki"
9
+ verbose_name = f"evewiki v{__version__}"
@@ -0,0 +1,40 @@
1
+ from django.utils.translation import gettext_lazy as _
2
+
3
+ from allianceauth import hooks
4
+ from allianceauth.services.hooks import MenuItemHook, UrlHook
5
+
6
+ from evewiki import urls
7
+
8
+
9
+ class EveWikiMenuItem(MenuItemHook):
10
+ """This class ensures only authorized users will see the menu entry"""
11
+
12
+ def __init__(self):
13
+ # setup menu entry for sidebar
14
+ MenuItemHook.__init__(
15
+ self,
16
+ _("Wiki"),
17
+ "fas fa-tree fa-fw",
18
+ "evewiki:index",
19
+ navactive=["evewiki:"],
20
+ )
21
+
22
+ def render(self, request):
23
+ if request.user.has_perm("evewiki.basic_access"):
24
+ return MenuItemHook.render(self, request)
25
+ return ""
26
+
27
+
28
+ @hooks.register("menu_item_hook")
29
+ def register_menu():
30
+ return EveWikiMenuItem()
31
+
32
+
33
+ @hooks.register("url_hook")
34
+ def register_urls():
35
+ return UrlHook(
36
+ urls,
37
+ "evewiki",
38
+ r"^evewiki/",
39
+ excluded_views=["evewiki.views.public"],
40
+ )
@@ -0,0 +1,45 @@
1
+ from django import forms
2
+
3
+ from .models.pages import Page
4
+
5
+
6
+ class PageForm(forms.ModelForm):
7
+
8
+ try:
9
+ # Customised ddl inferring additional context via text-indentation
10
+ parent = forms.ChoiceField(
11
+ choices=Page.list(),
12
+ required=False,
13
+ label="Path",
14
+ help_text=Page._meta.get_field("parent").help_text,
15
+ )
16
+
17
+ class Meta:
18
+ model = Page
19
+ fields = [
20
+ "title",
21
+ "parent",
22
+ "slug",
23
+ "priority",
24
+ "states",
25
+ "groups",
26
+ "is_public",
27
+ ]
28
+
29
+ def __init__(self, *args, **kwargs):
30
+ super().__init__(*args, **kwargs)
31
+ self.fields["parent"].choices = Page.list()
32
+
33
+ def clean(self):
34
+ """
35
+ Django needs a little help to turn the custom `parent` field back into a model.
36
+ """
37
+ cleaned_data = super().clean()
38
+ parent_id = cleaned_data["parent"]
39
+ cleaned_data["parent"] = (
40
+ Page.objects.get(pk=int(parent_id)) if parent_id else None
41
+ )
42
+ return cleaned_data
43
+
44
+ except Exception as e:
45
+ print(f"setup required: {e}")
@@ -0,0 +1,190 @@
1
+ # Generated by Django 4.2.21 on 2025-05-27 00:35
2
+
3
+ import django.db.models.deletion
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ initial = True
10
+
11
+ dependencies = [
12
+ ("auth", "0012_alter_user_first_name_max_length"),
13
+ ("authentication", "0024_alter_userprofile_language"),
14
+ ]
15
+
16
+ operations = [
17
+ migrations.CreateModel(
18
+ name="General",
19
+ fields=[
20
+ (
21
+ "id",
22
+ models.AutoField(
23
+ auto_created=True,
24
+ primary_key=True,
25
+ serialize=False,
26
+ verbose_name="ID",
27
+ ),
28
+ ),
29
+ ],
30
+ options={
31
+ "permissions": (
32
+ ("basic_access", "Can access this app"),
33
+ ("editor_access", "Can edit this app"),
34
+ ),
35
+ "managed": False,
36
+ "default_permissions": (),
37
+ },
38
+ ),
39
+ migrations.CreateModel(
40
+ name="Log",
41
+ fields=[
42
+ (
43
+ "id",
44
+ models.AutoField(
45
+ auto_created=True,
46
+ primary_key=True,
47
+ serialize=False,
48
+ verbose_name="ID",
49
+ ),
50
+ ),
51
+ ("user", models.TextField(blank=True, default="", null=True)),
52
+ ("action", models.TextField(blank=True, default="", null=True)),
53
+ ("details", models.TextField(blank=True, default="", null=True)),
54
+ ("created", models.DateTimeField(auto_now_add=True)),
55
+ ],
56
+ ),
57
+ migrations.CreateModel(
58
+ name="Page",
59
+ fields=[
60
+ (
61
+ "id",
62
+ models.AutoField(
63
+ auto_created=True,
64
+ primary_key=True,
65
+ serialize=False,
66
+ verbose_name="ID",
67
+ ),
68
+ ),
69
+ (
70
+ "title",
71
+ models.CharField(
72
+ help_text="Required: Displayed above content and in menu",
73
+ max_length=255,
74
+ ),
75
+ ),
76
+ (
77
+ "slug",
78
+ models.CharField(
79
+ help_text="Required: Indentifier for path and links",
80
+ max_length=255,
81
+ ),
82
+ ),
83
+ (
84
+ "priority",
85
+ models.IntegerField(
86
+ default=10,
87
+ help_text="Required: Sort order for pages on the same path",
88
+ ),
89
+ ),
90
+ ("content", models.TextField(blank=True, default="", null=True)),
91
+ (
92
+ "groups",
93
+ models.ManyToManyField(
94
+ blank=True,
95
+ default=None,
96
+ help_text="Optional: Restrict Page to specific Groups",
97
+ related_name="+",
98
+ to="auth.group",
99
+ verbose_name="groups",
100
+ ),
101
+ ),
102
+ (
103
+ "parent",
104
+ models.ForeignKey(
105
+ blank=True,
106
+ help_text="Required: Oragnise page hierarchy",
107
+ null=True,
108
+ on_delete=django.db.models.deletion.PROTECT,
109
+ related_name="children",
110
+ to="evewiki.page",
111
+ ),
112
+ ),
113
+ (
114
+ "states",
115
+ models.ManyToManyField(
116
+ blank=True,
117
+ default=None,
118
+ help_text="Optional: Restrict Page to specific States",
119
+ related_name="+",
120
+ to="authentication.state",
121
+ verbose_name="states",
122
+ ),
123
+ ),
124
+ ],
125
+ ),
126
+ migrations.CreateModel(
127
+ name="Setting",
128
+ fields=[
129
+ (
130
+ "id",
131
+ models.AutoField(
132
+ auto_created=True,
133
+ primary_key=True,
134
+ serialize=False,
135
+ verbose_name="ID",
136
+ ),
137
+ ),
138
+ (
139
+ "hierarchy_max_display_depth",
140
+ models.IntegerField(
141
+ default=10,
142
+ help_text="Limit the depth of the tree for the hierarchy on the main display",
143
+ ),
144
+ ),
145
+ (
146
+ "max_versions",
147
+ models.IntegerField(
148
+ default=1000,
149
+ help_text="No one has infinite disk space, a sensible limit which can be modified to clear down the history",
150
+ ),
151
+ ),
152
+ ],
153
+ ),
154
+ migrations.CreateModel(
155
+ name="PageVersion",
156
+ fields=[
157
+ (
158
+ "id",
159
+ models.AutoField(
160
+ auto_created=True,
161
+ primary_key=True,
162
+ serialize=False,
163
+ verbose_name="ID",
164
+ ),
165
+ ),
166
+ ("content", models.TextField(blank=True, default="", null=True)),
167
+ ("created", models.DateTimeField(auto_now_add=True)),
168
+ (
169
+ "page",
170
+ models.ForeignKey(
171
+ blank=True,
172
+ help_text="Page being edited",
173
+ null=True,
174
+ on_delete=django.db.models.deletion.SET_NULL,
175
+ to="evewiki.page",
176
+ ),
177
+ ),
178
+ (
179
+ "user",
180
+ models.ForeignKey(
181
+ blank=True,
182
+ help_text="User editing the page",
183
+ null=True,
184
+ on_delete=django.db.models.deletion.SET_NULL,
185
+ to="authentication.userprofile",
186
+ ),
187
+ ),
188
+ ],
189
+ ),
190
+ ]
@@ -0,0 +1,21 @@
1
+ # Generated by Django 4.2.21 on 2025-05-29 21:23
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("evewiki", "0001_initial"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name="page",
15
+ name="is_public",
16
+ field=models.BooleanField(
17
+ default=False,
18
+ help_text="Optional: Make page publicly accessible via it's [path]/[slug]",
19
+ ),
20
+ ),
21
+ ]
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ from django.db import models
2
+
3
+
4
+ class Log(models.Model):
5
+ """
6
+ No relationships just a log.
7
+ """
8
+
9
+ user = models.TextField(default="", blank=True, null=True)
10
+
11
+ action = models.TextField(default="", blank=True, null=True)
12
+
13
+ details = models.TextField(default="", blank=True, null=True)
14
+
15
+ created = models.DateTimeField(auto_now_add=True)
@@ -0,0 +1,48 @@
1
+ from django.db import models
2
+
3
+ from allianceauth.authentication.models import UserProfile
4
+
5
+ from .pages import Page
6
+ from .settings import Setting
7
+
8
+
9
+ class PageVersion(models.Model):
10
+ """
11
+ Previous edits have value
12
+ """
13
+
14
+ page = models.ForeignKey(
15
+ Page,
16
+ on_delete=models.SET_NULL,
17
+ null=True,
18
+ blank=True,
19
+ help_text="Page being edited",
20
+ )
21
+
22
+ user = models.ForeignKey(
23
+ UserProfile,
24
+ on_delete=models.SET_NULL,
25
+ null=True,
26
+ blank=True,
27
+ help_text="User editing the page",
28
+ )
29
+
30
+ content = models.TextField(default="", blank=True, null=True)
31
+
32
+ created = models.DateTimeField(auto_now_add=True)
33
+
34
+ def save(self, *args, **kwargs):
35
+ """
36
+ Clean up old versions when saving
37
+ """
38
+ super().save(*args, **kwargs)
39
+ if self.page_id:
40
+ # Get the IDs of old versions to delete
41
+ settings = Setting.get_settings()
42
+ old_version_ids = list(
43
+ PageVersion.objects.filter(page=self.page)
44
+ .order_by("-created")
45
+ .values_list("id", flat=True)[settings.max_versions :]
46
+ )
47
+ if old_version_ids:
48
+ PageVersion.objects.filter(id__in=old_version_ids).delete()