Ejemplo n.º 1
0
 def test_contacts_in_the_requestfactory(self):
     factory = RequestFactory()
     request = factory.get('/')
     response = ListContactView.as_view()(request)
     self.assertEquals(list(response.context_data['object_list']), [])
     Contact.objects.create(first_name='Lancelot', last_name='the Brave')
     response = ListContactView.as_view()(request)
     self.assertEquals(response.context_data['object_list'].count(), 1)
Ejemplo n.º 2
0
 def test_contacts_in_the_context_request_factory(self):
     factory = RequestFactory()
     request = factory.get('/')
     response = ListContactView.as_view()(request)
     self.assertEquals(list(response.context_data['object_list']), [])
     Contact.objects.create(first_name='foo', last_name='bar')
     response = ListContactView.as_view()(request)
     self.assertEquals(response.context_data['object_list'].count(), 1)
Ejemplo n.º 3
0
        def test_contacts_in_the_context_request_factory(self):

            factory = RequestFactory()
            request = factory.get('/')

            response = ListContactView.as_view()(request)

            self.assertEquals(list(response.context_data['object_list'].count(), 1))
Ejemplo n.º 4
0
        def test_contacts_in_the_context_request_factory(self):

            factory = RequestFactory()
            request = factory.get('/')

            response = ListContactView.as_view()(request)

            self.assertEquals(
                list(response.context_data['object_list'].count(), 1))
Ejemplo n.º 5
0
from contacts.views import ListContactView, ContactSummaryDashboard, s_refresh
from django.urls import include, path

app_name = 'contacts'
urlpatterns = [path('list', ListContactView.as_view(), name='list_contacts'),
                       path('summary', ContactSummaryDashboard.as_view(), name='contact-summary'),
                       path('s_refresh', s_refresh, name='s_refresh')]
Ejemplo n.º 6
0
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from contacts.views import ListContactView, CreateContactView
from contacts.views import UpdateContactView , ContactView, DeleteContactView,ListDeleteView
from contacts.views import hello_world
urlpatterns = patterns('',
    url(r'^$', ListContactView.as_view(),
        name='contacts-list',),

    url(r'^new/gulsah$', hello_world,name='hwllow',),
    

    url(r'^new$', CreateContactView.as_view(),
        name='contacts-new',),

 
    url(r'^edit/(?P<pk>\d+)/$', UpdateContactView.as_view(),
        name='contacts-edit',),

    url(r'^delete$', ListDeleteView.as_view(),
        name='delete-list',),
    url(r'^delete/(?P<pk>\d+)/$', DeleteContactView.as_view(),
        name='contacts-delete',),
        
    url(r'^(?P<pk>\d+)/$', ContactView.as_view(),
        name='contacts-view',),
)

urlpatterns += staticfiles_urlpatterns()