Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jean Michel Rouly
bookshare
Commits
3cc948c1
Commit
3cc948c1
authored
May 01, 2015
by
Daniel W Bond
Browse files
count the number of emails a student sends
parent
c1596b5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
bookshare/core/models.py
View file @
3cc948c1
...
@@ -14,6 +14,8 @@ class Student(TimeStampedModel):
...
@@ -14,6 +14,8 @@ class Student(TimeStampedModel):
slug
=
AutoSlugField
(
populate_from
=
'user'
,
unique
=
True
)
slug
=
AutoSlugField
(
populate_from
=
'user'
,
unique
=
True
)
emails_sent
=
models
.
PositiveIntegerField
(
default
=
0
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'profile'
,
kwargs
=
{
'slug'
:
self
.
slug
})
return
reverse
(
'profile'
,
kwargs
=
{
'slug'
:
self
.
slug
})
...
...
bookshare/trades/views.py
View file @
3cc948c1
...
@@ -403,6 +403,9 @@ class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
...
@@ -403,6 +403,9 @@ class ExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
msg
.
attach_alternative
(
html_content
,
"text/html"
)
msg
.
attach_alternative
(
html_content
,
"text/html"
)
msg
.
send
()
msg
.
send
()
self
.
obj
.
poster
.
emails_sent
+=
2
self
.
obj
.
poster
.
save
()
return
super
(
ExchangeListing
,
self
).
form_valid
(
form
)
return
super
(
ExchangeListing
,
self
).
form_valid
(
form
)
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
...
@@ -468,6 +471,9 @@ class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
...
@@ -468,6 +471,9 @@ class UnExchangeListing(LoginRequiredMixin, FormValidMessageMixin, UpdateView):
msg
.
attach_alternative
(
html_content
,
"text/html"
)
msg
.
attach_alternative
(
html_content
,
"text/html"
)
msg
.
send
()
msg
.
send
()
self
.
obj
.
poster
.
emails_sent
+=
2
self
.
obj
.
poster
.
save
()
# this has to come after the email has been sent, otherwise these are
# this has to come after the email has been sent, otherwise these are
# cleaned out
# cleaned out
form
.
instance
.
exchanged
=
False
form
.
instance
.
exchanged
=
False
...
...
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