Some small QoL changes

This commit is contained in:
Matthias Portzel 2022-09-17 07:25:29 -04:00
parent 06e49a7760
commit 650a845611
3 changed files with 17 additions and 0 deletions

View File

@ -4,5 +4,7 @@ python-decouple~=3.6
jetforce~=0.9.0
django-extensions~=3.2.1
git+https://github.com/django-haystack/django-haystack.git
git+https://tildegit.org/matthias/xapian-haystack.git

View File

@ -40,6 +40,15 @@ class Thought(models.Model):
def get_absolute_url(self):
return f"/?show={str(self.uuid)}"
@classmethod
def find(cls, identifier):
try:
return cls.objects.get(uuid=identifier)
except cls.DoesNotExist:
try:
return cls.objects.get(id=identifier)
except cls.DoesNotExist:
return None
# Honestly I'm so sick of this problem that writing out a comment here to explain why it is necessary is beyond me.
# I'm calling this CharField and not MySpecialLineNormalizingCharField

View File

@ -43,11 +43,17 @@ INSTALLED_APPS = [
"django.contrib.contenttypes",
"django.contrib.staticfiles",
"django_extensions",
"haystack",
"thoughts",
]
SHELL_PLUS_IMPORTS = [
"from thoughts import pagination"
]
HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor"
HAYSTACK_CONNECTIONS = {