Skip to content
This repository was archived by the owner on Mar 21, 2022. It is now read-only.
Open

xxx #22

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ INSTALLED_APPS = (

Don't forget to add `DRIP_FROM_EMAIL` to settings.py, or else we will fall back to `EMAIL_HOST_USER`.

For instance, send the email from your gmail account
```
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_PORT = 587
```

Finally, be sure to run `python manage.py syncdb` or `python manage.py migrate drip` to set up
the necessary database tables.

Expand Down
Binary file added drip/locale/zh_CN/LC_MESSAGES/django.mo
Binary file not shown.
103 changes: 103 additions & 0 deletions drip/locale/zh_CN/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Lisheng Guan <[email protected]>, 2012,2013.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-01-04 11:09+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Lisheng Guan <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"

#: models.py:21
msgid "Drip Name"
msgstr "邮件名称"

#: models.py:22
msgid "A unique name for this drip."
msgstr "独一无二的名称"

#: models.py:27
msgid "Set a custom from email."
msgstr "设置一个电子邮箱"

#: models.py:29
msgid "Set a name for a custom from email."
msgstr "设置发件人姓名"

#: models.py:32
msgid "You will have settings and user in the context."
msgstr "可以使用设置和用户信息"

#: models.py:72
msgid "Filter"
msgstr "过滤"

#: models.py:73
msgid "Exclude"
msgstr "排除"

#: models.py:77
msgid "exactly"
msgstr "精准匹配"

#: models.py:78
msgid "exactly (case insensitive)"
msgstr "精准匹配(忽略大小写)"

#: models.py:79
msgid "contains"
msgstr "包含"

#: models.py:80 models.py:82
msgid "contains (case insensitive)"
msgstr "包含(忽略大小写)"

#: models.py:81
msgid "regex"
msgstr "正则匹配"

#: models.py:83
msgid "greater than"
msgstr "大于"

#: models.py:84
msgid "greater than or equal to"
msgstr "大于或等于"

#: models.py:85
msgid "lesser than"
msgstr "小于"

#: models.py:86
msgid "lesser than or equal to"
msgstr "小于或等于"

#: models.py:87 models.py:88
msgid "starts with"
msgstr "以,,,开始"

#: models.py:89 models.py:90
msgid "ends with (case insensitive)"
msgstr "以,,,结尾"

#: templates/admin/drip/change_form.html:8
msgid "History"
msgstr "查看历史"

#: templates/admin/drip/change_form.html:9
msgid "View on site"
msgstr ""

#: templates/drip/timeline.html:17
msgid "view email"
msgstr "查看邮件"
44 changes: 23 additions & 21 deletions drip/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from django.db import models
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _


# just using this to parse, but totally insane package naming...
# https://bitbucket.org/schinckel/django-timedelta-field/
Expand All @@ -16,18 +18,18 @@ class Drip(models.Model):
name = models.CharField(
max_length=255,
unique=True,
verbose_name='Drip Name',
help_text='A unique name for this drip.')
verbose_name=_('Drip Name'),
help_text=_('A unique name for this drip.'))

enabled = models.BooleanField(default=False)

from_email = models.EmailField(null=True, blank=True,
help_text='Set a custom from email.')
help_text=_('Set a custom from email.'))
from_email_name = models.CharField(max_length=150, null=True, blank=True,
help_text="Set a name for a custom from email.")
help_text=_("Set a name for a custom from email."))
subject_template = models.TextField(null=True, blank=True)
body_html_template = models.TextField(null=True, blank=True,
help_text='You will have settings and user in the context.')
help_text=_('You will have settings and user in the context.'))
message_class = models.CharField(max_length=120, blank=True, default='default')

@property
Expand Down Expand Up @@ -67,25 +69,25 @@ class SentDrip(models.Model):


METHOD_TYPES = (
('filter', 'Filter'),
('exclude', 'Exclude'),
('filter', _('Filter')),
('exclude', _('Exclude')),
)

