Skip to content

Commit

Permalink
rss and atom feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodraak committed Nov 5, 2014
1 parent f716628 commit 2191279
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 23 deletions.
5 changes: 3 additions & 2 deletions assets/sass/_iteam.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ header
}
}

.home_go_to_button
.button-center
{
text-align: center;
display: table;
margin: 0 auto;
}

/* logo */
Expand Down
4 changes: 2 additions & 2 deletions assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $iteam_base_darken: 7%;
@import "foundation/components/forms"; // *requires components/buttons
@import "foundation/components/custom-forms"; // *requires components/buttons, components/forms
@import "foundation/components/button-groups"; // *requires components/buttons
// @import "foundation/components/dropdown-buttons"; // *requires components/buttons
@import "foundation/components/dropdown-buttons"; // *requires components/buttons
@import "foundation/components/split-buttons"; // *requires components/buttons
// @import "foundation/components/flex-video";
@import "foundation/components/section";
Expand All @@ -67,7 +67,7 @@ $iteam_base_darken: 7%;
@import "foundation/components/tables";
@import "foundation/components/thumbs";
// @import "foundation/components/tooltips";
// @import "foundation/components/dropdown";
@import "foundation/components/dropdown";


//@import "compass";
Expand Down
1 change: 0 additions & 1 deletion cdc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ todo long run
#########################################################

to do now
- syndication (rss + atom) : https://docs.djangoproject.com/en/dev/ref/contrib/syndication/
- media sociaux (syncro fb, twitter, google) -> https://github.com/foxmask/django-th
- news / tuto / articles : export pdf (pandoc)

Expand Down
57 changes: 57 additions & 0 deletions iTeam/events/feeds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Adrien Chardon
# @Date: 2014-11-05 12:04:47
# @Last Modified by: Adrien Chardon
# @Last Modified time: 2014-11-05 12:08:31

# This file is part of iTeam.org.
# Copyright (C) 2014 Adrien Chardon (Nodraak).
#
# iTeam.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iTeam.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with iTeam.org. If not, see <http://www.gnu.org/licenses/>.


from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed

from iTeam.events.models import Event


class LastEventsFeedRSS(Feed):
title = "Événements"
link = "/events/list/"
description = "Les derniers événements de l'iTeam"

def items(self):
return Event.objects.order_by('-date_start')[:5]

def item_title(self, item):
return item.title

def item_pubdate(self, item):
return item.date_start

def item_description(self, item):
return item.text

def item_author_name(self, item):
return item.author

def item_link(self, item):
return item.get_absolute_url()


class LastEventsFeedATOM(LastEventsFeedRSS):
feed_type = Atom1Feed
subtitle = LastEventsFeedRSS.description
11 changes: 7 additions & 4 deletions iTeam/events/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @Author: Adrien Chardon
# @Date: 2014-08-20 14:39:03
# @Last Modified by: Adrien Chardon
# @Last Modified time: 2014-10-30 22:55:53
# @Last Modified time: 2014-11-05 12:08:17

# This file is part of iTeam.org.
# Copyright (C) 2014 Adrien Chardon (Nodraak).
Expand All @@ -24,10 +24,13 @@

from django.conf.urls import patterns, url

from iTeam.events import views
from iTeam.events import views, feeds


