Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Adrián Ribao
Cartero
Commits
031ef498
Commit
031ef498
authored
Mar 08, 2013
by
Adrián Ribao
Browse files
some improvements
parent
e5e9b604
Changes
3
Hide whitespace changes
Inline
Side-by-side
cartero/admin.py
View file @
031ef498
...
...
@@ -8,6 +8,7 @@ from cartero.models import Contact, EmailTemplate, Campaign, ExcludedEmail,\
from
django.conf.urls.defaults
import
patterns
,
include
,
url
from
cartero.views
import
CreateTemplateView
,
UpdateTemplateView
from
cartero.utils.sending
import
CampaignDeliver
from
django.db.models
import
Count
#StackedInline o TabularInline
#class ModelInline(admin.TabularInline):
...
...
@@ -76,10 +77,21 @@ admin.site.register(EmailTemplate, EmailTemplateAdmin)
class
CampaignAdmin
(
admin
.
ModelAdmin
):
date_hierarchy
=
'start'
#def queryset(self, request):
#qs = super(CampaignAdmin, self).queryset(request)
#qs = qs.annotate(num_contacts=Count('contacts'))
#return qs
def
num_contacts
(
self
,
obj
):
return
obj
.
contacts
.
all
().
count
()
num_contacts
.
short_description
=
'# Contacts'
list_display
=
[
'name'
,
'start'
,
'subject'
,
'num_contacts'
,
'reply_to'
,
'site'
,
'status'
,
...
...
cartero/models.py
View file @
031ef498
...
...
@@ -128,7 +128,7 @@ class Campaign(models.Model):
#help_text=_(u'When this is activated, the email is ready to be sent and will be scheduled.'))
#sent = models.BooleanField(default=False, verbose_name=_(u'Sent'), blank=True)
status
=
models
.
CharField
(
max_length
=
2
,
choices
=
CAMPAIGN_STATUS
,
default
=
DRAFT
)
rate_limit_amount
=
models
.
PositiveSmallIntegerField
(
default
=
6
0
,
verbose_name
=
_
(
u
'Rate limit amount'
),
rate_limit_amount
=
models
.
PositiveSmallIntegerField
(
default
=
1000
0
,
verbose_name
=
_
(
u
'Rate limit amount'
),
help_text
=
_
(
u
'Rate limit amount'
))
rate_limit_interval
=
models
.
CharField
(
max_length
=
1
,
choices
=
RATE_LIMIT_CHOICES
,
default
=
RATE_LIMIT_HOURS
,
verbose_name
=
_
(
u
'Rate limit interval'
))
...
...
cartero/tasks.py
View file @
031ef498
...
...
@@ -35,4 +35,3 @@ def check_campaigns():
def
send_message
(
campaign_deliver
,
contact
):
campaign_deliver
.
send_to_contact
(
contact
)
return
True
Write
Preview
Supports
Markdown
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