示例#1
0
 def setUp(self):
     self.news = Content.objects.create(
         title="news",
         description="some news",
         slug="noticias"
     )
     self.twitter = Social.objects.create(profile="flaviamissi", social_networking="twitter")
     self.content = Content.objects.create(title="foo")
     self.request = RequestFactory().get("social")
     self.response = SocialView.as_view()(self.request)
示例#2
0
 def test_should_request_without_a_news_content_and_be_success(self):
     self.news.delete()
     response = SocialView.as_view()(self.request)
     self.assertEqual(200, response.status_code)
示例#3
0
文件: urls.py 项目: mcuringa/py-tutor
    url(r'^question/(?P<pk>[0-9]+?)/delete[/]$', 'tutor.editor_views.delete_question'),
    url(r'^question/save', 'tutor.editor_views.save_question'),
    url(r'^question/(?P<pk>[0-9]+?)/diff/(?P<v1>[0-9]+?),(?P<v2>[0-9]+?)[/]$', 'tutor.editor_views.diff'),
    url(r'^question/(\d+)/revert/(\d+)[/]$', 'tutor.editor_views.revert'),
    url(r'^question/test/save', 'tutor.editor_views.add_test'),
    url(r'^question/test/(?P<pk>[0-9]+?)/del', 'tutor.editor_views.del_test'),


    # --------------------------------- USERS
    url(r'^change_pass[/]', 'tutor.user_views.change_pass'),
    url(r'^login$', 'tutor.user_views.user_login'),
    url(r'^logout$', 'tutor.user_views.user_logout'),
    url(r'^login-sorry$', 'tutor.user_views.login_error'),
    url(r'^register$', 'tutor.user_views.register'),


    # --------------------------------- USER PROFILE
    url(r'^~(.*)[/]$', 'social.views.public'),
    url(r'^profile[/]$', 'social.views.profile'),
    url(r'^api/profile[/]$', SocialView.as_view()),
    url(r'^api/friend/find[/]$', 'social.views.find_friends'),
    url(r'^api/profile/pic[/]$', 'social.views.post_profile_pic'),
    url(r'^api/friendship/add[/]$', 'social.views.add_friend_request'),
    url(r'^api/friendship/accept[/]$', 'social.views.accept_friendship'),
    url(r'^api/social/status[/]$', 'social.views.social_status'),
)

# serve the user uploaded content as static media
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

示例#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()