django-codenerix-email 4.0.15__py2.py3-none-any.whl → 4.0.17__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- __version__ = "4.0.15"
1
+ __version__ = "4.0.17"
2
2
 
3
3
  __authors__ = [
4
4
  "Juan Miguel Taboada Godoy <juanmi@juanmitaboada.com>",
@@ -0,0 +1,20 @@
1
+ # Generated by Django 5.1.2 on 2024-10-10 09:24
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("codenerix_email", "0011_alter_emailmessage_content_subtype_and_more"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddField(
14
+ model_name="emailmessage",
15
+ name="unsubscribe_url",
16
+ field=models.URLField(
17
+ blank=True, null=True, verbose_name="Unsubscribe URL"
18
+ ),
19
+ ),
20
+ ]
codenerix_email/models.py CHANGED
@@ -92,6 +92,9 @@ class EmailMessage(CodenerixModel, Debugger):
92
92
  null=False,
93
93
  default=CONTENT_SUBTYPE_HTML,
94
94
  )
95
+ unsubscribe_url = models.URLField(
96
+ _("Unsubscribe URL"), blank=True, null=True
97
+ )
95
98
 
96
99
  def __fields__(self, info):
97
100
  fields = []
@@ -99,9 +102,10 @@ class EmailMessage(CodenerixModel, Debugger):
99
102
  fields.append(("error", None))
100
103
  fields.append(("sent", _("Send")))
101
104
  fields.append(("priority", _("Priority")))
105
+ fields.append(("created", _("Created")))
102
106
  fields.append(("updated", _("Updated")))
103
107
  fields.append(("opened", _("Opened")))
104
- fields.append(("efrom", _("From")))
108
+ # fields.append(("efrom", _("From")))
105
109
  fields.append(("eto", _("To")))
106
110
  fields.append(("subject", _("Subject")))
107
111
  fields.append(("retries", _("Retries")))
@@ -109,16 +113,18 @@ class EmailMessage(CodenerixModel, Debugger):
109
113
  fields.append(("pk", _("ID")))
110
114
  fields.append(("content_subtype", _("Content Subtype")))
111
115
  fields.append(("uuid", _("UUID")))
116
+ fields.append(("unsubscribe_url", _("Unsubscribe URL")))
112
117
  return fields
113
118
 
114
119
  def __searchQ__(self, info, search): # noqa: N802
115
120
  answer = super().__searchQ__(info, search)
116
121
  answer["uuid"] = Q(uuid__icontains=search)
117
122
  answer["priority"] = Q(priority=search)
118
- answer["efrom"] = Q(efrom__icontains=search)
123
+ # answer["efrom"] = Q(efrom__icontains=search)
119
124
  answer["eto"] = Q(eto__icontains=search)
120
125
  answer["retries"] = Q(retries=search)
121
126
  answer["pk"] = Q(pk=search)
127
+ answer["unsubscribe_url"] = Q(unsubscribe_url__icontains=search)
122
128
  return answer
123
129
 
124
130
  def __searchF__(self, info): # noqa: N802
@@ -150,10 +156,15 @@ class EmailMessage(CodenerixModel, Debugger):
150
156
  lambda x: ~Q(opened__isnull=x),
151
157
  [(True, _("Yes")), (False, _("No"))],
152
158
  ),
153
- "efrom": (_("From"), lambda x: Q(efrom__icontains=x), "input"),
159
+ # "efrom": (_("From"), lambda x: Q(efrom__icontains=x), "input"),
154
160
  "eto": (_("To"), lambda x: Q(eto__icontains=x), "input"),
155
161
  "retries": (_("Retries"), lambda x: Q(retries=x), "input"),
156
162
  "pk": (_("ID"), lambda x: Q(pk=x), "input"),
163
+ "unsubscribe_url": (
164
+ _("Unsubscribe URL"),
165
+ lambda x: Q(unsubscribe_url__icontains=x),
166
+ "input",
167
+ ),
157
168
  }
158
169
 
159
170
  def __unicode__(self):
@@ -341,13 +352,25 @@ class EmailMessage(CodenerixModel, Debugger):
341
352
  raise
342
353
 
343
354
  if connection:
355
+
356
+ # Prepare headers
357
+ headers = {}
358
+
359
+ # If unsubscribe_url is set, add List-Unsubscribe header
360
+ if self.unsubscribe_url:
361
+ headers["List-Unsubscribe"] = f"<{self.unsubscribe_url}>"
362
+ headers[
363
+ "List-Unsubscribe-Post"
364
+ ] = "List-Unsubscribe=One-Click"
365
+
344
366
  email = EM(
345
- self.subject,
346
- self.body,
347
- self.efrom,
348
- [self.eto],
367
+ subject=self.subject,
368
+ body=self.body,
369
+ from_email=self.efrom,
370
+ to=[self.eto],
349
371
  connection=connection,
350
372
  )
