コード例 #1
0
def test_search_term_puts_query_in_context(rf):
    view = ListContacts()
    r = rf.get('/?q=bla')
    view.request = r
    view.object_list = []
    ctx = view.get_context_data(object_list=[])
    assert ctx['query'] == 'bla'
コード例 #2
0
def test_no_search_term_results_in_empty_query_in_context(rf):
    view = ListContacts()
    r = rf.get('/')
    view.request = r
    view.object_list = []
    ctx = view.get_context_data(object_list=[])
    assert ctx['query'] == ''
コード例 #3
0
def test_no_search_term_results_in_empty_query_in_context(rf):
    view = ListContacts()
    r = rf.get('/')
    view.request = r
    view.object_list = []
    ctx = view.get_context_data(object_list=[])
    assert ctx['query'] == ''
コード例 #4
0
def test_search_term_puts_query_in_context(rf):
    view = ListContacts()
    r = rf.get('/?q=bla')
    view.request = r
    view.object_list = []
    ctx = view.get_context_data(object_list=[])
    assert ctx['query'] == 'bla'
コード例 #5
0
ファイル: urls.py プロジェクト: Gmora08/address_book
"""address_book URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from contacts.views import ListContacts, add_contact, login_user, edit_contact, log_out, delete_contact
from contacts import urls as contacts_urls

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', ListContacts.as_view(), name='list_contacts'),
    url(r'^login_user/$', login_user, name='login_user'),
    url(r'^log_out/$', log_out, name='log_out'),
    url(r'^contact/', include(contacts_urls)),

]
コード例 #6
0
ファイル: urls.py プロジェクト: njerucyrus/kashana_work
from django.conf.urls import url
from contacts.views import (AddContact, UpdateContact, DeleteContact,
                            ListContacts, SendActivationEmailView,
                            UpdatePersonalInfo, ListContactsExport)

urlpatterns = [
    url(r'edit/$', AddContact.as_view(), name='contact_add'),
    url(r'edit/(?P<pk>\d+)/$', UpdateContact.as_view(), name='contact_update'),
    url(r'delete/(?P<pk>\d+)/$',
        DeleteContact.as_view(),
        name='contact_delete'),
    url(r'activate/(?P<pk>\d+)/$',
        SendActivationEmailView.as_view(),
        name='contact_claim_account'),
    url(r'personal/$', UpdatePersonalInfo.as_view(), name='personal_edit'),
    url(r'export_as_csv/$',
        ListContactsExport.as_view(), {'format': 'csv'},
        name='contact_list_csv'),
    url(r'export_as_excel/$',
        ListContactsExport.as_view(), {'format': 'excel'},
        name='contact_list_excel'),
    url(r'$', ListContacts.as_view(), name='contact_list'),
]
コード例 #7
0
ファイル: urls.py プロジェクト: zemanel/contact-server
from django.conf.urls import url
from contacts.views import ListContacts
from django.views.decorators.cache import cache_page

urlpatterns = [
    url(r'^contacts/',
        cache_page(1)(ListContacts.as_view()),
        name='contacts-list'),
]
コード例 #8
0
 def test_has_singletablemixin(self):
     self.assertIsInstance(ListContacts(), SingleTableMixin)
コード例 #9
0
 def setUp(self):
     self.user = ContactsManagerFactory()
     self.request = RequestFactory().get('/', {'q': 'searchterm'})
     self.request.user = self.user
     self.view = ListContacts.as_view()
コード例 #10
0
ファイル: urls.py プロジェクト: aptivate/kashana
from django.conf.urls import url
from contacts.views import (
    AddContact, UpdateContact, DeleteContact, ListContacts,
    SendActivationEmailView,
    UpdatePersonalInfo, ListContactsExport
)


urlpatterns = [
    url(r'edit/$', AddContact.as_view(), name='contact_add'),
    url(r'edit/(?P<pk>\d+)/$', UpdateContact.as_view(),
        name='contact_update'),
    url(r'delete/(?P<pk>\d+)/$', DeleteContact.as_view(),
        name='contact_delete'),
    url(r'activate/(?P<pk>\d+)/$', SendActivationEmailView.as_view(),
        name='contact_claim_account'),
    url(r'personal/$', UpdatePersonalInfo.as_view(), name='personal_edit'),
    url(r'export_as_csv/$', ListContactsExport.as_view(), {'format': 'csv'},
        name='contact_list_csv'),
    url(r'export_as_excel/$', ListContactsExport.as_view(), {'format': 'excel'},
        name='contact_list_excel'),
    url(r'$', ListContacts.as_view(), name='contact_list'),
]
コード例 #11
0
 def setUp(self):
     self.user = ContactsManagerFactory()
     self.request = RequestFactory().get('/', {'q': 'searchterm'})
     self.request.user = self.user
     self.view = ListContacts.as_view()
コード例 #12
0
"""address_book URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from contacts.views import ListContacts, add_contact, login_user, edit_contact, log_out, delete_contact
from contacts import urls as contacts_urls

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', ListContacts.as_view(), name='list_contacts'),
    url(r'^login_user/$', login_user, name='login_user'),
    url(r'^log_out/$', log_out, name='log_out'),
    url(r'^contact/', include(contacts_urls)),
]