plain.redirection 0.34.0__tar.gz → 0.35.1__tar.gz

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.
Files changed (20) hide show
  1. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/PKG-INFO +4 -4
  2. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/CHANGELOG.md +23 -0
  3. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/README.md +2 -2
  4. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/migrations/0001_initial.py +9 -38
  5. plain_redirection-0.35.1/plain/redirection/migrations/0002_rename_plainredire_created_d5f0c7_idx_plainredirection_notfoundlog_created_at_idx_and_more.py +11 -0
  6. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/migrations/0003_redirectlog_plainredirection_redirectlog_redirect_id_idx.py +0 -7
  7. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/models.py +23 -9
  8. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/pyproject.toml +2 -2
  9. plain_redirection-0.34.0/plain/redirection/migrations/0002_rename_plainredire_created_d5f0c7_idx_plainredirection_notfoundlog_created_at_idx_and_more.py +0 -32
  10. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/.gitignore +0 -0
  11. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/LICENSE +0 -0
  12. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/README.md +0 -0
  13. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/__init__.py +0 -0
  14. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/admin.py +0 -0
  15. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/chores.py +0 -0
  16. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/config.py +0 -0
  17. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/default_settings.py +0 -0
  18. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/middleware.py +0 -0
  19. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/migrations/__init__.py +0 -0
  20. {plain_redirection-0.34.0 → plain_redirection-0.35.1}/plain/redirection/templates/admin/plainredirection/redirect_form.html +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.redirection
3
- Version: 0.34.0
3
+ Version: 0.35.1
4
4
  Summary: A flexible URL redirection system with admin interface and logging.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
7
7
  License-File: LICENSE
8
8
  Requires-Python: >=3.13
9
- Requires-Dist: plain-postgres<1.0.0,>=0.89.0
9
+ Requires-Dist: plain-postgres<1.0.0,>=0.91.0
10
10
  Requires-Dist: plain<1.0.0,>=0.123.0
11
11
  Description-Content-Type: text/markdown
12
12
 
@@ -204,10 +204,10 @@ MIDDLEWARE = [
204
204
  ]
205
205
  ```
206
206
 
207
- Run migrations to create the database tables:
207
+ Sync the database to create the tables:
208
208
 
209
209
  ```console
210
- plain migrate
210
+ plain postgres sync
211
211
  ```
212
212
 
213
213
  You can now create redirects through the admin interface or programmatically using the `Redirect` model.
@@ -1,5 +1,28 @@
1
1
  # plain-redirection changelog
2
2
 
3
+ ## [0.35.1](https://github.com/dropseed/plain/releases/plain-redirection@0.35.1) (2026-03-29)
4
+
5
+ ### What's changed
6
+
7
+ - Removed `AddIndex`, `AddConstraint`, and `RemoveConstraint` operations from migrations — indexes and constraints are now managed by convergence. ([c58b4ba1fec9](https://github.com/dropseed/plain/commit/c58b4ba1fec9), [1f15538b008f](https://github.com/dropseed/plain/commit/1f15538b008f))
8
+ - Replaced `PositiveIntegerField` with `IntegerField` in model and migrations. ([738a1efbca59](https://github.com/dropseed/plain/commit/738a1efbca59))
9
+ - Updated docs to reference `plain postgres sync` instead of `plain migrate`. ([b026895edc4c](https://github.com/dropseed/plain/commit/b026895edc4c))
10
+
11
+ ### Upgrade instructions
12
+
13
+ - Requires `plain-postgres>=0.91.0`.
14
+
15
+ ## [0.35.0](https://github.com/dropseed/plain/releases/plain-redirection@0.35.0) (2026-03-28)
16
+
17
+ ### What's changed
18
+
19
+ - Replaced `CharField` with `TextField` in models and migration files to match plain-postgres 0.90.0 ([5062ee4dd1fd](https://github.com/dropseed/plain/commit/5062ee4dd1fd))
20
+
21
+ ### Upgrade instructions
22
+
23
+ - Requires `plain-postgres>=0.90.0`
24
+ - Replace `CharField` with `TextField` in migration files that reference this package's models
25
+
3
26
  ## [0.34.0](https://github.com/dropseed/plain/releases/plain-redirection@0.34.0) (2026-03-25)
4
27
 
5
28
  ### What's changed
@@ -192,10 +192,10 @@ MIDDLEWARE = [
192
192
  ]
193
193
  ```
194
194
 
195
- Run migrations to create the database tables:
195
+ Sync the database to create the tables:
196
196
 
197
197
  ```console
198
- plain migrate
198
+ plain postgres sync
199
199
  ```
200
200
 
201
201
  You can now create redirects through the admin interface or programmatically using the `Redirect` model.
@@ -15,12 +15,12 @@ class Migration(migrations.Migration):
15
15
  name="Redirect",
