From 3b312c8295065154d88e64a308354887862e4ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org> Date: Fri, 11 Feb 2022 05:21:19 +0100 Subject: [PATCH] Add Django job openings RSS feed --- scipost_django/scipost/feeds.py | 20 ++++++++++++++++++++ scipost_django/scipost/urls.py | 14 +++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/scipost_django/scipost/feeds.py b/scipost_django/scipost/feeds.py index dc8c901a5..81c01cb35 100644 --- a/scipost_django/scipost/feeds.py +++ b/scipost_django/scipost/feeds.py @@ -10,6 +10,7 @@ from django.utils.feedgenerator import Atom1Feed from django.urls import reverse from django.db.models import Q +from careers.models import JobOpening from comments.models import Comment from commentaries.models import Commentary from journals.models import Publication @@ -179,3 +180,22 @@ class LatestPublicationsFeedAtom(LatestPublicationsFeedRSS): return datetime.datetime(item.publication_date.year, item.publication_date.month, item.publication_date.day) + + +class DjangoJobOpeningsFeedRSS(Feed): + title = 'SciPost: Dev Jobs' + link = '/careers/django/' + description = "SciPost: Django dev job openings" + + def items(self): + return JobOpening.objects.publicly_visible().filter( + description__icontains='django') + + def item_title(self, item): + return item.title + + def item_description(self, item): + return item.short_description + + def item_link(self, item): + return item.get_absolute_url() diff --git a/scipost_django/scipost/urls.py b/scipost_django/scipost/urls.py index c63b08392..23f4df0d5 100644 --- a/scipost_django/scipost/urls.py +++ b/scipost_django/scipost/urls.py @@ -9,9 +9,12 @@ from django.views.generic.base import RedirectView from django.urls import include, path, re_path from . import views, sso -from .feeds import LatestNewsFeedRSS, LatestNewsFeedAtom, LatestCommentsFeedRSS,\ - LatestCommentsFeedAtom, LatestSubmissionsFeedRSS, LatestSubmissionsFeedAtom,\ - LatestPublicationsFeedRSS, LatestPublicationsFeedAtom +from .feeds import ( + LatestNewsFeedRSS, LatestNewsFeedAtom, LatestCommentsFeedRSS, + LatestCommentsFeedAtom, LatestSubmissionsFeedRSS, LatestSubmissionsFeedAtom, + LatestPublicationsFeedRSS, LatestPublicationsFeedAtom, + DjangoJobOpeningsFeedRSS, +) from journals import views as journals_views from journals.regexes import ISSUE_DOI_LABEL_REGEX,\ @@ -300,6 +303,11 @@ urlpatterns = [ LatestPublicationsFeedAtom(), name='feeds_atom_publications' ), + path( + 'rss/careers/django/', + DjangoJobOpeningsFeedRSS(), + name='feeds_django_job_openings' + ), path( 'atom/publications/<specialty:specialty>', LatestPublicationsFeedAtom(), -- GitLab