Skip to content

Commit 1fa628c

Browse files
committed
converted to CBV
1 parent 689f259 commit 1fa628c

33 files changed

+1916
-1445
lines changed

README.rst

+15-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ Django-CRM
44
Django CRM is opensourse CRM developed on django framework. It has all the basic features of CRM to start with. We welcome code contributions and feature requests via github.
55

66

7-
.. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master
8-
:target: https://travis-ci.org/MicroPyramid/Django-CRM
9-
107
.. image:: https://coveralls.io/repos/github/MicroPyramid/Django-CRM/badge.svg?branch=master
118
:target: https://coveralls.io/github/MicroPyramid/Django-CRM?branch=master
129

@@ -17,8 +14,20 @@ Django CRM is opensourse CRM developed on django framework. It has all the basic
1714
.. image:: https://img.shields.io/github/license/MicroPyramid/Django-CRM.svg
1815
:target: https://pypi.python.org/pypi/Django-CRM/
1916

20-
.. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg
21-
:target: https://www.codetriage.com/micropyramid/django-crm
17+
.. list-table::
18+
:header-rows: 1
19+
:widths: 7 7 7 60
20+
:stub-columns: 1
21+
22+
* - Build Status
23+
- Codacy
24+
- Support
25+
* - .. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master
26+
- .. image:: https://api.codacy.com/project/badge/Grade/b11da5f09dd542479fd3bd53944595d2
27+
.. image:: https://api.codacy.com/project/badge/Coverage/b11da5f09dd542479fd3bd53944595d2
28+
- .. image:: https://badges.gitter.im/Micropyramid/Django-CRM.png
29+
.. image:: https://www.codetriage.com/micropyramid/django-crm/badges/users.svg
30+
2231

2332
http://django-crm.readthedocs.io for latest documentation
2433

@@ -67,5 +76,4 @@ Need additional commercial support? `Contact us here`_
6776

6877
.. _contact us here: https://micropyramid.com/contact-us/
6978

70-
.. _here: https://django-crm.micropyramid.com/
71-
79+
.. _here: https://django-crm.micropyramid.com/

accounts/forms.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ def __init__(self, *args, **kwargs):
1010
super(AccountForm, self).__init__(*args, **kwargs)
1111
for field in self.fields.values():
1212
field.widget.attrs = {"class": "form-control"}
13-
self.fields['description'].widget.attrs.update({
14-
'rows': '8'})
13+
self.fields['description'].widget.attrs.update({'rows': '8'})
1514
self.fields['assigned_to'].queryset = assigned_users
1615
self.fields['assigned_to'].required = False
1716
self.fields['teams'].required = False
@@ -28,7 +27,6 @@ def clean_phone(self):
2827
ph_length = str(client_phone)
2928
if len(ph_length) < 10 or len(ph_length) > 13:
3029
raise forms.ValidationError('Phone number must be minimum 10 Digits and maximum of 13 Digits')
31-
3230
except (ValueError, TypeError):
3331
raise forms.ValidationError('Phone Number should contain only Numbers')
3432
return client_phone
@@ -39,4 +37,4 @@ class AccountCommentForm(forms.ModelForm):
3937

4038
class Meta:
4139
model = Comment
42-
fields = ('comment', 'account', 'commented_by')
40+
fields = ('comment', 'account', 'commented_by')

accounts/templates/view_account.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ <h5>
135135
<div class="filter_col col-md-12">
136136
<div class="form-group">
137137
<label class="acc_field_label" for="id_description" data-name="name">Description</label>
138-
<div class="account_field" id="account_description" data-name="name">{{account_record.description}}</div>
138+
<div class="account_field" id="account_description" data-name="name">{{ account_record.description }}</div>
139139
</div>
140140
</div>
141141
{% endif %}
142142
</div>
143143
<div class="col-md-12">
144144
<div class="created_information">
145-
Created by <b>santharao@micropyramid.com</b> created on <i><b>April 20, 2018, 5:37 p.m.</b></i>
145+
Created by <b>{{ account_record.created_by }}</b> created on <i><b>{{ account_record.created_on }}</b></i>
146146
</div>
147147
</div>
148148