373
+ email.headers = headers
351
374
  email.content_subtype = self.content_subtype
352
375
  for at in self.attachments.all():
353
376
  with open(at.path) as f:
@@ -7,11 +7,11 @@
7
7
  </center>
8
8
  </td>
9
9
  <td><center>{{row.priority|codenerix}}</center></td>
10
+ <td class="text-nowrap">{{row.created|codenerix}}</td>
10
11
  <td class="text-nowrap">{{row.updated|codenerix}}</td>
11
12
  <td>
12
13
  <span title="{{row.opened}}" codenerix-html-compile="row.opened|codenerix:'bool'"><span>
13
14
  </td>
14
- <td>{{row.efrom|codenerix}}</td>
15
15
  <td>{{row.eto|codenerix}}</td>
16
16
  <td>{{row.subject|codenerix}}</td>
17
17
  <td><center>{{row.retries|codenerix}}</center></td>
@@ -26,4 +26,11 @@
26
26
  </button>
27
27
  </center>
28
28
  </td>
29
- <td>{{row.uuid|codenerix}}</td>
29
+ <td>
30
+ <span codenerix-html-compile="row.uuid|codenerix:'copytoclipboard:UUID:UUID copiado al portapapales...':codenerix_inner_element">
31
+ <span class="fa fa-barcode"></span>
32
+ </span>
33
+ </td>
34
+ <td>
35
+ <span codenerix-html-compile="row.unsubscribe_url|codenerix:'link'">
36
+ </td>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-codenerix-email
3
- Version: 4.0.15
3
+ Version: 4.0.17
4
4
  Summary: Codenerix Email is a module that enables CODENERIX to set send emails in a general manner.
5
5
  Home-page: https://github.com/codenerix/django-codenerix-email
6
6
  Author: Juan Miguel Taboada Godoy <juanmi@juanmitaboada.com>, Juan Soler Ruiz <soleronline@gmail.com>
@@ -1,8 +1,8 @@
1
- codenerix_email/__init__.py,sha256=Q_WRHYGjoUiRRSzUtTUs6HbclXRS0AZlmB-6J8UDexM,149
1
+ codenerix_email/__init__.py,sha256=gHbEiMXwH8711kzgIc0umxn0nokn4EOEx_jGC-Wu3Lo,149
2
2
  codenerix_email/admin.py,sha256=o3b-MaD7xsWeta0yfU9YNeKBmHQIcmHqXmP2t-hrrWc,1208
3
3
  codenerix_email/apps.py,sha256=WXqu1XQibDDyCvvQYt2JbTK4GIpW8BNv5DCbRJS2mmk,149
4
4
  codenerix_email/forms.py,sha256=n-UrVPI7NMXNImEdJ4uB0HWHEvBNv71YKZ_RPLW4FSg,4075
5
- codenerix_email/models.py,sha256=HnnSJ0RuVRyXqrk3s5aFyex0GLiQUUIo5ogUjAE5oio,19315
5
+ codenerix_email/models.py,sha256=7cq4odD6tm3XrsmRv8u75MeJSTZ0mcytFjqyUQNC9bM,20230
6
6
  codenerix_email/urls.py,sha256=QYrSJdhCp2PLrcfv_Y7X4OzxqQ0Q2-z7ObDPE-_WLdw,2595
7
7
  codenerix_email/urls_frontend.py,sha256=DG5WS_fGQJC9sezNebPwG-E_WtUWy3Kwz4VUxh82xuc,873
8
8
  codenerix_email/views.py,sha256=Bx990LC04HOdytHJoO_T0z0R_u6qm6I2Q9bXtnmf5vw,4822
@@ -27,6 +27,7 @@ codenerix_email/migrations/0008_auto_20171201_0928.py,sha256=cqlgf9IfNgU-IJey073
27
27
  codenerix_email/migrations/0009_emailmessage_opened_emailmessage_uuid.py,sha256=jt3AzNCHM-hTuV9FP1FTzYMJnsl_GNQ74jv5n9_adi4,1219
28
28
  codenerix_email/migrations/0010_emailmessage_content_subtype_and_more.py,sha256=Zy9OwxcQCPoVdemJRlotfpGVyTLuzNkCNQYfoEVnvB0,1001
29
29
  codenerix_email/migrations/0011_alter_emailmessage_content_subtype_and_more.py,sha256=Ki38KPngeeTIhrki57OXEwCB5P7JnI1Hv58dwRYLO7w,957
