Permalink
Browse files

updated for django 1.3 changes

  • Loading branch information...
1 parent c2d5d24 commit d9787f2e812b8a91163fcc9ee38cb91080c524c6 @sherzberg sherzberg committed Nov 23, 2011
Showing with 5,272 additions and 14 deletions.
  1. 0 build/lib.linux-i686-2.6/emailer/__init__.py
  2. +57 −0 build/lib.linux-i686-2.6/emailer/admin.py
  3. +45 −0 build/lib.linux-i686-2.6/emailer/fields.py
  4. +491 −0 build/lib.linux-i686-2.6/emailer/html2text.py
  5. 0 build/lib.linux-i686-2.6/emailer/management/__init__.py
  6. 0 build/lib.linux-i686-2.6/emailer/management/commands/__init__.py
  7. +20 −0 build/lib.linux-i686-2.6/emailer/management/commands/process_emails.py
  8. +23 −0 build/lib.linux-i686-2.6/emailer/management/commands/testemail.py
  9. +22 −0 build/lib.linux-i686-2.6/emailer/management/commands/testemail2.py
  10. +120 −0 build/lib.linux-i686-2.6/emailer/migrations/0001_initial.py
  11. +65 −0 build/lib.linux-i686-2.6/emailer/migrations/0002_auto__del_unique_emailtemplate_name.py
  12. +114 −0 build/lib.linux-i686-2.6/emailer/migrations/0003_auto__add_field_emaillist_query_sql.py
  13. +104 −0 build/lib.linux-i686-2.6/emailer/migrations/0004_auto__add_field_emaillist_raw_emails.py
  14. +122 −0 ...686-2.6/emailer/migrations/0005_auto__add_field_emaillist_is_oneoff__del_field_emailblast_type.py
  15. +104 −0 build/lib.linux-i686-2.6/emailer/migrations/0006_setis_oneoff.py
  16. +145 −0 build/lib.linux-i686-2.6/emailer/migrations/0007_blast_rename_data_cols.py
  17. +118 −0 ...emailer/migrations/0008_auto__add_field_emaillist_data_raw_json__chg_field_emailblast_name__de.py
  18. +103 −0 build/lib.linux-i686-2.6/emailer/migrations/0009_emaillist_prepend_name.py
  19. +115 −0 build/lib.linux-i686-2.6/emailer/migrations/0010_convert_merge_data.py
  20. +106 −0 build/lib.linux-i686-2.6/emailer/migrations/0011_auto__chg_field_email_merge_data.py
  21. +112 −0 build/lib.linux-i686-2.6/emailer/migrations/0012_auto.py
  22. 0 build/lib.linux-i686-2.6/emailer/migrations/__init__.py
  23. +298 −0 build/lib.linux-i686-2.6/emailer/models.py
  24. +10 −0 build/lib.linux-i686-2.6/emailer/urls.py
  25. +65 −0 build/lib.linux-i686-2.6/emailer/utils/__init__.py
  26. +33 −0 build/lib.linux-i686-2.6/emailer/views.py
  27. 0 build/lib.linux-i686-2.6/testsite/__init__.py
  28. +11 −0 build/lib.linux-i686-2.6/testsite/manage.py
  29. +130 −0 build/lib.linux-i686-2.6/testsite/settings.py
  30. 0 build/lib.linux-i686-2.6/testsite/testapp/__init__.py
  31. +11 −0 build/lib.linux-i686-2.6/testsite/testapp/models.py
  32. +23 −0 build/lib.linux-i686-2.6/testsite/testapp/tests.py
  33. +1 −0 build/lib.linux-i686-2.6/testsite/testapp/views.py
  34. +19 −0 build/lib.linux-i686-2.6/testsite/urls.py
  35. 0 build/lib.linux-x86_64-2.7/emailer/__init__.py
  36. +57 −0 build/lib.linux-x86_64-2.7/emailer/admin.py
  37. +45 −0 build/lib.linux-x86_64-2.7/emailer/fields.py
  38. +491 −0 build/lib.linux-x86_64-2.7/emailer/html2text.py
  39. 0 build/lib.linux-x86_64-2.7/emailer/management/__init__.py
  40. 0 build/lib.linux-x86_64-2.7/emailer/management/commands/__init__.py
  41. +20 −0 build/lib.linux-x86_64-2.7/emailer/management/commands/process_emails.py
  42. +23 −0 build/lib.linux-x86_64-2.7/emailer/management/commands/testemail.py
  43. +22 −0 build/lib.linux-x86_64-2.7/emailer/management/commands/testemail2.py
  44. +120 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0001_initial.py
  45. +65 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0002_auto__del_unique_emailtemplate_name.py
  46. +114 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0003_auto__add_field_emaillist_query_sql.py
  47. +104 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0004_auto__add_field_emaillist_raw_emails.py
  48. +122 −0 ..._64-2.7/emailer/migrations/0005_auto__add_field_emaillist_is_oneoff__del_field_emailblast_type.py
  49. +104 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0006_setis_oneoff.py
  50. +145 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0007_blast_rename_data_cols.py
  51. +118 −0 ...emailer/migrations/0008_auto__add_field_emaillist_data_raw_json__chg_field_emailblast_name__de.py
  52. +103 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0009_emaillist_prepend_name.py
  53. +115 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0010_convert_merge_data.py
  54. +106 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0011_auto__chg_field_email_merge_data.py
  55. +112 −0 build/lib.linux-x86_64-2.7/emailer/migrations/0012_auto.py
  56. 0 build/lib.linux-x86_64-2.7/emailer/migrations/__init__.py
  57. +298 −0 build/lib.linux-x86_64-2.7/emailer/models.py
  58. +10 −0 build/lib.linux-x86_64-2.7/emailer/urls.py
  59. +65 −0 build/lib.linux-x86_64-2.7/emailer/utils/__init__.py
  60. +33 −0 build/lib.linux-x86_64-2.7/emailer/views.py
  61. 0 build/lib.linux-x86_64-2.7/testsite/__init__.py
  62. +11 −0 build/lib.linux-x86_64-2.7/testsite/manage.py
  63. +130 −0 build/lib.linux-x86_64-2.7/testsite/settings.py
  64. 0 build/lib.linux-x86_64-2.7/testsite/testapp/__init__.py
  65. +11 −0 build/lib.linux-x86_64-2.7/testsite/testapp/models.py
  66. +23 −0 build/lib.linux-x86_64-2.7/testsite/testapp/tests.py
  67. +1 −0 build/lib.linux-x86_64-2.7/testsite/testapp/views.py
  68. +21 −0 build/lib.linux-x86_64-2.7/testsite/urls.py
  69. BIN dist/django_emailer-trunk-py2.6.egg
  70. BIN dist/django_emailer-trunk-py2.7.egg
  71. +29 −0 django_emailer.egg-info/PKG-INFO
  72. +40 −0 django_emailer.egg-info/SOURCES.txt
  73. +1 −0 django_emailer.egg-info/dependency_links.txt
  74. +2 −0 django_emailer.egg-info/top_level.txt
  75. +6 −6 emailer/management/commands/testemail2.py
  76. +2 −0 emailer/utils/__init__.py
  77. +13 −7 testsite/settings.py
  78. +3 −1 testsite/urls.py