urlpatterns = patterns('',
url(r'^feed/rss/$', feeds.LastEventsFeedRSS(), name='events_feed_rss'),
url(r'^feed/atom/$', feeds.LastEventsFeedATOM(), name='events_feed_atom'),

urlpatterns = patterns(
'',
url(r'^list/$', views.index_list, name='index_list'),
url(r'^week/(?P<days_since_epoch>\d+)/$', views.index_week, name='index_week'),
url(r'^month/(?P<year>\d+)/(?P<month>\d+)/$', views.index_month, name='index_month'),
Expand Down
57 changes: 57 additions & 0 deletions iTeam/publications/feeds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Adrien Chardon
# @Date: 2014-11-05 10:54:20
# @Last Modified by: Adrien Chardon
# @Last Modified time: 2014-11-05 11:06:41

# This file is part of iTeam.org.
# Copyright (C) 2014 Adrien Chardon (Nodraak).
#
# iTeam.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iTeam.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with iTeam.org. If not, see <http://www.gnu.org/licenses/>.


from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed

from iTeam.publications.models import Publication


class LastPublicationsFeedRSS(Feed):
title = "Publications"
link = "/publications/"
description = "Les dernières publications de l'iTeam"

def items(self):
return Publication.objects.order_by('-pub_date')[:5]

def item_title(self, item):
return item.title

def item_pubdate(self, item):
return item.pub_date

def item_description(self, item):
return item.subtitle

def item_author_name(self, item):
return item.author

def item_link(self, item):
return item.get_absolute_url()


class LastPublicationsFeedATOM(LastPublicationsFeedRSS):
feed_type = Atom1Feed
subtitle = LastPublicationsFeedRSS.description
11 changes: 7 additions & 4 deletions iTeam/publications/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @Author: Adrien Chardon
# @Date: 2014-07-10 11:43:53
# @Last Modified by: Adrien Chardon
# @Last Modified time: 2014-10-30 22:06:14
# @Last Modified time: 2014-11-05 12:04:16

# This file is part of iTeam.org.
# Copyright (C) 2014 Adrien Chardon (Nodraak).
Expand All @@ -24,10 +24,13 @@

from django.conf.urls import patterns, url

from iTeam.publications import views
from iTeam.publications import views, feeds


urlpatterns = patterns('',
url(r'^feed/rss/$', feeds.LastPublicationsFeedRSS(), name='publications_feed_rss'),
url(r'^feed/atom/$', feeds.LastPublicationsFeedATOM(), name='publications_feed_atom'),

urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(r'^create/$', views.create, name='create'),
url(r'^view/(?P<publication_id>\d+)/(?P<publication_slug>.+)/$', views.detail, name='detail'),
Expand Down
1 change: 1 addition & 0 deletions prod/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* cp settings_prod.py iTeam/ : change infos + db (mysql / postgresql)
* python manage.py collectstatic
* python manage.py : syncdb + migrate + loaddata
* admin : add profile for superuser + change site info
* Nginx
* apt-get install
* Conf file :
Expand Down
2 changes: 1 addition & 1 deletion prod/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
User-agent: *
Disallow: /admin
#Sitemap: http://beta.iteam.org/sitemaps/sitemap.xml
Sitemap: http://beta.iteam.org/sitemap.xml
3 changes: 2 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@
{% endif %}

{# js #}
<script src="{% static "javascripts/vendor/jquery.js" %}"></script> <!-- usefull ? -->
<script src="{% static "javascripts/vendor/jquery.js" %}"></script>
<script src="{% static "javascripts/foundation/foundation.js" %}"></script>
<script src="{% static "javascripts/foundation/foundation.topbar.js" %}"></script>
<script src="{% static "javascripts/foundation/foundation.alerts.js" %}"></script>
<script src="{% static "javascripts/foundation/foundation.dropdown.js" %}"></script>

<script>
$(document).foundation();
Expand Down
34 changes: 26 additions & 8 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,19 @@ <h1>
</div>
{% endfor %}
<div class="row">
<div class="home_go_to_button">
<a href="{% url 'publications:index' %}" class="button radius">
Aller aux publications
</a>
<div class="large-12 columns">
<div class="button-group button-center">
<a href="{% url 'publications:index' %}" class="button radius">
Aller aux publications
</a>
<a href="#" class="button radius secondary dropdown" data-dropdown="publications-drop-feeds">
S’abonner
</a><br />
<ul id="publications-drop-feeds" class="f-dropdown">
<li><a href="{% url 'publications:publications_feed_rss' %}">Nouveaux tutoriels (RSS)</a></li>
<li><a href="{% url 'publications:publications_feed_atom' %}">Nouveaux tutoriels (ATOM)</a></li>
</ul>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -104,10 +113,19 @@ <h1>
</div>
{% endfor %}
<div class="row">
<div class="home_go_to_button">
<a href="{% url 'events:index_list' %}" class="button radius">
Aller aux events
</a>
<div class="large-12 columns">
<div class="button-group button-center">
<a href="{% url 'events:index_list' %}" class="button radius">
Aller aux events
</a>
<a href="#" class="button radius secondary dropdown" data-dropdown="events-drop-feeds">
S’abonner
</a><br />
<ul id="events-drop-feeds" class="f-dropdown">
<li><a href="{% url 'events:events_feed_rss' %}">Nouveaux évémements (RSS)</a></li>
<li><a href="{% url 'events:events_feed_atom' %}">Nouveaux évémements (ATOM)</a></li>
</ul>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 2191279

Please sign in to comment.