30
+ codenerix_email/migrations/0012_emailmessage_unsubscribe_url.py,sha256=tPQt1W2LJcXMvt_ecB-2npu7wQ-Og29M99ZJjukYnWA,501
30
31
  codenerix_email/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
32
  codenerix_email/migrations/__pycache__/0001_initial.cpython-310.pyc,sha256=Sm54OKfGHUMvSVgbXiFAe9E2d85HqlLoMEaBEBP53mE,2005
32
33
  codenerix_email/migrations/__pycache__/0001_initial.cpython-311.pyc,sha256=mOTNcz_iff63bExW7wNyR_HXU-e8ON-Au03YpCL_cCw,3682
@@ -65,13 +66,14 @@ codenerix_email/migrations/__pycache__/0009_emailmessage_opened_emailmessage_uui
65
66
  codenerix_email/migrations/__pycache__/0010_emailmessage_content_subtype_and_more.cpython-311.pyc,sha256=MTWH-MJZqJeT42E-nnRYs2H0vwnBN5kGCk1-TOF6YpE,1201
66
67
  codenerix_email/migrations/__pycache__/0010_emailmessage_opened_emailmessage_uuid_and_more.cpython-311.pyc,sha256=ZoBI5fyc5vTdGSejQl5953krxh_BXl17tuft5ZmdH6U,3104
67
68
  codenerix_email/migrations/__pycache__/0011_alter_emailmessage_content_subtype_and_more.cpython-311.pyc,sha256=rWr5NdYUVeF71WxMUPIzUN67Ua6fhWWjci5dAG7mpRg,1195
69
+ codenerix_email/migrations/__pycache__/0012_emailmessage_unsubscribe_url.cpython-311.pyc,sha256=NghZueCAhFtAwmKhkYzICGMX0uv44-VA5xhHCPp_O-M,936
68
70
  codenerix_email/migrations/__pycache__/__init__.cpython-310.pyc,sha256=PdaaABMdLCzCMnJmxaylT_jnLb8l7rr6n5C4CGDX37A,151
69
71
  codenerix_email/migrations/__pycache__/__init__.cpython-311.pyc,sha256=RbbUUEhcJ_eAVNFAdNbkjv60hyF7BsnNOlti5xplQsY,195
70
72
  codenerix_email/migrations/__pycache__/__init__.cpython-35.pyc,sha256=2g70xiMW6oJNkIpRM-0Dr5h7AUac-3xyCXPONxp9BBw,147
71
73
  codenerix_email/migrations/__pycache__/__init__.cpython-39.pyc,sha256=qNj2NH0YvoWPnCKxkVZPsEFsbM05y7t1njMskNISdVQ,168
72
- codenerix_email/static/codenerix_email/partials/emailmessages_rows.html,sha256=2KjE_YZ91OAFZuHteQeQ2r2vOBeZmwmnJQ4L-bH4B50,1735
73
- django_codenerix_email-4.0.15.dist-info/LICENSE,sha256=IXMIpi75XsrJt1Sznt4EftT9c_4X0C9eqK4tHhH8H48,11339
74
- django_codenerix_email-4.0.15.dist-info/METADATA,sha256=r1zYR7GyFuiX5HdU0MeR0XPFtXGfHVljXMUhJEmpG2w,2640
75
- django_codenerix_email-4.0.15.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
76
- django_codenerix_email-4.0.15.dist-info/top_level.txt,sha256=lljSA0iKE_UBEM5gIrGQwioC_i8Jjnp-aR1LFElENgw,16
77
- django_codenerix_email-4.0.15.dist-info/RECORD,,
74
+ codenerix_email/static/codenerix_email/partials/emailmessages_rows.html,sha256=7MVyGRvzGuQcDR_XTQSpEJvR7NEVSwHndV_ceoBHBdc,2010
75
+ django_codenerix_email-4.0.17.dist-info/LICENSE,sha256=IXMIpi75XsrJt1Sznt4EftT9c_4X0C9eqK4tHhH8H48,11339
76
+ django_codenerix_email-4.0.17.dist-info/METADATA,sha256=drXWwhosffhqBB7YEN7PgkZX3mYcB7qMGB5hnlAK67U,2640
77
+ django_codenerix_email-4.0.17.dist-info/WHEEL,sha256=z9j0xAa_JmUKMpmz72K0ZGALSM_n-wQVmGbleXx2VHg,110
78
+ django_codenerix_email-4.0.17.dist-info/top_level.txt,sha256=lljSA0iKE_UBEM5gIrGQwioC_i8Jjnp-aR1LFElENgw,16
79
+ django_codenerix_email-4.0.17.dist-info/RECORD,,