mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-15 21:31:26 +00:00
92a669ffaf
Addresses: #58 Currently implemented: * Instance name * Instance description * Code of conduct * Allow registration I decided to store this in the database so that settings can be easily changed at runtime through the web interface. (This web interface does not exist.)
19 lines
651 B
Python
19 lines
651 B
Python
from django.db import models
|
|
from fedireads.settings import DOMAIN
|
|
|
|
class SiteSettings(models.Model):
|
|
name = models.CharField(default=DOMAIN, max_length=100)
|
|
instance_description = models.TextField(
|
|
default="This instance has no description.")
|
|
code_of_conduct = models.TextField(
|
|
default="Add a code of conduct here.")
|
|
allow_registration = models.BooleanField(default=True)
|
|
|
|
@classmethod
|
|
def get(cls):
|
|
try:
|
|
return cls.objects.get(id=1)
|
|
except cls.DoesNotExist:
|
|
default_settings = SiteSettings(id=1)
|
|
default_settings.save()
|
|
return default_settings
|