Пример #1
0
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'),
]
Пример #2
0
 def test_get_object_returns_request_user(self):
     view = UpdatePersonalInfo()
     request = RequestFactory()
     request.user = UserFactory.build()
     view.request = request
     self.assertEqual(view.get_object(), request.user)
Пример #3
0
 def test_has_expected_properties(self):
     view = UpdatePersonalInfo()
     self.assertEqual(view.form_class, UpdatePersonalInfoForm)
Пример #4
0
 def test_is_instance_of_update_contacts_base(self):
     self.assertIsInstance(UpdatePersonalInfo(), UpdateContactBase)
Пример #5
0
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'),
]
Пример #6
0
 def test_get_object_returns_request_user(self):
     view = UpdatePersonalInfo()
     request = RequestFactory()
     request.user = UserFactory.build()
     view.request = request
     self.assertEqual(view.get_object(), request.user)