Skip to content

Commit 8b98c7d

Browse files
authored
My first two cents for Django-CRM (#374)
* Update settings.py set default DEBUG_STATUS to False, and reintroduce .dev_settings for development use * customizable application title Co-authored-by: Hanson Hu <>
1 parent 31cc1e6 commit 8b98c7d

File tree

5 files changed

+36
-29
lines changed

5 files changed

+36
-29
lines changed

crm/settings.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
SECRET_KEY = 'SECRET_SECRET_SECRET'
1010

1111
# SECURITY WARNING: don't run with debug turned on in production!
12-
DEBUG = os.getenv('DEBUG_STATUS', True)
12+
DEBUG = os.getenv('DEBUG_STATUS', False)
1313

1414
ALLOWED_HOSTS = ['*']
1515

@@ -68,6 +68,7 @@
6868
'django.template.context_processors.request',
6969
'django.contrib.auth.context_processors.auth',
7070
'django.contrib.messages.context_processors.messages',
71+
'django_settings_export.settings_export',
7172
],
7273
},
7374
},
@@ -386,11 +387,16 @@
386387
# HAYSTACK_DEFAULT_OPERATOR = 'AND'
387388

388389
# Load the local settings file if it exists
389-
if os.path.isfile('crm/local_settings.py'):
390-
from .local_settings import *
390+
if DEBUG:
391+
try:
392+
from .dev_settings import *
393+
except ImportError:
394+
raise ImproperlyConfigured("No dev settings file found")
391395
else:
392-
print("No local settings file found")
393-
396+
try:
397+
from .local_settings import *
398+
except ImportError:
399+
raise ImproperlyConfigured("No local settings file found")
394400

395401
CACHES = {
396402
'default': {

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ codacy-coverage==1.3.11
2626
django-haystack==2.8.0
2727
elasticsearch==2.3
2828
python-memcached==1.59
29-
boto
29+
boto==2.49.0
30+
django-settings-export==1.2.1

templates/base.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</head>
2222
<body class="main_body_bg_color">
2323
<div class="wrapper">
24-
24+
2525
<header>
2626
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
2727

@@ -71,17 +71,17 @@
7171
{% endif %}
7272
</nav>
7373
</header>
74-
75-
74+
75+
7676
<div id="mainbody" class="main_container" style="padding-top:65px;">
77-
77+
7878
{% block breadcrumb %}
7979
{% endblock %}
80-
80+
8181
{% block content %}
8282
{% endblock %}
8383
</div>
84-
84+
8585
</div>
8686

8787
{% block js_block %}

templates/login.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
<head>
77
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8-
8+
99
<meta charset="utf-8">
1010
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
12-
<title>Django CRM</title>
13-
12+
<title>{{ settings.APPLICATION_NAME }}</title>
13+
1414
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700" rel="stylesheet">
1515
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.0/css/bootstrap.min.css" />
1616
<script defer src="https://use.fontawesome.com/releases/v5.0.10/js/all.js"></script>
1717
<link rel="stylesheet"
1818
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" />
19-
19+
2020
{% compress css %}
2121
<link href="{% static 'css/main.scss' %}" type="text/x-scss" rel="stylesheet">
2222
{% endcompress %}
@@ -36,7 +36,7 @@
3636
<div class="col-md-6 col-lg-6 col-xl-4">
3737
<div class="login_block">
3838
<div class="login_form_block">
39-
<div class="welcome">Django CRM</div>
39+
<div class="welcome">{{ settings.APPLICATION_NAME }}</div>
4040
<form method="POST" action="">
4141
<div class="form-group">
4242
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="Email" name="email">

templates/root.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<meta charset="utf-8">
1010
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
12-
<title>Django CRM</title>
12+
<title>{{ settings.APPLICATION_NAME }}</title>
1313
<link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
1414
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
1515
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" />
@@ -50,36 +50,36 @@
5050
{% block header %}
5151
<header>
5252
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
53-
53+
5454
<div class="dropdown">
5555

5656
{% if request.user.is_superuser or request.user.role == 'ADMIN' %}
5757
<a class="dropdown-toggle navbar-brand" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
5858
aria-haspopup="true" aria-expanded="false" style="color:#44535c">
59-
Django CRM
59+
{{ settings.APPLICATION_NAME }}
6060
</a>
6161
{% else %}
6262
{% if request.user.has_sales_access and request.user.has_marketing_access %}
6363
<a class="dropdown-toggle navbar-brand" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
6464
aria-haspopup="true" aria-expanded="false" style="color:#44535c">
65-
Django CRM
65+
{{ settings.APPLICATION_NAME }}
6666
</a>
6767
{% elif request.user.has_sales_access and not request.user.has_marketing_access %}
6868
<a class="navbar-brand" href="{% url 'common:home' %}" role="button" id="dropdownMenuLink" data-toggle=""
6969
aria-haspopup="true" aria-expanded="false" style="color:#44535c">
70-
Django CRM
70+
{{ settings.APPLICATION_NAME }}
7171
</a>
7272
{% elif not request.user.has_sales_access and request.user.has_marketing_access %}
7373
<a class="navbar-brand" href="{% url 'marketing:dashboard' %}" role="button" id="dropdownMenuLink" data-toggle=""
7474
aria-haspopup="true" aria-expanded="false" style="color:#44535c">
75-
Django CRM
75+
{{ settings.APPLICATION_NAME }}
7676
</a>
7777
{% else %}
7878
{{''}}
7979
{% endif %}
8080
{% endif %}
8181

82-
82+
8383

8484
<div class="dropdown-menu mt-2" aria-labelledby="dropdownMenuLink">
8585
{% if user.is_superuser or user.role == 'ADMIN' %}
@@ -97,7 +97,7 @@
9797
{{''}}
9898
{% endif %}
9999
{% endif %}
100-
100+
101101
</div>
102102
</div>
103103
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
@@ -215,16 +215,16 @@
215215
/*
216216
Usage is very simple; to block user activity for the page:
217217
$.blockUI();
218-
218+
219219
Blocking with a custom message:
220220
$.blockUI({ message: '<h1><img src="busy.gif" /> Just a moment...</h1>' });
221-
221+
222222
Blocking with custom style:
223223
$.blockUI({ css: { backgroundColor: '#f00', color: '#fff'} });
224-
224+
225225
To unblock the page:
226226
$.unblockUI();
227-
227+
228228
If you want to use the default settings and have the UI blocked for all ajax requests, it's as easy as this:
229229
$(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);
230230
*/

0 commit comments

Comments
 (0)