def setUp(self):
     self.request = RequestFactory().get('activities')
     self.content = Content.objects.create(
         title="Atividades",
         description="foo bar",
         slug="atividades"
     )
     self.activity = Activity.objects.create(
         title="do nothing",
         description="yes, that's a valid activity'"
     )
     self.response = ActivitiesView.as_view()(self.request)
 def test_should_not_get_error_when_theres_no_content_activity_in_the_database(self):
     self.content.delete()
     response = ActivitiesView.as_view()(self.request)
     self.assertEqual(200, response.status_code)
Exemple #3
0
from django.conf.urls import url
from activities.views import ActivitiesView, DetailActivitiesView, UserGatheringView

urlpatterns = [
    url(r'^gatherings/$', ActivitiesView.as_view()),
    url(r'^gatherings/(?P<pk>\d+)/$', DetailActivitiesView.as_view()),
    url(r'^gatherings/(?P<pk>\d+)/join/$', UserGatheringView.as_view()),
]
Exemple #4
0
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from activities.views import ActivitiesView, ActivityView
from contact.views import ContactView
from index.views import IndexView
from our_installations.views import OurInstallationsView
from partners.views import PartnersView
from social.views import SocialView


admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'atividades/$', ActivitiesView.as_view(), name='activities'),
    url(r'atividades/(?P<slug>[\w-]+)$$', ActivityView.as_view(), name='activity'),
    url(r'nossas-instalacoes/$', OurInstallationsView.as_view(), name='our_installations'),
    url(r'parceiros/$', PartnersView.as_view(), name='partners'),
    url(r'noticias/$', SocialView.as_view(), name='social'),
    url(r'contato/$', ContactView.as_view(), name='contact'),
    url(r'^/?$', IndexView.as_view(), name='index'),

    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT})
)

urlpatterns += staticfiles_urlpatterns()