comete / giag (http://gerard.geekandfree.org/)

A simple blog made with Django 1.1

Clone this repository (size: 66.1 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/comete/giag/
commit 19: 0d696e240b56
parent 18: 1afaee4b018e
branch: default
Remplacement des pages statiques par des flatpages.
Morgan LEFIEUX
17 months ago

Changed (Δ382 bytes):

raw changeset »

blog/urls.py (0 lines added, 1 lines removed)

templates/flatpages/default.html (11 lines added, 0 lines removed)

templates/static/about.html

urls.py (1 lines added, 1 lines removed)

views.py (4 lines added, 7 lines removed)

Up to file-list blog/urls.py:

@@ -15,5 +15,4 @@ urlpatterns = patterns('django.views.gen
15
15
	url(r'^(?P<year>\d{4})/$', 'date_based.archive_year', blog_dict, "year_archive"),
16
16
	(r'^$', 'date_based.archive_index', blog_dict),
17
17
	(r'^tags/(?P<monslug>[-\w]+)/$', list_by_tag),
18
	(r'^about/$','simple.direct_to_template', {'template': 'static/about.html'}),
19
18
	)

Up to file-list templates/flatpages/default.html:

1
{% extends "base.html" %}
2
3
{% block title %}{{ flatpage.title }}{% endblock %}
4
5
{% block content %}
6
7
<h1>{{ flatpage.title }}</h1>
8
9
{{ flatpage.content }}
10
11
{% endblock %}

Up to file-list urls.py:

@@ -25,7 +25,7 @@ urlpatterns = patterns('',
25
25
		(r'^accounts/logout/$','django.contrib.auth.views.logout',{'template_name': 'registration/logout.html'}),
26
26
		(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds }),
27
27
		(r'^comments/', include('django.contrib.comments.urls')),
28
		(r'^photos/$', show_gallery),
28
		(r'^photos/$', auth_flatpage),
29
29
		(r'^photologue/$', 'django.views.generic.simple.redirect_to', {'url': '/photos/'}),
30
30
		url(r'^admin/blog/entry/(?P<object_id>[0-9]+)/preview/$', preview),
31
31
		(r'^admin/(.*)', admin.site.root),

Up to file-list views.py:

1
1
# -*- coding: utf-8 -*-
2
from django.shortcuts import render_to_response
3
from django.http import Http404, HttpResponse, HttpResponseRedirect
4
from django.contrib.auth.decorators import login_required
2
from django.http import HttpResponseRedirect, HttpResponseNotFound
5
3
6
def show_gallery(request):
7
	"""Affiche la liste des albums photo apres authentification."""
4
def auth_flatpage(request):
5
	"""Redirige vers une flatpage après authentification."""
8
6
	if not request.user.is_authenticated():
9
7
		return HttpResponseRedirect('/login/?next=%s' % request.path)
10
	return render_to_response('static/photos.html')
11
8
	return HttpResponseNotFound()