diff --git a/requirements.txt b/requirements.txt
index ba3055b..e2e770a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-Django==1.3.1
+Django==1.5
python-twitter==0.8.2
markdown==2.0.3
git+git://github.com/dominno/django-moderation.git
diff --git a/src/djangobrasil/aggregator/feeds.py b/src/djangobrasil/aggregator/feeds.py
index 0a4c669..6172fd4 100644
--- a/src/djangobrasil/aggregator/feeds.py
+++ b/src/djangobrasil/aggregator/feeds.py
@@ -5,7 +5,7 @@
#
# See LICENSE file
-from django.contrib.syndication.feeds import Feed
+from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from djangobrasil.aggregator.models import FeedItem
diff --git a/src/djangobrasil/aggregator/forms.py b/src/djangobrasil/aggregator/forms.py
index 7f3d057..748532d 100644
--- a/src/djangobrasil/aggregator/forms.py
+++ b/src/djangobrasil/aggregator/forms.py
@@ -5,8 +5,8 @@
class FeedForm(forms.ModelForm):
title = forms.CharField(label="Título", max_length=50)
email = forms.EmailField(label="E-mail")
- feed_url = forms.URLField(label="URL Feed", verify_exists=False)
- public_url = forms.URLField(label="URL Pública",verify_exists=False)
+ feed_url = forms.URLField(label="URL Feed")
+ public_url = forms.URLField(label="URL Pública")
class Meta:
model = Feed
diff --git a/src/djangobrasil/blog/feeds.py b/src/djangobrasil/blog/feeds.py
index 30c532f..6b38e17 100644
--- a/src/djangobrasil/blog/feeds.py
+++ b/src/djangobrasil/blog/feeds.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from django.contrib.syndication.feeds import Feed
+from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from djangobrasil.blog.models import Entry
diff --git a/src/djangobrasil/blog/urls.py b/src/djangobrasil/blog/urls.py
index f63d9e6..f9ca6c6 100644
--- a/src/djangobrasil/blog/urls.py
+++ b/src/djangobrasil/blog/urls.py
@@ -19,21 +19,15 @@
from django.conf.urls.defaults import *
-from djangobrasil.blog.models import Entry
+from .models import Entry
+import views
-info_dict = {
- 'queryset': Entry.published,
- 'date_field': 'pub_date',
-}
-
-urlpatterns = patterns(
- 'django.views.generic.date_based',
- (r'^(?P\d{4})/(?P[0-9]{2})/(?P\d{1,2})/(?P[-\w]+)/$',
- 'object_detail', dict(info_dict, slug_field='slug', month_format='%m')),
- (r'^(?P\d{4})/(?P[0-9]{2})/(?P\d{1,2})/$', 'archive_day', dict(info_dict, month_format='%m')),
- (r'^(?P\d{4})/(?P[0-9]{2})/$', 'archive_month', dict(info_dict, month_format='%m')),
- (r'^(?P\d{4})/$', 'archive_year', info_dict),
- (r'^/?$', 'archive_index', dict(info_dict, num_latest=5)),
+urlpatterns = patterns('django.views.generic.date_based',
+ (r'^(?P\d{4})/(?P[0-9]{2})/(?P\d{1,2})/(?P[-\w]+)/$', views.DateDetail.as_view()),
+ (r'^(?P\d{4})/(?P[0-9]{2})/(?P\d{1,2})/$', views.DayArchive.as_view()),
+ (r'^(?P\d{4})/(?P[0-9]{2})/$', views.MonthArchive.as_view()),
+ (r'^(?P\d{4})/$', views.YearArchive.as_view()),
+ (r'^$', views.Index.as_view()),
)
diff --git a/src/djangobrasil/blog/views.py b/src/djangobrasil/blog/views.py
new file mode 100644
index 0000000..112990e
--- /dev/null
+++ b/src/djangobrasil/blog/views.py
@@ -0,0 +1,33 @@
+from django.views.generic import dates
+
+from djangobrasil.blog.models import Entry
+
+
+class Index(dates.ArchiveIndexView):
+ queryset = Entry.published
+ date_field = "pub_date"
+ num_latest = 5
+
+
+class YearArchive(dates.YearArchiveView):
+ queryset = Entry.published
+ date_field = "pub_date"
+
+
+class MonthArchive(dates.MonthArchiveView):
+ queryset = Entry.published
+ date_field = "pub_date"
+ month_format = '%m'
+
+
+class DayArchive(dates.DayArchiveView):
+ queryset = Entry.published
+ date_field = "pub_date"
+ month_format = '%m'
+
+
+class DateDetail(dates.DateDetailView):
+ queryset = Entry.published
+ date_field = "pub_date"
+ month_format = '%m'
+ slug_field = 'slug'
diff --git a/src/djangobrasil/contact/tests/functional/test_contact_view.py b/src/djangobrasil/contact/tests/functional/test_contact_view.py
index bfb8582..0425222 100644
--- a/src/djangobrasil/contact/tests/functional/test_contact_view.py
+++ b/src/djangobrasil/contact/tests/functional/test_contact_view.py
@@ -47,10 +47,6 @@ def setUp(self):
'message': 'bar'
}
- def test_view_must_have_a_template_name(self):
- response = self.client.get(reverse('contact'))
- self.assertTrue(response.template_name)
-
def test_view_must_have_success_url(self):
self.assertEqual('/contato/', ContactView.success_url)
diff --git a/src/djangobrasil/settings.py b/src/djangobrasil/settings.py
index a7ca606..4d612a9 100644
--- a/src/djangobrasil/settings.py
+++ b/src/djangobrasil/settings.py
@@ -35,8 +35,8 @@
SECRET_KEY = 'set-this-in-your-settings_local.py!'
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
diff --git a/src/djangobrasil/urls.py b/src/djangobrasil/urls.py
index 2325776..fdc7142 100644
--- a/src/djangobrasil/urls.py
+++ b/src/djangobrasil/urls.py
@@ -22,11 +22,14 @@
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
from django.contrib import admin
from django.conf import settings
+from django.views.generic import ListView
+from django.views.generic.base import TemplateView
+#from django.contrib.staticfiles.urls import staticfiles_urlpatterns
+
from djangobrasil.blog.models import Entry
from djangobrasil.blog.feeds import AtomLatestEntriesFeed, RssLatestEntriesFeed
from djangobrasil.aggregator.models import FeedItem
from djangobrasil.aggregator.feeds import RssCommunityAggregatorFeed, AtomCommunityAggregatorFeed
-#from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
@@ -48,15 +51,15 @@
'comunidade': AtomCommunityAggregatorFeed,
}
+
+
aggregator_info_dict = {
'queryset': FeedItem.objects.select_related().filter(feed__accepted=True),
'paginate_by': 15,
}
-urlpatterns = patterns(
- '',
-
+urlpatterns = patterns('',
# sitemaps
(r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap',
{'sitemaps': sitemaps}),
@@ -65,23 +68,25 @@
(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'admin/login.html'}),
# feeds
- (r'^feeds/rss/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': rss_feeds}),
- (r'^feeds/atom/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': atom_feeds}),
+ (r'^feeds/rss/comunidade/$', RssCommunityAggregatorFeed()),
+ (r'^feeds/atom/comunidade/$', AtomCommunityAggregatorFeed()),
+ (r'^feeds/rss/weblog/$', RssLatestEntriesFeed()),
+ (r'^feeds/atom/weblog/$', AtomLatestEntriesFeed()),
# admin
(r'^admin/', include(admin.site.urls)),
# home page
- (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'flatfiles/homepage.html'}),
+ (r'^$', TemplateView.as_view(template_name='flatfiles/homepage.html')),
# home page beta
- (r'^beta/$', 'django.views.generic.simple.direct_to_template', {'template': 'flatfiles/beta.html'}),
+ (r'^beta/$', TemplateView.as_view(template_name='flatfiles/beta.html')),
# weblog
(r'^weblog/', include('djangobrasil.blog.urls')),
# comunidade
- (r'^comunidade/$', 'django.views.generic.list_detail.object_list', aggregator_info_dict),
+ (r'^comunidade/$', ListView.as_view(queryset=FeedItem.objects.select_related().filter(feed__accepted=True), paginate_by=15)),
#solicitacao-de-feeds
(r'^participe-dos-feeds/', 'djangobrasil.aggregator.views.participe_dos_feeds'),
@@ -94,17 +99,13 @@
)
if settings.DEBUG:
- urlpatterns += patterns(
- '',
-
+ urlpatterns += patterns('',
# static files
(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
- (r'^404/$', 'django.views.generic.simple.direct_to_template',
- {'template': '404.html'}),
+ (r'^404$', TemplateView.as_view(template_name='404.html')),
- (r'^500/$', 'django.views.generic.simple.direct_to_template',
- {'template': '500.html'}),
+ (r'^500$', TemplateView.as_view(template_name='500.html')),
)
#urlpatterns += staticfiles_urlpatterns()