Adapted Django application stuff for Conservancy; and normalized to string

"conservancy" within code and templates.
This commit is contained in:
Bradley M. Kuhn 2010-09-26 17:54:29 -04:00
parent 8e6ea8ad71
commit f7e45da6dd
15 changed files with 26 additions and 28 deletions

View file

@ -1,6 +1,6 @@
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
from sflc.apps.staff.models import Person from conservancy.apps.staff.models import Person
from datetime import datetime, timedelta from datetime import datetime, timedelta
class EntryTag(models.Model): class EntryTag(models.Model):
@ -53,7 +53,7 @@ class Entry(models.Model):
# Ping google blogs and technorati. Taken from # Ping google blogs and technorati. Taken from
# http://blog.foozia.com/blog/2007/apr/21/ping-technorati-your-django-blog-using-xml-rpc/ # http://blog.foozia.com/blog/2007/apr/21/ping-technorati-your-django-blog-using-xml-rpc/
def save(self): 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() super(Entry, self).save()
return return

View file

@ -1,7 +1,7 @@
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from models import Entry, EntryTag # relative import from models import Entry, EntryTag # relative import
from views import last_name # 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 from datetime import datetime
extra_context = {} extra_context = {}
@ -20,7 +20,7 @@ urlpatterns = patterns('django.views.generic.date_based',
make_object_list=True)), 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'^/?$', 'custom_index', dict(info_dict, paginate_by=10)),
(r'^query/$', 'query'), (r'^query/$', 'query'),
) )

View file

@ -1,6 +1,6 @@
from models import Entry, EntryTag # relative import from models import Entry, EntryTag # relative import
from django.views.generic.list_detail import object_list 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 django.shortcuts import get_object_or_404, render_to_response
from datetime import datetime from datetime import datetime

View file

@ -2,7 +2,7 @@ from django.contrib import admin
from models import ContactEntry from models import ContactEntry
class ContactEntryAdmin(admin.ModelAdmin): class ContactEntryAdmin(admin.ModelAdmin):
list_display = ('email', 'subscribe_sflc', 'subscribe_sfc') list_display = ('email', 'subscribe_conservancy')
admin.site.register(ContactEntry, ContactEntryAdmin) admin.site.register(ContactEntry, ContactEntryAdmin)

View file

@ -1,13 +1,12 @@
from django.db import models from django.db import models
class ContactEntry(models.Model): class ContactEntry(models.Model):
"""SFLC contact system """Conservancy contact system
Hopefully this will be deprecated soon""" Hopefully this will be deprecated soon"""
email = models.EmailField() # should make it unique, but we really cannot email = models.EmailField() # should make it unique, but we really cannot
subscribe_sflc = models.BooleanField() subscribe_conservancy = models.BooleanField()
subscribe_sfc = models.BooleanField()
class Meta: class Meta:
ordering = ('email',) ordering = ('email',)

View file

@ -1,5 +1,5 @@
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('sflc.apps.contacts.views', urlpatterns = patterns('conservancy.apps.contacts.views',
(r'^/?$', 'subscribe'), (r'^/?$', 'subscribe'),
) )

View file

@ -11,8 +11,7 @@ def subscribe(request):
class Meta: class Meta:
model = ContactEntry model = ContactEntry
ContactEntryForm.base_fields['subscribe_sflc'].label = 'Receive Software Freedom Law Center updates' ContactEntryForm.base_fields['subscribe_conservancy'].label = 'Receive Software Freedom Conservancy updates'
ContactEntryForm.base_fields['subscribe_sfc'].label = 'Receive Software Freedom Conservancy updates'
if request.method == 'POST': if request.method == 'POST':
form = ContactEntryForm(request.POST) form = ContactEntryForm(request.POST)

View file