@@ -0,0 +1,57 @@
+from django.contrib import admin
+from django import forms
+
+try:
+ from tinymce.widgets import TinyMCE as HtmlWidget
+except:
+ from django.forms import Textarea as HtmlWidget
+
+from emailer.models import *
+
+class EmailAdmin(admin.ModelAdmin):
+ list_display = ('email_blast', 'to_address', 'status', 'opened', 'merge_data',)
+ list_filter = ('status',)
+
+class EmailBlastAdminForm(forms.ModelForm):
+ html = forms.CharField(widget=HtmlWidget(attrs={'cols': 80, 'rows': 40}))
+
+ class Meta:
+ model = EmailBlast
+
+class EmailBlastAdmin(admin.ModelAdmin):
+ list_display = ('name', 'send_after',)
+ list_filter = ('send_after',)
+ form = EmailBlastAdminForm
+
+class EmailTemplateAdminForm(forms.ModelForm):
+ name = forms.CharField()
+ description = forms.CharField(required=False,widget=forms.Textarea(attrs={'cols': 80, 'rows': 4}))
+ html = forms.CharField(widget=HtmlWidget(attrs={'cols': 80, 'rows': 40}))
+
+class EmailTemplateAdmin(admin.ModelAdmin):
+ list_display = ('name', 'date_created',)
+ form = EmailTemplateAdminForm
+
+class EmailListAdmin(admin.ModelAdmin):
+ list_display = ('name', 'type', 'date_created', 'preview_emails', 'merge_fields',)
+ list_filter = ('type', 'is_oneoff',)
+
+ def changelist_view(self, request, extra_context=None):
+ '''
+ This override, by default hides, the one off lists that are
+ generated by one off emails which are currently necessary to have
+ '''
+ if not request.GET.has_key('is_oneoff__exact'):
+
+ q = request.GET.copy()
+ q['is_oneoff__exact'] = '0'
+ request.GET = q
+ request.META['QUERY_STRING'] = request.GET.urlencode()
+ return super(EmailListAdmin,self).changelist_view(request, extra_context=extra_context)
+
+
+admin.site.register(EmailTemplate, EmailTemplateAdmin)
+admin.site.register(Email, EmailAdmin)
+admin.site.register(EmailBlast, EmailBlastAdmin)
+admin.site.register(EmailList, EmailListAdmin)
+#admin.site.register(EmailList)
@@ -0,0 +1,45 @@
+
+from django.db import models
+
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
+
+
+
+
+class DictionaryField(models.Field):
+ '''
+ Field that represents a dict object. Borrowed from django-geo
+ '''
+ __metaclass__ = models.SubfieldBase
+
+ def to_python(self, value):
+ if isinstance(value, dict):
+ return value
+ else:
+ if not value:
+ return value
+ return pickle.loads(str(value))
+
+ def get_db_prep_save(self, value):
+ if value is not None and not isinstance(value, basestring):
+ if isinstance(value, dict):
+ value = pickle.dumps(value)
+ else:
+ raise TypeError('This field can only store dictionaries. Use PickledObjectField to store a wide(r) range of data types.')
+ return value
+
+ def get_internal_type(self):
+ return 'TextField'
+
+ def get_db_prep_lookup(self, lookup_type, value):
+ if lookup_type == 'exact':
+ value = self.get_db_prep_save(value)
+ return super(DictionaryField, self).get_db_prep_lookup(lookup_type, value)
+ elif lookup_type == 'in':
+ value = [self.get_db_prep_save(v) for v in value]
+ return super(DictionaryField, self).get_db_prep_lookup(lookup_type, value)
+ else:
+ raise TypeError('Lookup type %s is not supported.' % lookup_type)
Oops, something went wrong.

0 comments on commit d9787f2

Please sign in to comment.