Esempio n. 1
0
    def test_contacts_in_the_context_request_factory(self):
        factory = RequestFactory()
        req = factory.get(
            '/contacts/'
        )

        res = ContactsListView.as_view()(req)

        self.assertEquals(list(res.context_data['object_list']), [])

        Contact.objects.create(first_name='foo', last_name='bar')
        res = ContactsListView.as_view()(req)
        self.assertEquals(res.context_data['object_list'].count(), 1)
Esempio n. 2
0
from django.urls import path
from contacts.views import (
    ContactsListView, CreateContactView, ContactDetailView,
    UpdateContactView, RemoveContactView,ipecs,
    GetContactsView, AddCommentView, UpdateCommentView,
    DeleteCommentView, AddAttachmentsView, DeleteAttachmentsView,ip)
from contacts import views

app_name = 'contacts'


urlpatterns = [
    path('', ContactsListView.as_view(), name='list'),
    path('create/', CreateContactView.as_view(), name='add_contact'),
    path('<int:pk>/view/', ContactDetailView.as_view(), name="view_contact"),
    path('<int:pk>/edit/', UpdateContactView.as_view(), name="edit_contact"),
    path('<int:pk>/delete/',
         RemoveContactView.as_view(),
         name="remove_contact"),

    path('get/list/', GetContactsView.as_view(), name="get_contacts"),
    path('ipecs/',views.ipecs,name='ipecs'),
    path('ip/<int:phone>/',views.ip,name="phone"), 
    path('comment/add/', AddCommentView.as_view(), name="add_comment"),
    path('comment/edit/', UpdateCommentView.as_view(), name="edit_comment"),
    path('comment/remove/',
         DeleteCommentView.as_view(),
         name="remove_comment"),

    path('attachment/add/',
         AddAttachmentsView.as_view(),
Esempio n. 3
0
# from django.conf.urls import include, url

# from . import views

# urlpatterns = [
#     url(r'^$', views.index, name="index")
# ]

from django.conf.urls import url

from contacts.views import ContactsListView, ContactsDetailView, ContactsCreateView, ContactsDeleteView

urlpatterns = [
    url(r'^$', ContactsListView.as_view(template_name="home.html")),
    url(r'^contacts/(?P<pk>[0-9]+)/$',
        ContactsDetailView.as_view(template_name="contact_details.html")),
    url(r'^contacts/new',
        ContactsCreateView.as_view(template_name="new_contact.html")),
    url(r'^contacts/(?P<pk>[0-9]+)/delete/$',
        ContactsDeleteView.as_view(template_name="delete_contact.html")),
]
Esempio n. 4
0
    ContactDetailView,
    UpdateContactView,
    RemoveContactView,
    get_teams_and_users,
    GetContactsView,
    AddCommentView,
    UpdateCommentView,
    DeleteCommentView,
    AddAttachmentsView,
    DeleteAttachmentsView,
)

app_name = "contacts"

urlpatterns = [
    path("", ContactsListView.as_view(), name="list"),
    path("create/", CreateContactView.as_view(), name="add_contact"),
    path("<int:pk>/view/", ContactDetailView.as_view(), name="view_contact"),
    path("<int:pk>/edit/", UpdateContactView.as_view(), name="edit_contact"),
    path("<int:pk>/delete/",
         RemoveContactView.as_view(),
         name="remove_contact"),
    path("get/list/", GetContactsView.as_view(), name="get_contacts"),
    path("comment/add/", AddCommentView.as_view(), name="add_comment"),
    path("comment/edit/", UpdateCommentView.as_view(), name="edit_comment"),
    path("comment/remove/", DeleteCommentView.as_view(),
         name="remove_comment"),
    path("attachment/add/",
         AddAttachmentsView.as_view(),
         name="add_attachment"),
    path("attachment/remove/",