16
16
  fields=[
17
17
  ("id", postgres.PrimaryKeyField()),
18
- ("from_pattern", postgres.CharField(max_length=255)),
19
- ("to_pattern", postgres.CharField(max_length=255)),
20
- ("http_status", postgres.PositiveSmallIntegerField(default=301)),
18
+ ("from_pattern", postgres.TextField(max_length=255)),
19
+ ("to_pattern", postgres.TextField(max_length=255)),
20
+ ("http_status", postgres.SmallIntegerField(default=301)),
21
21
  ("created_at", postgres.DateTimeField(auto_now_add=True)),
22
22
  ("updated_at", postgres.DateTimeField(auto_now=True)),
23
- ("order", postgres.PositiveSmallIntegerField(default=0)),
23
+ ("order", postgres.SmallIntegerField(default=0)),
24
24
  ("enabled", postgres.BooleanField(default=True)),
25
25
  ("is_regex", postgres.BooleanField(default=False)),
26
26
  ],
@@ -34,10 +34,10 @@ class Migration(migrations.Migration):
34
34
  ("id", postgres.PrimaryKeyField()),
35
35
  ("from_url", postgres.URLField(max_length=512)),
36
36
  ("to_url", postgres.URLField(max_length=512)),
37
- ("http_status", postgres.PositiveSmallIntegerField(default=301)),
37
+ ("http_status", postgres.SmallIntegerField(default=301)),
38
38
  ("ip_address", postgres.GenericIPAddressField()),
39
- ("user_agent", postgres.CharField(max_length=512, required=False)),
40
- ("referrer", postgres.CharField(max_length=512, required=False)),
39
+ ("user_agent", postgres.TextField(max_length=512, required=False)),
40
+ ("referrer", postgres.TextField(max_length=512, required=False)),
41
41
  ("created_at", postgres.DateTimeField(auto_now_add=True)),
42
42
  ],
43
43
  options={
@@ -50,31 +50,14 @@ class Migration(migrations.Migration):
50
50
  ("id", postgres.PrimaryKeyField()),
51
51
  ("url", postgres.URLField(max_length=512)),
52
52
  ("ip_address", postgres.GenericIPAddressField()),
53
- ("user_agent", postgres.CharField(max_length=512, required=False)),
54
- ("referrer", postgres.CharField(max_length=512, required=False)),
53
+ ("user_agent", postgres.TextField(max_length=512, required=False)),
54
+ ("referrer", postgres.TextField(max_length=512, required=False)),
55
55
  ("created_at", postgres.DateTimeField(auto_now_add=True)),
56
56
  ],
57
57
  options={
58
58
  "ordering": ["-created_at"],
59
59
  },
60
60
  ),
61
- migrations.AddIndex(
62
- model_name="redirect",
63
- index=postgres.Index(fields=["order"], name="plainredire_order_44dde0_idx"),
64
- ),
65
- migrations.AddIndex(
66
- model_name="redirect",
67
- index=postgres.Index(
68
- fields=["created_at"], name="plainredire_created_18c288_idx"
69
- ),
70
- ),
71
- migrations.AddConstraint(
72
- model_name="redirect",
73
- constraint=postgres.UniqueConstraint(
74
- fields=("from_pattern",),
75
- name="plainredirects_redirect_unique_from_pattern",
76
- ),
77
- ),
78
61
  migrations.AddField(
79
62
  model_name="redirectlog",
80
63
  name="redirect",
@@ -83,16 +66,4 @@ class Migration(migrations.Migration):
83
66
  to="plainredirection.redirect",
84
67
  ),
85
68
  ),
86
- migrations.AddIndex(
87
- model_name="notfoundlog",
88
- index=postgres.Index(
89
- fields=["created_at"], name="plainredire_created_d5f0c7_idx"
90
- ),
91
- ),
92
- migrations.AddIndex(
93
- model_name="redirectlog",
94
- index=postgres.Index(
95
- fields=["created_at"], name="plainredire_created_5d75f4_idx"
96
- ),
97
- ),
98
69
  ]
@@ -0,0 +1,11 @@
1
+ # Generated by Plain 0.127.2 on 2026-03-25 20:19
2
+
3
+ from plain.postgres import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ("plainredirection", "0001_initial"),
9
+ ]
10
+
11
+ operations = []
@@ -1,6 +1,5 @@
1
1
  # Generated by Plain 0.127.2 on 2026-03-25 22:04
2
2
 
3
- from plain import postgres
4
3
  from plain.postgres import migrations
5
4
 
6
5
 
@@ -17,10 +16,4 @@ class Migration(migrations.Migration):
17
16
  migrations.RunSQL(
18
17
  'DROP INDEX IF EXISTS "plainredirection_redirectlog_redirect_id_72c2ae26"'
19
18
  ),
20
- migrations.AddIndex(
21
- model_name="redirectlog",
22
- index=postgres.Index(
23
- fields=["redirect"], name="plainredirection_redirectlog_redirect_id_idx"
24
- ),
25
- ),
26
19
  ]
@@ -15,14 +15,14 @@ __all__ = ["NotFoundLog", "Redirect", "RedirectLog"]
15
15
 
16
16
  @postgres.register_model
17
17
  class Redirect(postgres.Model):