LOOKUP_TYPES = (
('exact', 'exactly'),
('iexact', 'exactly (case insensitive)'),
('contains', 'contains'),
('icontains', 'contains (case insensitive)'),
('regex', 'regex'),
('iregex', 'contains (case insensitive)'),
('gt', 'greater than'),
('gte', 'greater than or equal to'),
('lt', 'lesser than'),
('lte', 'lesser than or equal to'),
('startswith', 'starts with'),
('endswith', 'starts with'),
('istartswith', 'ends with (case insensitive)'),
('iendswith', 'ends with (case insensitive)'),
('exact', _('exactly')),
('iexact', _('exactly (case insensitive)')),
('contains', _('contains')),
('icontains', _('contains (case insensitive)')),
('regex', _('regex')),
('iregex', _('contains (case insensitive)')),
('gt', _('greater than')),
('gte', _('greater than or equal to')),
('lt', _('lesser than')),
('lte', _('lesser than or equal to')),
('startswith', _('starts with')),
('endswith', _('starts with')),
('istartswith', _('ends with (case insensitive)')),
('iendswith', _('ends with (case insensitive)')),
)

class QuerySetRule(models.Model):
Expand Down
64 changes: 64 additions & 0 deletions drip/templates/admin/drip/SentDrip/change_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{% extends "admin/change_form.html" %}
{% load i18n admin_static admin_list %}
{% load url from future %}
{% load admin_urls %}

{% block object-tools-items %}
<li><a href="{% url 'admin:drip_timeline' original.drip.id 4 7 %}" class="">View Timeline</a></li>
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
{% endblock %}

{% block after_related_objects %}
<style type="text/css" media="screen">
ul.field-name-selector { overflow:auto; margin:0; padding:0;}
ul.field-name-selector li {
list-style:none;
float:left;
margin:0 4px 4px 0;
padding:2px 4px;
background:#f7f7f7;
border:1px #ccc solid;
cursor:pointer;
}
ul.field-name-selector li:hover {
background:#eee;
}
</style>

<script type="text/javascript" charset="utf-8">
(function($) {
$(document).ready(function($) {

var data = {{field_data|safe}};

function pull_field_name(target) {
// target is input
$(target).parent().find("ul").remove();

var ul = $("<ul class='field-name-selector'/>");
$(target).parent().append(ul);
var val = $(target).val();

for (var i=0; i < data.length; i++) {
var item = data[i];
if (item[0].indexOf(val) != -1) {
$(ul).append("<li data-field='"+item[0]+"'>"+item[0]+" ("+item[1]+")</li>");
}
};
}

$("ul.field-name-selector li").live("click", function() {
// clicking a pill clears all pills and places the value in
$(this).parent().parent().find("input").val($(this).attr('data-field'));
$(this).parent().remove();
});

$("div.tabular td.field-field_name input").live("focusin click keyup", function() {
pull_field_name(this);
});

});
})(django.jQuery);
</script>
{% endblock %}
4 changes: 2 additions & 2 deletions drip/templates/drip/timeline.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ <h1>{{ drip.name }} Schedule:</h1>
<ul>{% for pack in shifted_drips %}
<li><strong>{% if pack.drip.now_shift_kwargs.days != 0 %}{{ pack.drip.now }}{% else %}today!{% endif %}</strong>{% if pack.qs %}
<ul>{% for user in pack.qs %}{% if user.email %}
<li>{{ user.email }} - {{ user.id }} - <a href="{% url 'admin:view_drip_email' drip_id into_past into_future user.id %}">view email</a></li>
<li>{{ user.email }} - {{ user.id }} - <a href="{% url 'admin:view_drip_email' drip_id into_past into_future user.id %}">{% trans "view email"%}</a></li>
{% endif %}{% endfor %}</ul>
{% endif %}</li>
{% endfor %}</ul>
</div>
{% endblock content %}
{% endblock content %}