diff options
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | euscanwww/djeuscan/feeds.py | 25 | ||||
-rw-r--r-- | euscanwww/djeuscan/templates/euscan/world_scan.html | 12 | ||||
-rw-r--r-- | euscanwww/djeuscan/urls.py | 3 |
4 files changed, 38 insertions, 3 deletions
@@ -52,7 +52,6 @@ euscanwww --------- - Add an /about/config page that describe the current config (overlays, stuff in make.conf, euscan default settings, etc..) -- Create a rss for "scan world" + packages in GET - Always keep in db all found versions (when using an API only?). But don't display them if older than current packaged version, except maybe in the "upstream_version" column. ### packages diff --git a/euscanwww/djeuscan/feeds.py b/euscanwww/djeuscan/feeds.py index 5836d87..3455de5 100644 --- a/euscanwww/djeuscan/feeds.py +++ b/euscanwww/djeuscan/feeds.py @@ -229,9 +229,32 @@ class UserFeed(BaseFeed): } def _items(self, data): - user, options = data["user"], data["options"] + user = data["user"] profile = get_profile(user) vlogs = get_account_versionlogs(profile) return vlogs, 100 + + +class WorldScanFeed(BaseFeed): + link = "/" + + def get_object(self, request): + return { + "options": request.GET, + } + + def _items(self, data): + packages = [] + for pkg_name in data["options"].getlist("package", []): + if "/" in pkg_name: + cat, name = pkg_name.split("/", 1) + pkg = Package.objects.filter(name=name, category=cat) + else: + pkg = Package.objects.filter(name=pkg_name) + packages.extend(pkg) + + vlogs = VersionLog.objects.filter(package__in=packages) + + return vlogs, 100 diff --git a/euscanwww/djeuscan/templates/euscan/world_scan.html b/euscanwww/djeuscan/templates/euscan/world_scan.html index d579dc6..30a029e 100644 --- a/euscanwww/djeuscan/templates/euscan/world_scan.html +++ b/euscanwww/djeuscan/templates/euscan/world_scan.html @@ -7,6 +7,18 @@ {{ block.super }} - World Scan {% endblock %} +{% block menu_feed %} +{{ block.super }} +<li> + <img src="{{ STATIC_URL }}/img/feed.png" alt="feed" /> + <a title="World scan Feed" + href="{% url "world_scan_feed" %}?package={{ packages|join:"&package=" }}"> + World scan feed + </a> +</li> +{% endblock %} + + {% block content %} <h2> World scan: diff --git a/euscanwww/djeuscan/urls.py b/euscanwww/djeuscan/urls.py index 39893ee..e156a4b 100644 --- a/euscanwww/djeuscan/urls.py +++ b/euscanwww/djeuscan/urls.py @@ -8,7 +8,7 @@ from djcelery.views import apply as apply_task from djeuscan.views import registered_tasks from djeuscan.feeds import PackageFeed, CategoryFeed, HerdFeed, \ - MaintainerFeed, GlobalFeed, UserFeed + MaintainerFeed, GlobalFeed, UserFeed, WorldScanFeed admin_required = user_passes_test(lambda u: u.is_superuser) @@ -117,6 +117,7 @@ urlpatterns = patterns('djeuscan.views', url(r'^statistics/charts/(?P<chart>[\w\-]+).png$', 'chart', name="chart"), url(r'^world/$', 'world', name="world"), url(r'^world/scan/$', 'world_scan', name="world_scan"), + url(r'^world/scan/feed$', WorldScanFeed(), name="world_scan_feed"), url(r'^world/favourite/$', 'favourite_world', name="favourite_world"), url(r'^world/unfavourite/$', 'unfavourite_world', name="unfavourite_world"), |