Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Razzhivin
committed
Mar 10, 2012
1 parent
8fdfb11
commit d6e4387
Showing
12 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: UTF-8 -*- | ||
from django.db.models.query_utils import Q | ||
from conf.settings import LATEST_VIDEOS_LIMIT | ||
from models import VideoPage | ||
|
||
|
||
__author__ = 'Razzhivin Alexander' | ||
__email__ = 'admin@httpbots.com' | ||
|
||
|
||
def latest_users_videos(request): | ||
result = VideoPage.not_removed_objects.latest_videos_filter() | ||
return {'latest_users_videos': result} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
videopages/templates/videopages/latest_users_videos_sidebar.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% load i18n %} | ||
|
||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
$("#latest-users-videos-rss-button").click(function(){ | ||
document.location.href='{% url videopages_latest_users_videos %}'; | ||
}) | ||
}); | ||
</script> | ||
<ul class="nav nav-list"> | ||
<li class="nav-header"> | ||
{% trans 'Latest users videos' %} | ||
<input id="latest-users-videos-rss-button" type="image" name="submit" id="submit" src="{{ STATIC_URL }}videopages/img/rss.png"> | ||
</li> | ||
{% for video in latest_users_videos %} | ||
<li> | ||
<a href="{% url videopages_page video.author video.slug %}"><i class="icon-film"></i>{{ video.title }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: UTF-8 -*- | ||
from django.contrib.auth.models import User | ||
from django.contrib.syndication.views import Feed | ||
from django.shortcuts import get_object_or_404 | ||
from django.utils.translation import ugettext as _ | ||
from videopages.models import VideoPage | ||
|
||
__author__ = 'Razzhivin Alexander' | ||
__email__ = 'admin@httpbots.com' | ||
|
||
|
||
class LatestUsersVideosFeed(Feed): | ||
title = _("Latest users videos") | ||
link = "/rss/" | ||
description = _("Updates on adding new videos by users") | ||
|
||
def item_title(self, item): | ||
return item.title | ||
|
||
def item_description(self, item): | ||
return item.description | ||
|
||
def items(self): | ||
return VideoPage.not_removed_objects.latest_videos_filter() | ||
|
||
|
||
class LatestUserVideosFeed(Feed): | ||
|
||
def get_object(self, request, username): | ||
return get_object_or_404(User, username=username) | ||
|
||
def title(self, obj): | ||
return "%s %s" % (_("Latest published videos by"), obj.username) | ||
|
||
def description(self, obj): | ||
return "%s %s" % (_("Updates on adding new videos by"), obj.username) | ||
|
||
def link(self, obj): | ||
return obj.get_absolute_url() | ||
|
||
def items(self, obj): | ||
return VideoPage.not_removed_objects.latest_videos_filter(author=obj) |