25 lines
645 B
Python
25 lines
645 B
Python
#!/usr/bin/env python3
|
|
|
|
from django.contrib.syndication.views import Feed
|
|
from django.urls import reverse
|
|
from .models import Movie
|
|
|
|
|
|
class LatestMoviesFeed(Feed):
|
|
title = "Lo ultimo en MauFlix"
|
|
link = ""
|
|
description = "Ultimas diez películas disponibles en MauFlix"
|
|
|
|
def items(self):
|
|
return Movie.objects.order_by("-id")[:10]
|
|
|
|
def item_title(self, item):
|
|
return item.name
|
|
|
|
def item_description(self, item):
|
|
message = f"{item.name}, Dirigida por: {item.directors.all()[0]}, Año: {item.year}"
|
|
return message
|
|
|
|
def item_link(self, item):
|
|
return reverse("movie", args=[item.pk])
|