Add reusable referral links
This commit is contained in:
parent
0e5f60b4eb
commit
72ac1bc1da
7 changed files with 3018 additions and 0 deletions
|
@ -10,3 +10,4 @@ requests==2.27.1
|
||||||
wagtail-generic-chooser==0.4.1
|
wagtail-generic-chooser==0.4.1
|
||||||
django-rq==2.5.1
|
django-rq==2.5.1
|
||||||
django-redis==5.2.0
|
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
|
@ -9,6 +9,7 @@ from wagtail.fields import StreamField
|
||||||
from wagtail.images import get_image_model_string
|
from wagtail.images import get_image_model_string
|
||||||
from wagtail.images.views.serve import generate_image_url
|
from wagtail.images.views.serve import generate_image_url
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
|
from wagtail.snippets.models import register_snippet
|
||||||
|
|
||||||
from website.common.utils import count_words
|
from website.common.utils import count_words
|
||||||
from website.contrib.unsplash.widgets import UnsplashPhotoChooser
|
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")
|
self.get_children().live().specific().select_related("hero_image")
|
||||||
)
|
)
|
||||||
return context
|
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
|
||||||
|
|
|
@ -25,6 +25,8 @@ RICH_TEXT_FEATURES = [
|
||||||
"document-link",
|
"document-link",
|
||||||
"code",
|
"code",
|
||||||
"strikethrough",
|
"strikethrough",
|
||||||
|
"snippet-link",
|
||||||
|
"snippet-embed",
|
||||||
]
|
]
|
||||||
|
|
||||||
RICH_TEXT_FEATURES_PLAIN = [
|
RICH_TEXT_FEATURES_PLAIN = [
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<a href="{{ object.url }}">
|
|
@ -45,6 +45,7 @@ INSTALLED_APPS = [
|
||||||
"modelcluster",
|
"modelcluster",
|
||||||
"taggit",
|
"taggit",
|
||||||
"generic_chooser",
|
"generic_chooser",
|
||||||
|
"wagtail_draftail_snippet",
|
||||||
"django_rq",
|
"django_rq",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
|
|
Loading…
Reference in a new issue