Add reusable referral links

This commit is contained in:
Jake Howard 2022-07-14 21:41:43 +01:00
parent 0e5f60b4eb
commit 72ac1bc1da
Signed by: jake
GPG key ID: 57AFB45680EDD477
7 changed files with 3018 additions and 0 deletions

View file

@ -10,3 +10,4 @@ requests==2.27.1
wagtail-generic-chooser==0.4.1
django-rq==2.5.1
django-redis==5.2.0
wagtail-draftail-snippet==0.4.1

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@ from wagtail.fields import StreamField
from wagtail.images import get_image_model_string
from wagtail.images.views.serve import generate_image_url
from wagtail.models import Page
from wagtail.snippets.models import register_snippet
from website.common.utils import count_words
from website.contrib.unsplash.widgets import UnsplashPhotoChooser
@ -108,3 +109,17 @@ class ListingPage(BasePage, BaseContentMixin): # type: ignore[misc]
self.get_children().live().specific().select_related("hero_image")
)
return context
@register_snippet
class ReferralLink(models.Model):
url = models.URLField()
name = models.CharField(max_length=64, unique=True)
panels = [
FieldPanel("name"),
FieldPanel("url"),
]
def __str__(self) -> str:
return self.name

View file

@ -25,6 +25,8 @@ RICH_TEXT_FEATURES = [
"document-link",
"code",
"strikethrough",
"snippet-link",
"snippet-embed",
]
RICH_TEXT_FEATURES_PLAIN = [

View file

@ -0,0 +1 @@
<a href="{{ object.url }}">

View file

@ -45,6 +45,7 @@ INSTALLED_APPS = [
"modelcluster",
"taggit",
"generic_chooser",
"wagtail_draftail_snippet",
"django_rq",
"django.contrib.admin",
"django.contrib.auth",