diff --git a/db.sqlite3 b/db.sqlite3 index 756b1ae..fc3fcd4 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/movies/migrations/0009_auto_20211122_0042.py b/movies/migrations/0009_auto_20211122_0042.py new file mode 100644 index 0000000..33a1b99 --- /dev/null +++ b/movies/migrations/0009_auto_20211122_0042.py @@ -0,0 +1,47 @@ +# Generated by Django 3.2.9 on 2021-11-21 15:42 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('movies', '0008_alter_color_movie'), + ] + + operations = [ + migrations.AddField( + model_name='moviecomment', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='moviecomment', + name='updated_at', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='review', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='review', + name='updated_at', + field=models.DateTimeField(auto_now=True), + ), + migrations.AddField( + model_name='reviewcomment', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='reviewcomment', + name='updated_at', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/movies/models.py b/movies/models.py index 2741d97..16d92bf 100644 --- a/movies/models.py +++ b/movies/models.py @@ -42,17 +42,24 @@ class MovieComment(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) grade = models.IntegerField() content = models.CharField(max_length=50) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) class Review(models.Model): movie = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name="reviews") title = models.CharField(max_length=50) content = models.TextField() user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) class ReviewComment(models.Model): review = models.ForeignKey(Review, on_delete=models.CASCADE, related_name="comments") content = models.CharField(max_length=50) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + class UserColorRecord(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) diff --git a/movies/templates/movies/detail.html b/movies/templates/movies/detail.html index d3fcba2..223f9b8 100644 --- a/movies/templates/movies/detail.html +++ b/movies/templates/movies/detail.html @@ -42,7 +42,7 @@