Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
repanier
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chris
repanier
Commits
b6d8d519
Commit
b6d8d519
authored
May 01, 2017
by
Patrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add subscribe_to_email field at customer level.
parent
2e7c86eb
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
141 additions
and
119 deletions
+141
-119
repanier/admin/customer.py
repanier/admin/customer.py
+1
-1
repanier/locale/fr/LC_MESSAGES/django.mo
repanier/locale/fr/LC_MESSAGES/django.mo
+0
-0
repanier/locale/fr/LC_MESSAGES/django.po
repanier/locale/fr/LC_MESSAGES/django.po
+127
-117
repanier/models/customer.py
repanier/models/customer.py
+1
-0
repanier/tools.py
repanier/tools.py
+4
-1
repanier/views/my_profile_view.py
repanier/views/my_profile_view.py
+8
-0
No files found.
repanier/admin/customer.py
View file @
b6d8d519
...
...
@@ -338,7 +338,7 @@ class CustomerWithUserDataAdmin(ImportExportMixin, admin.ModelAdmin):
else
:
fields_basic
+=
[
(
'get_admin_balance'
,
'price_list_multiplier'
,
'get_admin_date_balance'
),
(
'may_order'
,
'is_group'
,
'is_active'
),
(
'may_order'
,
'is_group'
,
'is_active'
,
'subscribe_to_email'
),
]
else
:
fields_basic
+=
[
...
...
repanier/locale/fr/LC_MESSAGES/django.mo
View file @
b6d8d519
No preview for this file type
repanier/locale/fr/LC_MESSAGES/django.po
View file @
b6d8d519
This diff is collapsed.
Click to expand it.
repanier/models/customer.py
View file @
b6d8d519
...
...
@@ -107,6 +107,7 @@ class Customer(models.Model):
is_group
=
models
.
BooleanField
(
_
(
"is_group"
),
default
=
False
)
may_order
=
models
.
BooleanField
(
_
(
"may_order"
),
default
=
True
)
valid_email
=
models
.
NullBooleanField
(
_
(
"valid_email"
),
default
=
None
)
subscribe_to_email
=
models
.
BooleanField
(
_
(
"subscribe to email"
),
default
=
True
)
preparation_order
=
models
.
IntegerField
(
null
=
True
,
blank
=
True
,
default
=
0
)
def
get_admin_date_balance
(
self
):
...
...
repanier/tools.py
View file @
b6d8d519
...
...
@@ -127,9 +127,12 @@ def send_email_with_error_log(email, from_name=None, track_customer_on_error=Fal
customer
=
models
.
Customer
.
objects
.
filter
(
user__email
=
email_to
).
order_by
(
'?'
).
first
()
if
customer
is
None
:
customer
=
models
.
Customer
.
objects
.
filter
(
email2
=
email_to
).
order_by
(
'?'
).
first
()
if
customer
is
None
or
customer
.
valid_email
is
False
:
if
customer
is
None
or
customer
.
valid_email
is
False
or
customer
.
subscribe_to_email
is
False
:
send_mail
=
False
print
(
"################################## send_email customer.valid_email == False"
)
if
send_email
:
# Append "unsubscribe" at the end of the email.
pass
else
:
customer
=
None
if
send_mail
:
...
...
repanier/views/my_profile_view.py
View file @
b6d8d519
...
...
@@ -29,6 +29,9 @@ class CustomerForm(RepanierForm):
accept_mails_from_members
=
forms
.
BooleanField
(
label
=
EMPTY_STRING
,
required
=
False
)
subscribe_to_email
=
forms
.
BooleanField
(
label
=
EMPTY_STRING
,
required
=
False
)
phone1
=
forms
.
CharField
(
label
=
_
(
'Your main phone'
),
max_length
=
25
)
phone2
=
forms
.
CharField
(
label
=
_
(
'Your secondary phone'
),
max_length
=
25
,
required
=
False
)
...
...
@@ -61,6 +64,8 @@ class CustomerForm(RepanierForm):
label
=
_
(
'My emails are visible to all members'
))
self
.
fields
[
"accept_phone_call_from_members"
].
widget
=
CheckboxWidget
(
label
=
_
(
'My phones numbers are visible to all members'
))
self
.
fields
[
"subscribe_to_email"
].
widget
=
CheckboxWidget
(
label
=
_
(
'I subscribe to emails send by repanier'
))
class
CustomerValidationForm
(
NgFormValidationMixin
,
CustomerForm
):
...
...
@@ -92,6 +97,7 @@ def my_profile_view(request):
customer
.
accept_phone_call_from_members
=
form
.
cleaned_data
.
get
(
'accept_phone_call_from_members'
)
customer
.
email2
=
form
.
cleaned_data
.
get
(
'email2'
).
lower
()
customer
.
accept_mails_from_members
=
form
.
cleaned_data
.
get
(
'accept_mails_from_members'
)
customer
.
subscribe_to_email
=
form
.
cleaned_data
.
get
(
'subscribe_to_email'
)
customer
.
city
=
form
.
cleaned_data
.
get
(
'city'
)
customer
.
address
=
form
.
cleaned_data
.
get
(
'address'
)
customer
.
picture
=
form
.
cleaned_data
.
get
(
'picture'
)
...
...
@@ -130,6 +136,8 @@ def my_profile_view(request):
field
.
initial
=
customer
.
email2
field
=
form
.
fields
[
"accept_mails_from_members"
]
field
.
initial
=
customer
.
accept_mails_from_members
field
=
form
.
fields
[
"subscribe_to_email"
]
field
.
initial
=
customer
.
subscribe_to_email
field
=
form
.
fields
[
"city"
]
field
.
initial
=
customer
.
city
field
=
form
.
fields
[
"address"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment