Commit 031ef498 authored by Adrián Ribao's avatar Adrián Ribao
Browse files

some improvements

parent e5e9b604
......@@ -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',
......
......@@ -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=60, verbose_name=_(u'Rate limit amount'),
rate_limit_amount = models.PositiveSmallIntegerField(default=10000, 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'))
......
......@@ -35,4 +35,3 @@ def check_campaigns():
def send_message(campaign_deliver, contact):
campaign_deliver.send_to_contact(contact)
return True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment