summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/__init__.py0
-rw-r--r--core/apps.py6
-rw-r--r--core/config.py3
-rw-r--r--core/context.py5
-rw-r--r--core/forms.py11
-rw-r--r--core/views.py21
6 files changed, 46 insertions, 0 deletions
diff --git a/core/__init__.py b/core/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/__init__.py
diff --git a/core/apps.py b/core/apps.py
new file mode 100644
index 0000000..c0ce093
--- /dev/null
+++ b/core/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class CoreConfig(AppConfig):
+ default_auto_field = "django.db.models.BigAutoField"
+ name = "core"
diff --git a/core/config.py b/core/config.py
new file mode 100644
index 0000000..0f09404
--- /dev/null
+++ b/core/config.py
@@ -0,0 +1,3 @@
+class Config:
+
+ pass
diff --git a/core/context.py b/core/context.py
new file mode 100644
index 0000000..38a268c
--- /dev/null
+++ b/core/context.py
@@ -0,0 +1,5 @@
+from django.conf import settings
+
+
+def config_context(request):
+ return {"config": {"site_name": settings.SITE_NAME}}
diff --git a/core/forms.py b/core/forms.py
new file mode 100644
index 0000000..8a4801d
--- /dev/null
+++ b/core/forms.py
@@ -0,0 +1,11 @@
+from crispy_forms.helper import FormHelper as BaseFormHelper
+from crispy_forms.layout import Submit
+
+
+class FormHelper(BaseFormHelper):
+
+ submit_text = "Submit"
+
+ def __init__(self, form=None, submit_text=None):
+ super().__init__(form)
+ self.add_input(Submit("submit", submit_text or "Submit"))
diff --git a/core/views.py b/core/views.py
new file mode 100644
index 0000000..dbaebf9
--- /dev/null
+++ b/core/views.py
@@ -0,0 +1,21 @@
+from django.views.generic import TemplateView
+
+from statuses.views.home import Home
+from users.models import Identity
+
+
+def homepage(request):
+ if request.user.is_authenticated:
+ return Home.as_view()(request)
+ else:
+ return LoggedOutHomepage.as_view()(request)
+
+
+class LoggedOutHomepage(TemplateView):
+
+ template_name = "index.html"
+
+ def get_context_data(self):
+ return {
+ "identities": Identity.objects.filter(local=True),
+ }