From f7e45da6ddc85da5a21ccaffcd151f63412a7656 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Sun, 26 Sep 2010 17:54:29 -0400 Subject: [PATCH] Adapted Django application stuff for Conservancy; and normalized to string "conservancy" within code and templates. --- www/conservancy/apps/blog/models.py | 4 ++-- www/conservancy/apps/blog/urls.py | 4 ++-- www/conservancy/apps/blog/views.py | 2 +- www/conservancy/apps/contacts/admin.py | 2 +- www/conservancy/apps/contacts/models.py | 5 ++--- www/conservancy/apps/contacts/urls.py | 2 +- www/conservancy/apps/contacts/views.py | 3 +-- www/conservancy/apps/events/models.py | 6 +++--- www/conservancy/apps/events/urls.py | 2 +- www/conservancy/apps/news/models.py | 10 +++++----- www/conservancy/apps/news/views.py | 4 ++-- www/conservancy/apps/podcast/models.py | 2 +- www/conservancy/apps/podcast/urls.py | 4 ++-- www/conservancy/apps/podcast/views.py | 2 +- www/conservancy/apps/summit_registration/urls.py | 2 +- 15 files changed, 26 insertions(+), 28 deletions(-) diff --git a/www/conservancy/apps/blog/models.py b/www/conservancy/apps/blog/models.py index 753bedb2..0db295cc 100644 --- a/www/conservancy/apps/blog/models.py +++ b/www/conservancy/apps/blog/models.py @@ -1,6 +1,6 @@ from django.db import models from django.conf import settings -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from datetime import datetime, timedelta class EntryTag(models.Model): @@ -53,7 +53,7 @@ class Entry(models.Model): # Ping google blogs and technorati. Taken from # http://blog.foozia.com/blog/2007/apr/21/ping-technorati-your-django-blog-using-xml-rpc/ def save(self): - if settings.SFLC_DEVEL or True: # "or True" means it is disabled always + if settings.CONSERVANCY_DEVEL or True: # "or True" means it is disabled always super(Entry, self).save() return diff --git a/www/conservancy/apps/blog/urls.py b/www/conservancy/apps/blog/urls.py index 0125e0ce..083f3c85 100644 --- a/www/conservancy/apps/blog/urls.py +++ b/www/conservancy/apps/blog/urls.py @@ -1,7 +1,7 @@ from django.conf.urls.defaults import * from models import Entry, EntryTag # relative import from views import last_name # relative import -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from datetime import datetime extra_context = {} @@ -20,7 +20,7 @@ urlpatterns = patterns('django.views.generic.date_based', make_object_list=True)), ) -urlpatterns += patterns('sflc.apps.blog.views', +urlpatterns += patterns('conservancy.apps.blog.views', (r'^/?$', 'custom_index', dict(info_dict, paginate_by=10)), (r'^query/$', 'query'), ) diff --git a/www/conservancy/apps/blog/views.py b/www/conservancy/apps/blog/views.py index d76b4823..5760ba21 100644 --- a/www/conservancy/apps/blog/views.py +++ b/www/conservancy/apps/blog/views.py @@ -1,6 +1,6 @@ from models import Entry, EntryTag # relative import from django.views.generic.list_detail import object_list -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from django.shortcuts import get_object_or_404, render_to_response from datetime import datetime diff --git a/www/conservancy/apps/contacts/admin.py b/www/conservancy/apps/contacts/admin.py index 92ce177d..2f8ad313 100644 --- a/www/conservancy/apps/contacts/admin.py +++ b/www/conservancy/apps/contacts/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from models import ContactEntry class ContactEntryAdmin(admin.ModelAdmin): - list_display = ('email', 'subscribe_sflc', 'subscribe_sfc') + list_display = ('email', 'subscribe_conservancy') admin.site.register(ContactEntry, ContactEntryAdmin) diff --git a/www/conservancy/apps/contacts/models.py b/www/conservancy/apps/contacts/models.py index bce1178c..bc02a865 100644 --- a/www/conservancy/apps/contacts/models.py +++ b/www/conservancy/apps/contacts/models.py @@ -1,13 +1,12 @@ from django.db import models class ContactEntry(models.Model): - """SFLC contact system + """Conservancy contact system Hopefully this will be deprecated soon""" email = models.EmailField() # should make it unique, but we really cannot - subscribe_sflc = models.BooleanField() - subscribe_sfc = models.BooleanField() + subscribe_conservancy = models.BooleanField() class Meta: ordering = ('email',) diff --git a/www/conservancy/apps/contacts/urls.py b/www/conservancy/apps/contacts/urls.py index 3fb33645..7ff3287b 100644 --- a/www/conservancy/apps/contacts/urls.py +++ b/www/conservancy/apps/contacts/urls.py @@ -1,5 +1,5 @@ from django.conf.urls.defaults import * -urlpatterns = patterns('sflc.apps.contacts.views', +urlpatterns = patterns('conservancy.apps.contacts.views', (r'^/?$', 'subscribe'), ) diff --git a/www/conservancy/apps/contacts/views.py b/www/conservancy/apps/contacts/views.py index c8a104c4..6bc12099 100644 --- a/www/conservancy/apps/contacts/views.py +++ b/www/conservancy/apps/contacts/views.py @@ -11,8 +11,7 @@ def subscribe(request): class Meta: model = ContactEntry - ContactEntryForm.base_fields['subscribe_sflc'].label = 'Receive Software Freedom Law Center updates' - ContactEntryForm.base_fields['subscribe_sfc'].label = 'Receive Software Freedom Conservancy updates' + ContactEntryForm.base_fields['subscribe_conservancy'].label = 'Receive Software Freedom Conservancy updates' if request.method == 'POST': form = ContactEntryForm(request.POST) diff --git a/www/conservancy/apps/events/models.py b/www/conservancy/apps/events/models.py index 4379dc65..26b478f0 100644 --- a/www/conservancy/apps/events/models.py +++ b/www/conservancy/apps/events/models.py @@ -1,6 +1,6 @@ from django.db import models -from sflc.apps.staff.models import Person -from sflc.apps.worldmap.models import EarthLocation +from conservancy.apps.staff.models import Person +from conservancy.apps.worldmap.models import EarthLocation from datetime import datetime, timedelta class EventTag(models.Model): @@ -29,7 +29,7 @@ class FutureEventManager(models.Manager): return super(FutureEventManager, self).get_query_set().filter(date__gte=datetime.today()) class Event(models.Model): - """Model for SFLC staff member events (presentations, etc)""" + """Model for Conservancy staff member events (presentations, etc)""" title = models.CharField(max_length=400) date = models.DateField() diff --git a/www/conservancy/apps/events/urls.py b/www/conservancy/apps/events/urls.py index 8541241f..931dc7a5 100644 --- a/www/conservancy/apps/events/urls.py +++ b/www/conservancy/apps/events/urls.py @@ -12,7 +12,7 @@ urlpatterns = patterns('django.views.generic.date_based', make_object_list=True)), ) -urlpatterns += patterns('sflc.apps.events.views', +urlpatterns += patterns('conservancy.apps.events.views', (r'^/?$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)), (r'^(?P\d{4})/(?P[-\w]+)/$', 'event_detail', dict(info_dict, slug_field='slug')), (r'^ics/$', 'future_event_ics', info_dict), diff --git a/www/conservancy/apps/news/models.py b/www/conservancy/apps/news/models.py index fa5efc16..d812d33c 100644 --- a/www/conservancy/apps/news/models.py +++ b/www/conservancy/apps/news/models.py @@ -1,7 +1,7 @@ from django.db import models from django.conf import settings -from sflc.apps.staff.models import Person -from sflc.apps.events.models import Event +from conservancy.apps.staff.models import Person +from conservancy.apps.events.models import Event from django.contrib.sites.models import Site from datetime import datetime, timedelta @@ -37,11 +37,11 @@ class PressRelease(models.Model): def is_in_past_month(self): # This function is deprecated. Use the date_within template - # filter instead (example in sflc/templates/frontpage.html) + # filter instead (example in conservancy/templates/frontpage.html) return self.pub_date > (datetime.now() - timedelta(days=30)) def save(self): - if settings.SFLC_DEVEL or True: + if settings.CONSERVANCY_DEVEL or True: super(PressRelease, self).save() return @@ -78,7 +78,7 @@ class PublicExternalArticleManager(models.Manager): return super(PublicExternalArticleManager, self).get_query_set().filter(visible=True) class ExternalArticle(models.Model): - """A system for displaying SFLC news mentions on the site. + """A system for displaying Conservancy news mentions on the site. (Currently unused) """ diff --git a/www/conservancy/apps/news/views.py b/www/conservancy/apps/news/views.py index a78fbb30..13681183 100644 --- a/www/conservancy/apps/news/views.py +++ b/www/conservancy/apps/news/views.py @@ -1,6 +1,6 @@ from django.views.generic.list_detail import object_list -from sflc.apps.news.models import ExternalArticle -from sflc.apps.events.models import Event +from conservancy.apps.news.models import ExternalArticle +from conservancy.apps.events.models import Event from datetime import datetime def custom_index(request, queryset, *args, **kwargs): diff --git a/www/conservancy/apps/podcast/models.py b/www/conservancy/apps/podcast/models.py index cbf94629..893daa7a 100644 --- a/www/conservancy/apps/podcast/models.py +++ b/www/conservancy/apps/podcast/models.py @@ -1,6 +1,6 @@ from django.db import models from django.conf import settings -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from datetime import datetime, timedelta class PodcastTag(models.Model): diff --git a/www/conservancy/apps/podcast/urls.py b/www/conservancy/apps/podcast/urls.py index bd57be65..7694d9e5 100644 --- a/www/conservancy/apps/podcast/urls.py +++ b/www/conservancy/apps/podcast/urls.py @@ -1,6 +1,6 @@ from django.conf.urls.defaults import * from models import Podcast, PodcastTag # relative import -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from datetime import datetime extra_context = {} @@ -21,7 +21,7 @@ urlpatterns = patterns('django.views.generic.date_based', # (r'^(?P[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')), ) -urlpatterns += patterns('sflc.apps.podcast.views', +urlpatterns += patterns('conservancy.apps.podcast.views', (r'^/?$', 'custom_index', dict(info_dict, paginate_by=20)), (r'^query/$', 'query'), ) diff --git a/www/conservancy/apps/podcast/views.py b/www/conservancy/apps/podcast/views.py index 90e7de10..bd45f483 100644 --- a/www/conservancy/apps/podcast/views.py +++ b/www/conservancy/apps/podcast/views.py @@ -1,6 +1,6 @@ from models import Podcast, PodcastTag # relative import from django.views.generic.list_detail import object_list -from sflc.apps.staff.models import Person +from conservancy.apps.staff.models import Person from django.shortcuts import get_object_or_404, render_to_response from datetime import datetime diff --git a/www/conservancy/apps/summit_registration/urls.py b/www/conservancy/apps/summit_registration/urls.py index c335a587..0a6d5c8b 100644 --- a/www/conservancy/apps/summit_registration/urls.py +++ b/www/conservancy/apps/summit_registration/urls.py @@ -1,5 +1,5 @@ from django.conf.urls.defaults import * -urlpatterns = patterns('sflc.apps.summit_registration.views', +urlpatterns = patterns('conservancy.apps.summit_registration.views', (r'^/?$', 'register'), )