Skip to content

Commit

Permalink
fix edited_time
Browse files Browse the repository at this point in the history
  • Loading branch information
Her Email authored and alphatownsman committed Nov 21, 2023
1 parent 476a8bc commit 7a6a8a4
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 10 deletions.
63 changes: 63 additions & 0 deletions journal/migrations/0019_alter_collection_edited_time_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Generated by Django 4.2.7 on 2023-11-21 00:14

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("journal", "0018_shelflogentrypost_shelflogentry_posts_and_more"),
]

operations = [
migrations.AlterField(
model_name="collection",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="collectionmember",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="comment",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="like",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="rating",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="review",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="shelf",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="shelfmember",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="tag",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name="tagmember",
name="edited_time",
field=models.DateTimeField(auto_now=True),
),
]
4 changes: 1 addition & 3 deletions journal/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ class Content(Piece):
default=0
) # 0: Public / 1: Follower only / 2: Self only
created_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(
default=timezone.now
) # auto_now=True FIXME revert this after migration
edited_time = models.DateTimeField(auto_now=True)
metadata = models.JSONField(default=dict)
item = models.ForeignKey(Item, on_delete=models.PROTECT)
remote_id = models.CharField(max_length=200, null=True, default=None)
Expand Down
4 changes: 2 additions & 2 deletions journal/models/itemlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class List(Piece):
default=0
) # 0: Public / 1: Follower only / 2: Self only
created_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(auto_now=True)
metadata = models.JSONField(default=dict)

class Meta:
Expand Down Expand Up @@ -148,7 +148,7 @@ class ListMember(Piece):
default=0
) # 0: Public / 1: Follower only / 2: Self only
created_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(auto_now=True)
metadata = models.JSONField(default=dict)
item = models.ForeignKey(Item, on_delete=models.PROTECT)
position = models.PositiveIntegerField()
Expand Down
2 changes: 1 addition & 1 deletion journal/models/like.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Like(Piece): # TODO remove
default=0
) # 0: Public / 1: Follower only / 2: Self only
created_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(default=timezone.now)
edited_time = models.DateTimeField(auto_now=True)
target = models.ForeignKey(Piece, on_delete=models.CASCADE, related_name="likes")

@staticmethod
Expand Down
1 change: 0 additions & 1 deletion journal/views/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ def collection_edit(request: AuthedHttpRequest, collection_uuid=None):
if form.is_valid():
if not collection:
form.instance.owner = request.user.identity
form.instance.edited_time = timezone.now()
form.save()
return redirect(
reverse("journal:collection_retrieve", args=[form.instance.uuid])
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cachetools
dateparser
discord.py
django~=4.2.6
django~=4.2.7
django-anymail
django-auditlog>=3.0.0-beta.2
django-auditlog>=3.0.0-beta.3
django-bleach
django-compressor
django-cors-headers
Expand Down
2 changes: 1 addition & 1 deletion takahe/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .views import *

app_name = "users"
app_name = "takahe"
urlpatterns = [
path("auth/login/", auth_login, name="auth_login"),
path("auth/logout/", auth_logout, name="auth_logout"),
Expand Down

0 comments on commit 7a6a8a4

Please sign in to comment.