@@ -2042,7 +2042,8 @@ <h4 class="modal-title" id="myLargeModalLabel" style="text-align:center;">CASES<
20422042
if (data.error) {
20432043
$("#CommentEditError").html(data.error).show()
20442044
} else {
2045-
$("#comment_name" + data.commentid).html('<pre>' + data.comment + '</pre>')
2045+
console.log($("#comment_name" + data.comment_id))
2046+
$("#comment_name" + data.comment_id).html('<pre>' + data.comment + '</pre>')
20462047
$('#Comments_Accounts_Modal').modal('hide');
20472048
$("#id_editcomment").val("")
20482049
$("#CommentEditError").html('')

accounts/tests.py

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
from django.test import TestCase
2-
from common.models import *
3-
from accounts.models import Account
4-
from common.models import User
2+
from accounts.models import *
3+
from common.models import User, Address
54

65

76
# Create your tests here.
8-
9-
107
class AccountCreateTest(object):
118
def setUp(self):
129
self.user = User.objects.create(first_name="uday", username='uday', email='u@mp.com', role='ADMIN')
@@ -15,9 +12,11 @@ def setUp(self):
1512

1613
self.address = Address.objects.create(
1714
street="KPHB", city="HYDERABAD", state="ANDHRA PRADESH", postcode="500073", country='IN')
15+
self.shipping_address = Address.objects.create(
16+
street="KPHB", city="HYDERABAD", state="ANDHRA PRADESH", postcode="500073", country='IN')
1817
self.account = Account.objects.create(
1918
name="Uday", email="udayteja@micropyramid.com", phone="8333855552", billing_address=self.address,
20-
shipping_address=self.address, website="www.uday.com", created_by=self.user,
19+
shipping_address=self.shipping_address, website="www.uday.com", created_by=self.user,
2120
industry="SOFTWARE", description="Yes.. Testing Done")
2221
self.client.login(email='u@mp.com', password='uday2293')
2322

@@ -26,14 +25,14 @@ class AccountsCreateTestCase(AccountCreateTest, TestCase):
2625
def test_account_create_url(self):
2726
response = self.client.get('/accounts/create/', {
2827
'name': "Uday", 'email': "udayteja@micropyramid.com", 'phone': "", 'billing_address': self.address,
29-
'shipping_address': self.address, 'website': "www.uday.com",
28+
'shipping_address': self.shipping_address, 'website': "www.uday.com",
3029
'industry': "SOFTWARE", 'description': "Yes.. Testing Done"})
3130
self.assertEqual(response.status_code, 200)
3231

3332
def test_account_create_html(self):
3433
response = self.client.get('/accounts/create/', {
3534
'name': "Uday", 'email': "udayteja@micropyramid.com", 'phone': "", 'billing_address': self.address,
36-
'shipping_address': self.address, 'website': "www.uday.com",
35+
'shipping_address': self.shipping_address, 'website': "www.uday.com",
3736
'industry': "SOFTWARE", 'description': "Yes.. Testing Done"})
3837
self.assertTemplateUsed(response, 'create_account.html')
3938

@@ -93,6 +92,6 @@ class AccountCreateEmptyFormTestCase(AccountCreateTest, TestCase):
9392

9493
def test_account_creation_invalid_data(self):
9594
data = {'name': "", 'email': "", 'phone': "", 'billing_address': self.address,
96-
'shipping_address': self.address, 'website': "", 'industry': "", 'description': ""}
95+
'shipping_address': self.shipping_address, 'website': "", 'industry': "", 'description': ""}
9796
response = self.client.post('/accounts/create/', data)
9897
self.assertEqual(response.status_code, 200)

accounts/urls.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
from django.conf.urls import url
2-
from accounts import views
1+
from django.urls import path
2+
from accounts.views import (
3+
AccountsListView, CreateAccountView, AccountDetailView, AccountUpdateView,
4+
AccountDeleteView, AddCommentView, UpdateCommentView, DeleteCommentView)
35

46
app_name = 'accounts'
57

6-
78
urlpatterns = [
8-
url(r'^list/$', views.accounts_list, name='list'),
9-
url(r'^create/$', views.add_account, name='new_account'),
10-
url(r'^(?P<account_id>\d*)/view/$', views.view_account, name="view_account"),
11-
url(r'^(?P<edid>\d*)/edit/$', views.edit_account, name="edit_account"),
12-
url(r'^(?P<aid>\d*)/delete/$', views.remove_account, name="remove_account"),
13-
14-
url(r'^comment/add/$', views.add_comment, name='add_comment'),
15-
url(r'^comment/edit/$', views.edit_comment, name='edit_comment'),
16-
url(r'^comment/remove/$', views.remove_comment, name='remove_comment'),
9+
path('list/', AccountsListView.as_view(), name='list'),
10+
path('create/', CreateAccountView.as_view(), name='new_account'),
11+
path('<int:pk>/view/', AccountDetailView.as_view(), name="view_account"),
12+
path('<int:pk>/edit/', AccountUpdateView.as_view(), name="edit_account"),
13+
path('<int:pk>/delete/', AccountDeleteView.as_view(), name="remove_account"),
14+
path('comment/add/', AddCommentView.as_view(), name="add_comment"),
15+
path('comment/edit/', UpdateCommentView.as_view(), name="edit_comment"),
16+
path('comment/remove/', DeleteCommentView.as_view(), name="remove_comment"),
1717
]

0 commit comments

Comments
 (0)