2020-12-05 19:38:14 -06:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from django.contrib.syndication.views import Feed
|
|
|
|
from django.urls import reverse
|
|
|
|
from .models import Movie
|
|
|
|
|
|
|
|
|
|
|
|
class LatestMoviesFeed(Feed):
|
2022-11-08 20:59:05 -06:00
|
|
|
title = "Lo ultimo en MauFlix"
|
|
|
|
link = ""
|
|
|
|
description = "Ultimas diez películas disponibles en MauFlix"
|
2020-12-05 19:38:14 -06:00
|
|
|
|
|
|
|
def items(self):
|
2022-11-08 20:59:05 -06:00
|
|
|
return Movie.objects.order_by("-id")[:10]
|
2020-12-05 19:38:14 -06:00
|
|
|
|
|
|
|
def item_title(self, item):
|
|
|
|
return item.name
|
|
|
|
|
|
|
|
def item_description(self, item):
|
2022-11-08 20:59:05 -06:00
|
|
|
message = (
|
|
|
|
f"{item.name}, Dirigida por: {item.directors.all()[0]}, Año: {item.year}"
|
|
|
|
)
|
2020-12-05 19:38:14 -06:00
|
|
|
return message
|
|
|
|
|
|
|
|
def item_link(self, item):
|
2022-11-08 20:59:05 -06:00
|
|
|
return reverse("movies", args=[item.pk])
|