18
- from_pattern: str = types.CharField(max_length=255)
19
- to_pattern: str = types.CharField(max_length=255)
20
- http_status: int = types.PositiveSmallIntegerField(
18
+ from_pattern: str = types.TextField(max_length=255)
19
+ to_pattern: str = types.TextField(max_length=255)
20
+ http_status: int = types.SmallIntegerField(
21
21
  default=301
22
22
  ) # Default to permanent - could be choices?
23
23
  created_at: datetime = types.DateTimeField(auto_now_add=True)
24
24
  updated_at: datetime = types.DateTimeField(auto_now=True)
25
- order: int = types.PositiveSmallIntegerField(default=0)
25
+ order: int = types.SmallIntegerField(default=0)
26
26
  enabled: bool = types.BooleanField(default=True)
27
27
  is_regex: bool = types.BooleanField(default=False)
28
28
 
@@ -47,6 +47,14 @@ class Redirect(postgres.Model):
47
47
  fields=["from_pattern"],
48
48
  name="plainredirects_redirect_unique_from_pattern",
49
49
  ),
50
+ postgres.CheckConstraint(
51
+ check=postgres.Q(http_status__gte=0),
52
+ name="plainredirection_redirect_http_status_check",
53
+ ),
54
+ postgres.CheckConstraint(
55
+ check=postgres.Q(order__gte=0),
56
+ name="plainredirection_redirect_order_check",
57
+ ),
50
58
  ],
51
59
  )
52
60
 
@@ -91,12 +99,12 @@ class RedirectLog(postgres.Model):
91
99
  # The actuals that were used to redirect
92
100
  from_url: str = types.URLField(max_length=512)
93
101
  to_url: str = types.URLField(max_length=512)
94
- http_status: int = types.PositiveSmallIntegerField(default=301)
102
+ http_status: int = types.SmallIntegerField(default=301)
95
103
 
96
104
  # Request metadata
97
105
  ip_address: str = types.GenericIPAddressField()
98
- user_agent: str = types.CharField(required=False, max_length=512)
99
- referrer: str = types.CharField(required=False, max_length=512)
106
+ user_agent: str = types.TextField(required=False, max_length=512)
107
+ referrer: str = types.TextField(required=False, max_length=512)
100
108
 
101
109
  created_at: datetime = types.DateTimeField(auto_now_add=True)
102
110
 
@@ -114,6 +122,12 @@ class RedirectLog(postgres.Model):
114
122
  fields=["redirect"],
115
123
  ),
116
124
  ],
125
+ constraints=[
126
+ postgres.CheckConstraint(
127
+ check=postgres.Q(http_status__gte=0),
128
+ name="plainredirection_redirectlog_http_status_check",
129
+ ),
130
+ ],
117
131
  )
118
132
 
119
133
  @classmethod
@@ -144,8 +158,8 @@ class NotFoundLog(postgres.Model):
144
158
 
145
159
  # Request metadata
146
160
  ip_address: str = types.GenericIPAddressField()
147
- user_agent: str = types.CharField(required=False, max_length=512)
148
- referrer: str = types.CharField(required=False, max_length=512)
161
+ user_agent: str = types.TextField(required=False, max_length=512)
162
+ referrer: str = types.TextField(required=False, max_length=512)
149
163
 
150
164
  created_at: datetime = types.DateTimeField(auto_now_add=True)
151
165
 
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "plain.redirection"
3
- version = "0.34.0"
3
+ version = "0.35.1"
4
4
  description = "A flexible URL redirection system with admin interface and logging."
5
5
  authors = [{ name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev" }]
6
6
  readme = "README.md"
7
7
  license = "BSD-3-Clause"
8
8
  requires-python = ">=3.13"
9
- dependencies = ["plain>=0.123.0,<1.0.0", "plain.postgres>=0.89.0,<1.0.0"]
9
+ dependencies = ["plain>=0.123.0,<1.0.0", "plain.postgres>=0.91.0,<1.0.0"]
10
10
 
11
11
  [tool.hatch.build.targets.wheel]
12
12
  packages = ["plain"]
@@ -1,32 +0,0 @@
1
- # Generated by Plain 0.127.2 on 2026-03-25 20:19
2
-
3
- from plain.postgres import migrations
4
-
5
-
6
- class Migration(migrations.Migration):
7
- dependencies = [
8
- ("plainredirection", "0001_initial"),
9
- ]
10
-
11
- operations = [
12
- migrations.RenameIndex(
13
- model_name="notfoundlog",
14
- new_name="plainredirection_notfoundlog_created_at_idx",
15
- old_name="plainredire_created_d5f0c7_idx",
16
- ),
17
- migrations.RenameIndex(
18
- model_name="redirect",
19
- new_name="plainredirection_redirect_order_idx",
20
- old_name="plainredire_order_44dde0_idx",
21
- ),
22
- migrations.RenameIndex(
23
- model_name="redirect",
24
- new_name="plainredirection_redirect_created_at_idx",
25
- old_name="plainredire_created_18c288_idx",
26
- ),
27
- migrations.RenameIndex(
28
- model_name="redirectlog",
29
- new_name="plainredirection_redirectlog_created_at_idx",
30
- old_name="plainredire_created_5d75f4_idx",
31
- ),
32
- ]