@ -1,6 +1,6 @@
from django.db import models from django.db import models
from sflc.apps.staff.models import Person from conservancy.apps.staff.models import Person
from sflc.apps.worldmap.models import EarthLocation from conservancy.apps.worldmap.models import EarthLocation
from datetime import datetime, timedelta from datetime import datetime, timedelta
class EventTag(models.Model): class EventTag(models.Model):
@ -29,7 +29,7 @@ class FutureEventManager(models.Manager):
return super(FutureEventManager, self).get_query_set().filter(date__gte=datetime.today()) return super(FutureEventManager, self).get_query_set().filter(date__gte=datetime.today())
class Event(models.Model): 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) title = models.CharField(max_length=400)
date = models.DateField() date = models.DateField()

View file

@ -12,7 +12,7 @@ urlpatterns = patterns('django.views.generic.date_based',
make_object_list=True)), 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'^/?$', 'custom_index', dict(info_dict, queryset=Event.past.all(), paginate_by=10)),
(r'^(?P<year>\d{4})/(?P<slug>[-\w]+)/$', 'event_detail', dict(info_dict, slug_field='slug')), (r'^(?P<year>\d{4})/(?P<slug>[-\w]+)/$', 'event_detail', dict(info_dict, slug_field='slug')),
(r'^ics/$', 'future_event_ics', info_dict), (r'^ics/$', 'future_event_ics', info_dict),

View file

@ -1,7 +1,7 @@
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
from sflc.apps.staff.models import Person from conservancy.apps.staff.models import Person
from sflc.apps.events.models import Event from conservancy.apps.events.models import Event
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from datetime import datetime, timedelta from datetime import datetime, timedelta
@ -37,11 +37,11 @@ class PressRelease(models.Model):
def is_in_past_month(self): def is_in_past_month(self):
# This function is deprecated. Use the date_within template # 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)) return self.pub_date > (datetime.now() - timedelta(days=30))
def save(self): def save(self):
if settings.SFLC_DEVEL or True: if settings.CONSERVANCY_DEVEL or True:
super(PressRelease, self).save() super(PressRelease, self).save()
return return
@ -78,7 +78,7 @@ class PublicExternalArticleManager(models.Manager):
return super(PublicExternalArticleManager, self).get_query_set().filter(visible=True) return super(PublicExternalArticleManager, self).get_query_set().filter(visible=True)
class ExternalArticle(models.Model): 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) (Currently unused)
""" """

View file

@ -1,6 +1,6 @@
from django.views.generic.list_detail import object_list from django.views.generic.list_detail import object_list
from sflc.apps.news.models import ExternalArticle from conservancy.apps.news.models import ExternalArticle
from sflc.apps.events.models import Event from conservancy.apps.events.models import Event
from datetime import datetime from datetime import datetime
def custom_index(request, queryset, *args, **kwargs): def custom_index(request, queryset, *args, **kwargs):

View file

@ -1,6 +1,6 @@
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
from sflc.apps.staff.models import Person from conservancy.apps.staff.models import Person
from datetime import datetime, timedelta from datetime import datetime, timedelta
class PodcastTag(models.Model): class PodcastTag(models.Model):

View file

@ -1,6 +1,6 @@
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from models import Podcast, PodcastTag # relative 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 from datetime import datetime
extra_context = {} extra_context = {}
@ -21,7 +21,7 @@ urlpatterns = patterns('django.views.generic.date_based',
# (r'^(?P<slug>[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')), # (r'^(?P<slug>[-\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'^/?$', 'custom_index', dict(info_dict, paginate_by=20)),
(r'^query/$', 'query'), (r'^query/$', 'query'),
) )

View file

@ -1,6 +1,6 @@
from models import Podcast, PodcastTag # relative import from models import Podcast, PodcastTag # relative import
from django.views.generic.list_detail import object_list 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 django.shortcuts import get_object_or_404, render_to_response
from datetime import datetime from datetime import datetime

View file

@ -1,5 +1,5 @@
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('sflc.apps.summit_registration.views', urlpatterns = patterns('conservancy.apps.summit_registration.views',
(r'^/?$', 'register'), (r'^/?$', 'register'),
) )