Browse files

use slugs insteads of ids in ward, city, and rss feed urls

  • Loading branch information...
1 parent 5c5669a commit 161da196ec6add9d314df7d8d3b593464167e4ed @visiblegovernment committed Jul 22, 2011
View
480 locale/fr/LC_MESSAGES/django.po
@@ -1,105 +1,130 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-09 18:25-0500\n"
+"POT-Creation-Date: 2011-07-20 21:53-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: mainapp/emailrules.py:18 mainapp/emailrules.py:104
+#: mainapp/emailrules.py:18 mainapp/emailrules.py:35 mainapp/emailrules.py:121
msgid "All reports"
msgstr "Tous les rapports"
#: mainapp/emailrules.py:24
msgid "the councillor's email address"
msgstr "Qui peut voir mon adresse courriel?"
-#: mainapp/emailrules.py:37
+#: mainapp/emailrules.py:41
+msgid "the 311 email address for that neighborhood"
+msgstr ""
+
+#: mainapp/emailrules.py:54
#, python-format
msgid "'%s' reports"
msgstr "'%s' rapports"
-#: mainapp/emailrules.py:56
+#: mainapp/emailrules.py:73
#, python-format
msgid "non-'%s' reports"
msgstr "non-'%s' rapports"
-#: mainapp/emailrules.py:75
+#: mainapp/emailrules.py:92
#, python-format
msgid "%s will be "
msgstr "%s seront "
-#: mainapp/emailrules.py:77
+#: mainapp/emailrules.py:94
msgid "sent to:"
msgstr "envoyé à:"
-#: mainapp/emailrules.py:81
+#: mainapp/emailrules.py:98
msgid " and "
msgstr " et "
-#: mainapp/emailrules.py:84
+#: mainapp/emailrules.py:101
msgid "cc'd to:"
msgstr "cc'd à:"
-#: mainapp/forms.py:13 mainapp/models.py:266 mainapp/models.py:314
+#: mainapp/forms.py:21 mainapp/models.py:318 mainapp/models.py:364
msgid "Name"
msgstr "Nom"
-#: mainapp/forms.py:16 mainapp/models.py:313
+#: mainapp/forms.py:24 mainapp/forms.py:353 mainapp/models.py:363
msgid "Email"
msgstr "Courriel"
-#: mainapp/forms.py:18
+#: mainapp/forms.py:26
msgid "Message"
msgstr "Message"
-#: mainapp/forms.py:48
+#: mainapp/forms.py:62
msgid "Select a Category"
msgstr "Choisissez une Catégorie"
-#: mainapp/models.py:241
+#: mainapp/forms.py:154 templates/reports/show.html:31
+msgid "This problem has been fixed."
+msgstr "Ce problème a été résolu."
+
+#: mainapp/forms.py:267 mainapp/models.py:365 mainapp/models.py:701
+msgid "Phone"
+msgstr "Téléphone"
+
+#: mainapp/forms.py:270
+msgid "First Name"
+msgstr ""
+
+#: mainapp/forms.py:273
+#, fuzzy
+msgid "Last Name"
+msgstr "Nom"
+
+#: mainapp/forms.py:326
+msgid "That email is already in use."
+msgstr ""
+
+#: mainapp/models.py:293
msgid "Subject"
msgstr "Sujet"
-#: mainapp/models.py:264
+#: mainapp/models.py:316
msgid "* Photo"
msgstr "* Photo"
-#: mainapp/models.py:265 mainapp/models.py:308
+#: mainapp/models.py:317 mainapp/models.py:358
msgid "Details"
msgstr "Détails"
-#: mainapp/models.py:315
-msgid "Phone"
-msgstr "Téléphone"
+#: mainapp/models.py:319
+msgid "Location"
+msgstr ""
-#: mainapp/views/main.py:51
+#: mainapp/views/main.py:54
msgid ""
"Sorry, we don't yet have that area in our database. Please have your area "
"councillor contact fixmystreet.ca."
msgstr ""
"Désolé, nous n'avons pas cette région dans notre base de données. S'il vous "
"plaît demander à votre échevin municipal qu'il contacte fixmystreet.ca."
-#: mainapp/views/reports/subscribers.py:18
+#: mainapp/views/reports/subscribers.py:19
msgid "You are already subscribed to this report."
msgstr "Vous vous avez déjà abonné aux mises à jour de ce rapport."
-#: mainapp/views/reports/subscribers.py:50
+#: mainapp/views/reports/subscribers.py:54
msgid "You have unsubscribed from updates to:"
msgstr "Vous vous avez désabonné des mises à jour de:"
-#: templates/about.html:4 templates/about.html.py:9 templates/base.html:61
+#: templates/about.html:4 templates/about.html.py:9 templates/base.html:77
#: templates/faq/show.html:3 templates/faq/show.html.py:7
msgid "About"
msgstr "À Propos"
@@ -162,21 +187,31 @@ msgstr "FixMyStreet (réparer ma rue) Canada"
msgid "Home"
msgstr "Page d'accueil"
-#: templates/base.html:59
+#: templates/base.html:74 templates/account/home.html:51
msgid "Submit a Report"
msgstr "Soumettre un Rapport"
-#: templates/base.html:60
+#: templates/base.html:75
msgid "View Reports"
msgstr "Voyer Rapports"
-#: templates/base.html:62 templates/contact/new.html:8
+#: templates/base.html:76
+#, fuzzy
+msgid "My Reports"
+msgstr "Tous les Rapports"
+
+#: templates/base.html:107 templates/privacy.html:4
+#, fuzzy
+msgid "Privacy"
+msgstr "Politique de Confidentialité"
+
+#: templates/base.html:108 templates/contact/new.html:8
msgid "Contact Us"
msgstr "Contactez Nous"
-#: templates/base.html:91
-msgid "Promotions"
-msgstr "Promotions"
+#: templates/base.html:109
+msgid "Hang a Poster"
+msgstr ""
#: templates/home.html:26
msgid "report/view/discuss"
@@ -236,60 +271,214 @@ msgstr "Entrez les détails du problème"
msgid "We send it to the city on your behalf"
msgstr "Nous le rapporterons à la ville en votre nom"
-#: templates/home.html:76
+#: templates/home.html:76 templates/cities/show.html:14
msgid "Reports Filed"
msgstr "Rapports "
-#: templates/home.html:80
+#: templates/home.html:77 templates/home.html.py:82 templates/home.html:87
+msgid "In the Last Year"
+msgstr "Dans la Dernière Année"
+
+#: templates/home.html:81 templates/cities/show.html:18
msgid "Reports Fixed"
msgstr "Rapports Résolus"
-#: templates/home.html:84
+#: templates/home.html:86 templates/cities/show.html:22
msgid "Reports Updated"
msgstr "Rapports Mis à Jour"
-#: templates/home.html:87 templates/cities/_report_count_table.html:28
+#: templates/home.html:90 templates/cities/_report_count_table.html:29
msgid "As reported by fixmystreet.ca users."
msgstr "Comme indiqué par les utilisateurs de fixmystreet.ca."
-#: templates/home.html:90
+#: templates/home.html:93
msgid "Recent Reports"
msgstr "Derniers Rapports"
-#: templates/search_result.html:10
+#: templates/posters.html:4 templates/posters.html.py:8
+#, fuzzy
+msgid "Posters"
+msgstr "Signalé par"
+
+#: templates/posters.html:10
+msgid ""
+"\n"
+"Help spread the word. The more people who know about fixmystreet.ca, the "
+"more \n"
+"useful it will be. Share your report on Twitter or Facebook, \n"
+"or hang a poster at a university or neighbourhood coffee shop.\n"
+msgstr ""
+
+#: templates/posters.html:18
+#, fuzzy
+msgid "Poster"
+msgstr "Signalé par"
+
+#: templates/privacy.html:8
+msgid "Privacy Policy"
+msgstr "Politique de Confidentialité"
+
+#: templates/privacy.html:10
+msgid ""
+"\n"
+"<h4>About this policy</h4>\n"
+"\n"
+"<p>This privacy policy sets out how fixmystreet.ca uses and \n"
+"protects any information that you give fixmystreet.ca when \n"
+"you use this website. fixmystreet.ca is committed to ensuring \n"
+"that your privacy is protected.</p> \n"
+"\n"
+"<h4>What we collect</h4>\n"
+"\n"
+"<p>When you submit a report, or create an account with \n"
+"fixmystreet.ca, we collect the following information:\n"
+"</p>\n"
+"<ul>\n"
+"\t<li>your name</li>\n"
+" <li>your email address</li>\n"
+" <li>your phone number</li>\n"
+"</ul>\n"
+"<h4>What we do with this information</h4> \n"
+"<p>\n"
+"If you submit a problem, we pass on your contact details, \n"
+"and details of the problem, to the municipality contact \n"
+"responsible for the area where you located the problem. \n"
+"When you submit a report or update, your name is displayed \n"
+"upon the site, but not your email address or phone number.\n"
+"</p>\n"
+"<p>\n"
+"We will never give or sell your contact information to \n"
+"anyone else, unless we are obliged to by law. \n"
+"</p>\n"
+"<h4>Security</h4>\n"
+"<p>\n"
+"We are committed to ensuring that your information \n"
+"is secure. In order to prevent unauthorised access or \n"
+"disclosure we have put in place suitable physical, \n"
+"electronic and managerial procedures to safeguard and \n"
+"secure the information we collect online.\n"
+"</p>\n"
+"<h4>How we use cookies</h4>\n"
+"<p>A cookie is a small file which asks permission to \n"
+"be placed on your computer’s hard drive. Once you agree, \n"
+"the file is added and the cookie helps analyse web traffic \n"
+"or lets you know when you visit a particular site. \n"
+"Cookies allow web applications to respond to you as an \n"
+"individual. The web application can tailor its operations to \n"
+"your needs, likes and dislikes by gathering and remembering \n"
+"information about your preferences.</p>\n"
+"\n"
+"<p>We use traffic log cookies to identify which pages \n"
+"are being used. This helps us analyse data about webpage \n"
+"traffic and improve our website in order to tailor \n"
+"it to customer needs. We only use this information \n"
+"for statistical analysis purposes and then the data is \n"
+"removed from the system.</p>\n"
+"\n"
+"<h4>Questions</h4>\n"
+"\n"
+"<p>For common questions and answers regarding fixmystreet.ca\n"
+" privacy, contact info@fixmystreet.ca, or use the contact form\n"
+" provided on the site.<p>\n"
+" \n"
+"<h4>Effective Date</h4>\n"
+"<p>\n"
+"This policy was last updated the 15 of July, 2011.\n"
+"</p>\n"
+msgstr ""
+
+#: templates/search_result.html:13
msgid "To Report a New Problem"
msgstr "Signalez un Problème"
-#: templates/search_result.html:11
+#: templates/search_result.html:14
msgid "Drag the indicated marker to the correct location on the map."
msgstr ""
"Pour signaler un problème, il suffit de faire glisser le marqueur à "
"l'emplacement sur la carte."
-#: templates/search_result.html:16
-msgid "Nearby reports filed between"
-msgstr "Problèmes proche de ici déposés entre"
-
-#: templates/search_result.html:16 templates/wards/show.html:7
-msgid "and"
-msgstr "et"
-
-#: templates/search_result.html:17 templates/wards/show.html:8
-msgid "See older reports"
-msgstr "Voir les anciens rapports"
+#: templates/search_result.html:20
+#, fuzzy
+msgid "Nearby Reports"
+msgstr "Nouveau Rapport"
-#: templates/search_result.html:22
+#: templates/search_result.html:25
msgid "fixed"
msgstr "résolus"
-#: templates/search_result.html:27
+#: templates/search_result.html:30
msgid "Zoom out to see more reports nearby."
msgstr "Zoom en arrière pour voir d'autres rapports en proximité."
-#: templates/search_result.html:29
+#: templates/search_result.html:34
msgid "No problems have been reported in this area."
msgstr "Aucun problème n'a été signalé."
+#: templates/account/edit.html:8
+msgid "Edit Profile"
+msgstr ""
+
+#: templates/account/edit.html:11
+msgid "Editing User Profile For"
+msgstr ""
+
+#: templates/account/edit.html:18 templates/reports/new.html:89
+#: templates/reports/show.html:103
+msgid "Submit"
+msgstr "Envoyez"
+
+#: templates/account/home.html:17
+#, fuzzy
+msgid "Report"
+msgstr "Nouveau Rapport"
+
+#: templates/account/home.html:18
+#, fuzzy
+msgid "Date Filed"
+msgstr "Rapports "
+
+#: templates/account/home.html:19
+#, fuzzy
+msgid "Status"
+msgstr "Statistiques"
+
+#: templates/account/home.html:20
+msgid "Days Open"
+msgstr ""
+
+#: templates/account/home.html:21
+msgid "My Role"
+msgstr ""
+
+#: templates/account/home.html:32
+#, fuzzy
+msgid "Fixed"
+msgstr "résolus"
+
+#: templates/account/home.html:32
+#, fuzzy
+msgid "Open"
+msgstr "Sur"
+
+#: templates/account/home.html:38
+#, fuzzy
+msgid "Reporter"
+msgstr "Rapports par"
+
+#: templates/account/home.html:40
+#, fuzzy
+msgid "Updater"
+msgstr "Mises à Jour"
+
+#: templates/account/home.html:41
+#, fuzzy
+msgid "Subscriber"
+msgstr "Abonnez-vous"
+
+#: templates/account/home.html:49
+msgid "You haven't yet filed any reports."
+msgstr ""
+
#: templates/admin/base_site.html:4
msgid "FixMyStreet.ca Admin"
msgstr "FixMyStreet.ca Administrateur"
@@ -310,7 +499,7 @@ msgstr ""
msgid "Log in"
msgstr ""
-#: templates/ajax/category_description.html:2 templates/reports/new.html:77
+#: templates/ajax/category_description.html:2 templates/reports/new.html:76
msgid "Please Note"
msgstr "Notez S'il Vous Plaît"
@@ -361,22 +550,27 @@ msgid "Reports for"
msgstr "Rapports par"
#: templates/cities/show.html:11
+#, fuzzy
+msgid "City Stats"
+msgstr "Statistiques"
+
+#: templates/cities/show.html:27
msgid "Top Problems"
msgstr "Problèmes Gradés"
-#: templates/cities/show.html:14
+#: templates/cities/show.html:30
msgid "Rank"
msgstr "Grade"
-#: templates/cities/show.html:15
+#: templates/cities/show.html:31
msgid "Problem"
msgstr "Problème"
-#: templates/cities/show.html:16
+#: templates/cities/show.html:32
msgid "Number of Subscribers"
msgstr "Nombre d'Abonnés"
-#: templates/cities/show.html:30
+#: templates/cities/show.html:48
msgid "Reports by Ward"
msgstr "Rapports par Quartier"
@@ -435,40 +629,129 @@ msgstr ""
" de ces 100 premier rapports confirmé ont été enregistré avec le code de "
"promotion "
+#: templates/registration/activate.html:3
+msgid "Activation Complete"
+msgstr ""
+
+#: templates/registration/activate.html:5
+msgid "Account Confirmed"
+msgstr ""
+
+#: templates/registration/activate.html:6
+msgid "Thanks for signing up!"
+msgstr ""
+
+#: templates/registration/activate.html:8
+#, fuzzy
+msgid "Return to FixMyStreet.ca"
+msgstr "FixMyStreet (réparer ma rue) Canada"
+
+#: templates/registration/error.html:9
+msgid "Login Error"
+msgstr ""
+
+#: templates/registration/login.html:3 templates/registration/login.html:6
+#: templates/registration/login.html:19
+msgid "Login"
+msgstr ""
+
+#: templates/registration/login.html:13
+msgid "Forgot?"
+msgstr ""
+
+#: templates/registration/login.html:24
+msgid "Don't have an account?"
+msgstr ""
+
+#: templates/registration/login.html:24
+msgid "Create one."
+msgstr ""
+
+#: templates/registration/login.html:28
+msgid "Or, log in using:"
+msgstr ""
+
+#: templates/registration/registration_form.html:3
+msgid "Register"
+msgstr ""
+
+#: templates/registration/registration_form.html:18
+#, fuzzy
+msgid "You are connected to fixmystreet.ca with:"
+msgstr "Comme indiqué par les utilisateurs de fixmystreet.ca."
+
+#: templates/registration/registration_form.html:22
+msgid "Disconnect"
+msgstr ""
+
+#: templates/registration/registration_form.html:25
+#, fuzzy
+msgid "Join FixMyStreet.ca!"
+msgstr "FixMyStreet (réparer ma rue) Canada"
+
+#: templates/registration/registration_form.html:27
+msgid "We need a few more pieces of information to continue..."
+msgstr ""
+
+#: templates/registration/registration_form.html:35
+msgid "Sign Up"
+msgstr ""
+
+#: templates/registration/registration_form.html:44
+msgid "Use your existing account from..."
+msgstr ""
+
+#: templates/reports/_pagination.html:5
+msgid "Previous"
+msgstr ""
+
+#: templates/reports/_pagination.html:8
+msgid "of"
+msgstr ""
+
+#: templates/reports/_pagination.html:8
+#, fuzzy
+msgid "Reports."
+msgstr "Tous les Rapports"
+
+#: templates/reports/_pagination.html:11
+msgid "Next"
+msgstr ""
+
#: templates/reports/new.html:3
msgid "New Report"
msgstr "Nouveau Rapport"
-#: templates/reports/new.html:58
+#: templates/reports/new.html:59
msgid "Submitting a report"
msgstr "Envoyé un rapport"
-#: templates/reports/new.html:67
+#: templates/reports/new.html:66
msgid "* Optional"
msgstr "* Facultatif"
-#: templates/reports/new.html:79
+#: templates/reports/new.html:78
msgid "Please be polite, concise and to the point."
msgstr ""
"S'il vous plaît noter que les mises à jour ne sont pas envoyées à la Ville."
-#: templates/reports/new.html:80
+#: templates/reports/new.html:79
msgid ""
"Please do not be abusive - abusing the service devalues the service for all "
"users."
msgstr ""
"S'il vous plaît ne pas être abusif, ceci dévalue le service pour tous les "
"utilisateurs"
-#: templates/reports/new.html:81
+#: templates/reports/new.html:80
msgid ""
"Writing your message entirely in block capitals makes it hard to read, as "
"does a lack of punctuation."
msgstr ""
"Écrire votre message entièrement en lettres majuscules ou sans ponctuation "
"rend la lecture difficile."
-#: templates/reports/new.html:82
+#: templates/reports/new.html:81
msgid ""
"Remember that FixMyStreet is primarily for reporting physical problems that "
"can be fixed. If your problem is not appropriate for submission via this "
@@ -479,18 +762,10 @@ msgstr ""
"pour ce site, rappelez-vous que vous pouvez contacter directement les "
"fonctionnaires municipaux en appelant # 311."
-#: templates/reports/new.html:90 templates/reports/show.html:100
-msgid "Submit"
-msgstr "Envoyez"
-
-#: templates/reports/new.html:98
+#: templates/reports/new.html:97
msgid "Where will my report be sent?"
msgstr "Où en rapport soit envoyé?"
-#: templates/reports/show.html:31 templates/reports/show.html.py:99
-msgid "This problem has been fixed."
-msgstr "Ce problème a été résolu."
-
#: templates/reports/show.html:35
msgid ""
"<p>Please check your email for a message from fixmystreet.ca, which will "
@@ -503,47 +778,51 @@ msgstr ""
"envoyé au département 311 de la Ville et ne sera pas visible aux autres "
"visiteurs jusqu'à ce que vous l'avez fait."
-#: templates/reports/show.html:52
+#: templates/reports/show.html:53
msgid "Category:"
msgstr "Catégorie:"
-#: templates/reports/show.html:53
+#: templates/reports/show.html:55
+msgid "Location:"
+msgstr ""
+
+#: templates/reports/show.html:57
msgid "Filed by:"
msgstr "Par:"
-#: templates/reports/show.html:56
+#: templates/reports/show.html:60
msgid "Sent to"
msgstr "Envoyé à"
-#: templates/reports/show.html:57
+#: templates/reports/show.html:61
msgid "On"
msgstr "Sur"
-#: templates/reports/show.html:64
+#: templates/reports/show.html:68
msgid "Subscribers:"
msgstr "Abonnés:"
-#: templates/reports/show.html:66 templates/reports/subscribers/new.html:12
+#: templates/reports/show.html:70 templates/reports/subscribers/new.html:12
msgid "Subscribe"
msgstr "Abonnez-vous"
-#: templates/reports/show.html:78
+#: templates/reports/show.html:82
msgid "Offensive? Unsuitable? Tell us"
msgstr "Offensif? Inappropriées? Dites-le-nous"
-#: templates/reports/show.html:82
+#: templates/reports/show.html:86
msgid "Updates"
msgstr "Mises à Jour"
-#: templates/reports/show.html:85
+#: templates/reports/show.html:89
msgid "Posted by"
msgstr "Signalé par"
-#: templates/reports/show.html:93
+#: templates/reports/show.html:97
msgid "Provide an update"
msgstr "Fournir une mise à jour"
-#: templates/reports/show.html:95
+#: templates/reports/show.html:99
msgid "Please note that updates are not sent to city officials."
msgstr ""
"S'il vous plaît noter que les mises à jour ne sont pas envoyées à la Ville."
@@ -666,19 +945,19 @@ msgstr ""
"<p>(Ne vous inquiétez pas - nous nous rappellerons de votre mise à jour "
"pendant que vous vérifier votre courriel.)</p>\n"
-#: templates/wards/_info_box.html:6
+#: templates/wards/_info_box.html:7
msgid "Councillor"
msgstr "Échevin"
-#: templates/wards/_info_box.html:7
+#: templates/wards/_info_box.html:9
msgid "Ward"
msgstr "Quartier"
#: templates/wards/show.html:7
-msgid "Reports filed between"
-msgstr "Rapports déposés entre"
+msgid "See older reports"
+msgstr "Voir les anciens rapports"
-#: templates/wards/show.html:12
+#: templates/wards/show.html:11
msgid "No problems have been reported."
msgstr "Aucun problème n'a été signalé."
@@ -688,6 +967,18 @@ msgstr ""
"Note: fixmystreet.ca s'appuie sur les utilisateurs pour signaler les "
"problèmes comme étant résolus."
+#~ msgid "Promotions"
+#~ msgstr "Promotions"
+
+#~ msgid "Nearby reports filed between"
+#~ msgstr "Problèmes proche de ici déposés entre"
+
+#~ msgid "and"
+#~ msgstr "et"
+
+#~ msgid "Reports filed between"
+#~ msgstr "Rapports déposés entre"
+
#~ msgid ""
#~ "Sorry, we couldn't retreive the coordinates of that location, please use "
#~ "the Back button on your browser and try something more specific or "
@@ -730,12 +1021,6 @@ msgstr ""
#~ msgid "Go"
#~ msgstr "Allez"
-#~ msgid "Stats"
-#~ msgstr "Statistiques"
-
-#~ msgid "In the Last Year"
-#~ msgstr "Dans la Dernière Année"
-
#~ msgid "Recent Photos"
#~ msgstr "Dernières Photos"
@@ -889,9 +1174,6 @@ msgstr ""
#~ msgid "Stephen Perkins, City Mapper, City of Ottawa"
#~ msgstr "Stephen Perkins, Cartographeur Municipal de la Ville d'Ottawa"
-#~ msgid "Privacy Policy"
-#~ msgstr "Politique de Confidentialité"
-
#~ msgid "Help"
#~ msgstr "Aide"
View
47 mainapp/feeds.py
@@ -1,7 +1,8 @@
-from django.contrib.syndication.feeds import Feed
+from django.contrib.syndication.views import Feed
from django.contrib.syndication.feeds import FeedDoesNotExist
-from django.core.exceptions import ObjectDoesNotExist
from mainapp.models import Report, ReportUpdate, City, Ward
+from django.shortcuts import get_object_or_404
+
class LatestReports(Feed):
title = "All FixMyStreet Reports"
@@ -11,15 +12,8 @@ class LatestReports(Feed):
def items(self):
return Report.objects.filter(is_confirmed=True).order_by('-created_at')[:30]
-class LatestReportsByCity(Feed):
+class CityFeedBase(Feed):
- def get_object(self, bits):
- # In case of "/rss/beats/0613/foo/bar/baz/", or other such clutter,
- # check that bits has only one member.
- if len(bits) != 1:
- raise ObjectDoesNotExist
- return City.objects.get(id=bits[0])
-
def title(self, obj):
return "FixMyStreet.ca: Reports for %s" % obj.name
@@ -35,15 +29,20 @@ def items(self, obj):
return Report.objects.filter(is_confirmed=True,ward__city=obj.id).order_by('-created_at')[:30]
-class LatestReportsByWard(Feed):
-
- def get_object(self, bits):
- # In case of "/rss/beats/0613/foo/bar/baz/", or other such clutter,
- # check that bits has only one member.
- if len(bits) != 1:
- raise ObjectDoesNotExist
- return Ward.objects.get(id=bits[0])
+class CityIdFeed(CityFeedBase):
+ ''' retrieve city by id '''
+ def get_object(self, request, id ):
+ print "getting city by object"
+ return get_object_or_404(City, pk=id)
+class CitySlugFeed(CityFeedBase):
+ ''' retrieve city by slug '''
+ def get_object(self, request, slug ):
+ print "getting city by slug"
+ return get_object_or_404(City, slug=slug)
+
+class WardFeedBase(Feed):
+
def title(self, obj):
return "FixMyStreet.ca: Reports for %s, %s" % (obj.name, obj.city.name)
@@ -58,6 +57,18 @@ def description(self, obj):
def items(self, obj):
return Report.objects.filter(is_confirmed=True,ward=obj.id).order_by('-created_at')[:30]
+
+class WardIdFeed(WardFeedBase):
+ ''' retrieve city by id '''
+ def get_object(self, request, id ):
+ return get_object_or_404(Ward, pk=id)
+
+class WardSlugFeed(WardFeedBase):
+ ''' retrieve city by slug '''
+ def get_object(self, request, city_slug, ward_slug ):
+ return get_object_or_404(Ward, slug=ward_slug,city__slug=city_slug)
+
+
# Allow subsciption to a particular report.
class LatestUpdatesByReport(Feed):
View
357 mainapp/fixtures/initial_data.json
185 additions, 172 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
26 mainapp/models.py
@@ -95,6 +95,8 @@ class City(models.Model):
category_set = models.ForeignKey(ReportCategorySet, null=True, blank=True)
objects = models.GeoManager()
+ slug = models.CharField(max_length=100, unique=True, blank=True)
+
def __unicode__(self):
return self.name
@@ -109,13 +111,22 @@ def get_categories(self):
return( categories )
def get_absolute_url(self):
- return "/cities/%d" %( self.id )
+ return "/cities/%s/" % (self.slug )
+
+ def feed_url(self):
+ return ('/feeds/cities/%s.rss' % ( self.slug) )
+
def get_rule_descriptions(self):
rules = EmailRule.objects.filter(city=self)
describer = emailrules.EmailRulesDesciber(rules,self)
return( describer.values() )
+ def save(self):
+ if not self.slug:
+ self.slug = slugify(self.name + '-' + self.province.abbrev.lower() )
+ super(City,self).save()
+
class Meta:
db_table = u'cities'
@@ -150,8 +161,19 @@ class Ward(models.Model):
# if the 'Ward' email rule is enabled
email = models.EmailField(blank=True, null=True)
+ # lookup used in URL
+ slug = models.CharField(max_length=100, blank=True)
+
def get_absolute_url(self):
- return "/wards/%d" % ( self.id )
+ return( "/cities/%s/wards/%s/" %( self.city.slug, self.slug ))
+
+ def feed_url(self):
+ return ('/feeds/cities/%s/wards/%s.rss' % ( self.city.slug, self.slug ))
+
+ def save(self):
+ if not self.slug:
+ self.slug = slugify(self.name )
+ super(Ward,self).save()
def __unicode__(self):
return self.name + ", " + self.city.name
View
14 mainapp/views/cities.py
@@ -9,9 +9,7 @@ def index(request):
context_instance=RequestContext(request))
-def show( request, city_id ):
- city = get_object_or_404(City, id=city_id)
-
+def show( request, city ):
#top problems
top_problems = Report.objects.filter(ward__city=city,is_fixed=False).annotate(subscriber_count=Count('reportsubscriber' ) ).filter(subscriber_count__gte=1).order_by('-subscriber_count')[:5]
if request.GET.has_key('test'):
@@ -29,6 +27,16 @@ def show( request, city_id ):
},
context_instance=RequestContext(request))
+def show_by_id(request, city_id ):
+ print "getting city by id"
+ city = get_object_or_404(City, id=city_id)
+ return( show(request,city ))
+
+def show_by_slug(request, city_slug ):
+ print "getting city by slug"
+ city = get_object_or_404(City, slug=city_slug)
+ return( show(request,city ))
+
def home( request, city, error_msg, disambiguate ):
#top problems
top_problems = Report.objects.filter(ward__city=city,is_fixed=False).annotate(subscriber_count=Count('reportsubscriber' ) ).filter(subscriber_count__gte=1).order_by('-subscriber_count')[:10]
View
18 mainapp/views/wards.py
@@ -7,8 +7,7 @@
import datetime
-def show( request, ward_id ):
- ward = get_object_or_404(Ward, id=ward_id)
+def show( request, ward ):
try:
page_no = int(request.GET.get('page', '1'))
@@ -47,8 +46,15 @@ def show( request, ward_id ):
"page":page,
"reports": reports },
context_instance=RequestContext(request))
-
+
+def show_by_id(request,ward_id):
+ ward = get_object_or_404(Ward, id=ward_id)
+ return(show(request,ward))
+
def show_by_number( request, city_id, ward_no ):
- city= get_object_or_404(City, id=city_id)
- ward = get_object_or_404( city=city, number=ward_no)
- show(request,ward.id)
+ ward = get_object_or_404( Ward,city__id=city_id, number=ward_no)
+ return(show(request,ward))
+
+def show_by_slug( request, city_slug, ward_slug ):
+ ward = get_object_or_404( Ward,city__slug=city_slug, slug=ward_slug)
+ return(show(request,ward))
View
2 templates/cities/_report_count_table.html
@@ -16,7 +16,7 @@
{% endifchanged %}
{% endif %}
<tr class="{% cycle 'row-odd' 'row-even' %}">
- <td><a href='/feeds{{entry.get_absolute_url}}'><img src="/media/images/rss25x26.png" /></a></td>
+ <td><a href='{{entry.feed_url}}'><img src="/media/images/rss25x26.png" /></a></td>
<td>{{entry.number}}</td>
<td><a href='{{entry.get_absolute_url}}'>{{entry.name}}</a></td>
<td>{{entry.recent_new}}</td>
View
2 templates/feeds/reports_description.html
@@ -1,2 +1,2 @@
<p>{{obj.desc}}</p>
-<em>Filed at {{obj.created_at}}</em>
+<em>Filed at {{obj.created_at}} in {{obj.ward.name}},{{obj.ward.city.name}}</em>
View
26 urls.py
@@ -2,7 +2,7 @@
from django.conf import settings
from django.http import HttpResponseRedirect
from django.contrib import admin
-from mainapp.feeds import LatestReports, LatestReportsByCity, LatestReportsByWard, LatestUpdatesByReport
+from mainapp.feeds import LatestReports, CityIdFeed, CitySlugFeed, WardIdFeed, WardSlugFeed,LatestUpdatesByReport
from mainapp.models import City
from social_auth.views import auth as social_auth
from social_auth.views import disconnect as social_disconnect
@@ -14,13 +14,6 @@
import mainapp.views.cities as cities
-feeds = {
- 'reports': LatestReports,
- 'wards': LatestReportsByWard,
- 'cities': LatestReportsByCity,
- 'report_updates': LatestUpdatesByReport,
-}
-
SSL_ON = not settings.DEBUG
admin.autodiscover()
@@ -30,11 +23,18 @@
(r'^reset/(?P<uidb36>[-\w]+)/(?P<token>[-\w]+)/$', 'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
(r'^admin/', admin.site.urls,{'SSL':SSL_ON}),
- (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^login/(?P<backend>[^/]+)/$', social_auth, name='begin'),
url(r'^disconnect/(?P<backend>[^/]+)/$', social_disconnect, name='socialdisconnect'),
+)
+urlpatterns += patterns('',
+ (r'^feeds/cities/(\d+)$', CityIdFeed()), # backwards compatibility
+ (r'^feeds/wards/(\d+)$', WardIdFeed()), # backwards compatibility
+ (r'^feeds/cities/([^/]+).rss', CitySlugFeed()),
+ (r'^feeds/cities/([^/]+)/wards/(\S+).rss', WardSlugFeed()),
+ (r'^feeds/reports/$', LatestReports()), # backwards compatibility
+ (r'^feeds/reports.rss$', LatestReports()),
)
urlpatterns += patterns('mainapp.views.main',
@@ -56,13 +56,15 @@
)
urlpatterns += patterns('mainapp.views.wards',
- (r'^wards/(\d+)', 'show'),
+ (r'^wards/(\d+)', 'show_by_id'), # support old url format
+ (r'^cities/(\S+)/wards/(\S+)/', 'show_by_slug'),
(r'^cities/(\d+)/wards/(\d+)', 'show_by_number'),
)
urlpatterns += patterns('',
- (r'^cities/(\d+)$', cities.show ),
- (r'^cities', cities.index, {}, 'cities_url_name'),
+ (r'^cities/(\d+)$', cities.show_by_id ), # support old url format
+ (r'^cities/(\S+)/$', cities.show_by_slug ),
+ (r'^cities/$', cities.index, {}, 'cities_url_name'),
)
urlpatterns += patterns( 'mainapp.views.reports.updates',

0 comments on commit 161da19

Please sign in to comment.