Example #1
0
    def test_pagination(self):
        for t in self.test_cases:

            pages = Sms.paginate(t[0], SmsTests.length)
            self.assertEqual(len(pages), t[1])

            for page in pages:
                self.assertLessEqual(len(page), SmsTests.length)
Example #2
0
    def test_pagination(self):
        for t in self.test_cases:

            pages = Sms.paginate(t[0], SmsTests.length)
            self.assertEqual(len(pages), t[1])

            for page in pages:
                self.assertLessEqual(len(page), SmsTests.length)
Example #3
0
    # Index page is in the 'portal' app
    url(r'^$', portal_views.Index.as_view(), name='index'),
    url(r'^test$', portal_views.Test.as_view(), name='test'),
    url(r'^about$', portal_views.About.as_view(), name='about'),
    url(r'^updates$', portal_views.Updates.as_view(), name='updates'),
    url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type="text/plain")),
    url(r'^favicon\.ico$', RedirectView.as_view(url='/static/images/favicon.ico')),
    
    # browse page
    url(r'^search/$', 'portal.views.browse', name='browse'),

    # portal autocomplete api
    url(r'^api/autocomplete/$', 'portal.views.portal_autocomplete'),

    # Telephony
    url(r'^sms/handler/?$', Sms.as_view()),
    url(r'^sms/error/?$', 'django_twilio.views.sms', {
        'message': Conversation.FATAL,
        'method': 'POST',
        # Due to a bug in django-twilio, method must be set to GET or POST
        # it works no matter what the request is
        }),
    url(r'^sms/callback/?$', SmsCallback.as_view(), name='sms-callback'),

    # sms info page
    url(r'^sms/?$', portal_views.SMSInfo.as_view(), name='sms-info'),

    # Contact
    url(r'^contact/(?P<location_ids>[0-9,]*)/$', 'portal.views.contact', name='contact'),
    url(
        r'^contact-thanks/$',
from django.conf.urls.defaults import patterns, include, url
from portal.sms import Sms, Conversation

from django.contrib.gis import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Index page is in the 'portal' app
    url(r'^$', 'portal.views.index'),
    url(r'^about.html$', 'portal.views.about'),
    url(r'^faq.html$', 'portal.views.faq'),

    # Verbose details about a location
    url(r'^location/$', 'portal.views.location_list'),
    url(r'^location/(?P<location_id>\d+)/$', 'portal.views.location'),
    url(r'^compare/(?P<a>\d+)/(?P<b>\d+)/$', 'portal.views.compare'),

    # Telephony
    url(r'^sms/?$', Sms.as_view()),
    url(r'^sms_error/?$', 'django_twilio.views.sms', {
        'message': Conversation.FATAL,
        'method': 'POST',    
        # Due to a bug in django-twilio, method must be set to GET or POST
        # it works no matter what the request is
    }),

    # Admin interface
    url(r'^admin/', include(admin.site.urls)),
)
Example #5
0
    url(r'^robots\.txt$', direct_to_template, {
        'template': 'robots.txt',
        'mimetype': 'text/plain'
    }),
    url(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to',
        {'url': '/static/images/favicon.ico'}),

    # browse page
    url(r'^search/$', 'portal.views.browse', name='browse'),

    # portal autocomplete api
    url(r'^api/autocomplete/(?P<query>\S+)/$',
        'portal.views.portal_autocomplete'),

    # Telephony
    url(r'^sms/handler/?$', Sms.as_view()),
    url(
        r'^sms/error/?$',
        'django_twilio.views.sms',
        {
            'message': Conversation.FATAL,
            'method': 'POST',
            # Due to a bug in django-twilio, method must be set to GET or POST
            # it works no matter what the request is
        }),
    url(r'^sms/callback/?$', SmsCallback.as_view(), name='sms-callback'),

    # sms info page
    url(r'^sms/?$', 'portal.views.smsinfo', name='sms-info'),

    # Location Views