plain.redirection 0.2.2__tar.gz → 0.2.4__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.
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/PKG-INFO +1 -1
- plain_redirection-0.2.4/plain/redirection/migrations/0006_alter_notfoundlog_user_agent_and_more.py +23 -0
- plain_redirection-0.2.4/plain/redirection/migrations/0007_alter_redirect_http_status_alter_redirect_order_and_more.py +29 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/models.py +9 -9
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/pyproject.toml +1 -1
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/.gitignore +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/README.md +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/README.md +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/__init__.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/config.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/middleware.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0001_initial.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0002_redirect_enabled_redirect_is_regex.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0003_alter_redirect_from_pattern.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0004_alter_notfoundlog_referer_alter_redirectlog_referer.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0005_alter_notfoundlog_referer_and_more.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/__init__.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/staff.py +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/templates/staff/plainredirection/redirect_form.html +0 -0
- {plain_redirection-0.2.2 → plain_redirection-0.2.4}/uv.lock +0 -0
plain_redirection-0.2.4/plain/redirection/migrations/0006_alter_notfoundlog_user_agent_and_more.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Plain 0.21.1 on 2025-02-06 16:48
|
|
2
|
+
|
|
3
|
+
from plain import models
|
|
4
|
+
from plain.models import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("plainredirection", "0005_alter_notfoundlog_referer_and_more"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="notfoundlog",
|
|
15
|
+
name="user_agent",
|
|
16
|
+
field=models.CharField(blank=True, max_length=512),
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name="redirectlog",
|
|
20
|
+
name="user_agent",
|
|
21
|
+
field=models.CharField(blank=True, max_length=512),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Generated by Plain 0.21.1 on 2025-02-06 17:59
|
|
2
|
+
|
|
3
|
+
from plain import models
|
|
4
|
+
from plain.models import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('plainredirection', '0006_alter_notfoundlog_user_agent_and_more'),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AlterField(
|
|
15
|
+
model_name='redirect',
|
|
16
|
+
name='http_status',
|
|
17
|
+
field=models.PositiveSmallIntegerField(default=301),
|
|
18
|
+
),
|
|
19
|
+
migrations.AlterField(
|
|
20
|
+
model_name='redirect',
|
|
21
|
+
name='order',
|
|
22
|
+
field=models.PositiveSmallIntegerField(db_index=True, default=0),
|
|
23
|
+
),
|
|
24
|
+
migrations.AlterField(
|
|
25
|
+
model_name='redirectlog',
|
|
26
|
+
name='http_status',
|
|
27
|
+
field=models.PositiveSmallIntegerField(default=301),
|
|
28
|
+
),
|
|
29
|
+
]
|
|
@@ -13,12 +13,12 @@ def _get_client_ip(request):
|
|
|
13
13
|
class Redirect(models.Model):
|
|
14
14
|
from_pattern = models.CharField(max_length=255, unique=True)
|
|
15
15
|
to_pattern = models.CharField(max_length=255)
|
|
16
|
-
http_status = models.
|
|
16
|
+
http_status = models.PositiveSmallIntegerField(
|
|
17
17
|
default=301
|
|
18
18
|
) # Default to permanent - could be choices?
|
|
19
19
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
20
20
|
updated_at = models.DateTimeField(auto_now=True)
|
|
21
|
-
order = models.
|
|
21
|
+
order = models.PositiveSmallIntegerField(default=0, db_index=True)
|
|
22
22
|
enabled = models.BooleanField(default=True)
|
|
23
23
|
is_regex = models.BooleanField(default=False)
|
|
24
24
|
|
|
@@ -69,11 +69,11 @@ class RedirectLog(models.Model):
|
|
|
69
69
|
# The actuals that were used to redirect
|
|
70
70
|
from_url = models.URLField()
|
|
71
71
|
to_url = models.URLField()
|
|
72
|
-
http_status = models.
|
|
72
|
+
http_status = models.PositiveSmallIntegerField(default=301)
|
|
73
73
|
|
|
74
74
|
# Request metadata
|
|
75
75
|
ip_address = models.GenericIPAddressField()
|
|
76
|
-
user_agent = models.CharField(max_length=512)
|
|
76
|
+
user_agent = models.CharField(blank=True, max_length=512)
|
|
77
77
|
referer = models.CharField(blank=True, max_length=512)
|
|
78
78
|
|
|
79
79
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
@@ -98,8 +98,8 @@ class RedirectLog(models.Model):
|
|
|
98
98
|
to_url=to_url,
|
|
99
99
|
http_status=redirect.http_status,
|
|
100
100
|
ip_address=_get_client_ip(request),
|
|
101
|
-
user_agent=request.headers.get("User-Agent"),
|
|
102
|
-
referer=request.headers.get("Referer"),
|
|
101
|
+
user_agent=request.headers.get("User-Agent", ""),
|
|
102
|
+
referer=request.headers.get("Referer", ""),
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@ class NotFoundLog(models.Model):
|
|
|
108
108
|
|
|
109
109
|
# Request metadata
|
|
110
110
|
ip_address = models.GenericIPAddressField()
|
|
111
|
-
user_agent = models.CharField(max_length=512)
|
|
111
|
+
user_agent = models.CharField(blank=True, max_length=512)
|
|
112
112
|
referer = models.CharField(blank=True, max_length=512)
|
|
113
113
|
|
|
114
114
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
@@ -121,6 +121,6 @@ class NotFoundLog(models.Model):
|
|
|
121
121
|
return cls.objects.create(
|
|
122
122
|
url=request.build_absolute_uri(),
|
|
123
123
|
ip_address=_get_client_ip(request),
|
|
124
|
-
user_agent=request.headers.get("User-Agent"),
|
|
125
|
-
referer=request.headers.get("Referer"),
|
|
124
|
+
user_agent=request.headers.get("User-Agent", ""),
|
|
125
|
+
referer=request.headers.get("Referer", ""),
|
|
126
126
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/0001_initial.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_redirection-0.2.2 → plain_redirection-0.2.4}/plain/redirection/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|