feed: Add basic rss feed
This commit is contained in:
parent
3fec80f5a7
commit
1e60a14a81
20
src/fellchensammlung/feeds.py
Normal file
20
src/fellchensammlung/feeds.py
Normal file
@ -0,0 +1,20 @@
|
||||
from django.contrib.syndication.views import Feed
|
||||
|
||||
from django.urls import reverse
|
||||
from .models import AdoptionNotice
|
||||
|
||||
|
||||
class LatestAdoptionNoticesFeed(Feed):
|
||||
title = "Nptfellchen"
|
||||
link = "/rss/"
|
||||
description = "Updates zu neuen Vermittlungen."
|
||||
|
||||
def items(self):
|
||||
return AdoptionNotice.objects.order_by("-created_at")[:5]
|
||||
|
||||
def item_title(self, item):
|
||||
return item.name
|
||||
|
||||
def item_description(self, item):
|
||||
return item.description
|
||||
|
@ -10,7 +10,7 @@
|
||||
<a class="nav-link " href="{% url "search" %}"><i class="fas fa-search"></i> Suchen</a>
|
||||
<a class="nav-link " href="{% url "add-adoption" %}"><i class="fas fa-"></i> Vermittlung hinzufügen</a>
|
||||
<a class="nav-link " href="{% url "about" %}"><i class="fas fa-info"></i> Über uns</a>
|
||||
<a class="nav-link " href=""><i class="fas fa-feather"></i> RSS</a>
|
||||
<a class="nav-link " href="{% url "rss" %}"><i class="fas fa-feather"></i> RSS</a>
|
||||
|
||||
</nav>
|
||||
<div class="header-right">
|
||||
|
@ -2,11 +2,13 @@ from django.urls import path, include
|
||||
from django_registration.backends.activation.views import RegistrationView
|
||||
|
||||
from .forms import CustomRegistrationForm
|
||||
from .feeds import LatestAdoptionNoticesFeed
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("rss/", LatestAdoptionNoticesFeed(), name="rss"),
|
||||
# ex: /animal/5/
|
||||
path("<int:animal_id>/", views.animal_detail, name="animal-detail"),
|
||||
# ex: /adoption_notice/7/
|
||||
|
Loading…
Reference in New Issue
Block a user