mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Adds setup view
This commit is contained in:
parent
e9397eaedd
commit
c31ec7dbd5
5 changed files with 50 additions and 0 deletions
24
bookwyrm/migrations/0136_auto_20220217_1708.py
Normal file
24
bookwyrm/migrations/0136_auto_20220217_1708.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Generated by Django 3.2.12 on 2022-02-17 17:08
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("bookwyrm", "0135_auto_20220217_1624"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="sitesettings",
|
||||||
|
name="admin_code",
|
||||||
|
field=models.CharField(default=uuid.uuid4, max_length=50),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="sitesettings",
|
||||||
|
name="install_mode",
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,6 +1,7 @@
|
||||||
""" the particulars for this instance of BookWyrm """
|
""" the particulars for this instance of BookWyrm """
|
||||||
import datetime
|
import datetime
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
import uuid
|
||||||
|
|
||||||
from django.db import models, IntegrityError
|
from django.db import models, IntegrityError
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
@ -24,6 +25,10 @@ class SiteSettings(models.Model):
|
||||||
instance_description = models.TextField(default="This instance has no description.")
|
instance_description = models.TextField(default="This instance has no description.")
|
||||||
instance_short_description = models.CharField(max_length=255, blank=True, null=True)
|
instance_short_description = models.CharField(max_length=255, blank=True, null=True)
|
||||||
|
|
||||||
|
# admin setup options
|
||||||
|
install_mode = models.BooleanField(default=False)
|
||||||
|
admin_code = models.CharField(max_length=50, default=uuid.uuid4)
|
||||||
|
|
||||||
# about page
|
# about page
|
||||||
registration_closed_text = models.TextField(
|
registration_closed_text = models.TextField(
|
||||||
default="We aren't taking new users at this time. You can find an open "
|
default="We aren't taking new users at this time. You can find an open "
|
||||||
|
|
|
@ -58,6 +58,8 @@ urlpatterns = [
|
||||||
views.get_unread_status_string,
|
views.get_unread_status_string,
|
||||||
name="stream-updates",
|
name="stream-updates",
|
||||||
),
|
),
|
||||||
|
# instance setup
|
||||||
|
re_path(r"^setup/?$", views.CreateAdmin.as_view(), name="setup-admin"),
|
||||||
# authentication
|
# authentication
|
||||||
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
re_path(r"^login/?$", views.Login.as_view(), name="login"),
|
||||||
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),
|
re_path(r"^login/(?P<confirmed>confirmed)/?$", views.Login.as_view(), name="login"),
|
||||||
|
|
|
@ -113,6 +113,7 @@ from .reading import ReadingStatus
|
||||||
from .report import Report
|
from .report import Report
|
||||||
from .rss_feed import RssFeed
|
from .rss_feed import RssFeed
|
||||||
from .search import Search
|
from .search import Search
|
||||||
|
from .setup import CreateAdmin
|
||||||
from .status import CreateStatus, EditStatus, DeleteStatus, update_progress
|
from .status import CreateStatus, EditStatus, DeleteStatus, update_progress
|
||||||
from .status import edit_readthrough
|
from .status import edit_readthrough
|
||||||
from .updates import get_notification_count, get_unread_status_string
|
from .updates import get_notification_count, get_unread_status_string
|
||||||
|
|
18
bookwyrm/views/setup.py
Normal file
18
bookwyrm/views/setup.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
""" Installation wizard 🧙 """
|
||||||
|
from django.template.response import TemplateResponse
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.views import View
|
||||||
|
|
||||||
|
from bookwyrm import emailing, forms, models
|
||||||
|
|
||||||
|
|
||||||
|
# pylint: disable= no-self-use
|
||||||
|
class CreateAdmin(View):
|
||||||
|
"""manage things like the instance name"""
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
"""Create admin user"""
|
||||||
|
data = {
|
||||||
|
"register_form": forms.RegisterForm()
|
||||||
|
}
|
||||||
|
return TemplateResponse(request, "setup/admin.html", data)
|
Loading…
Reference in a new issue