diff --git a/cookbook/migrations/0044_viewlog.py b/cookbook/migrations/0044_viewlog.py
new file mode 100644
index 00000000..9c4f2fcf
--- /dev/null
+++ b/cookbook/migrations/0044_viewlog.py
@@ -0,0 +1,25 @@
+# Generated by Django 3.0.5 on 2020-05-11 10:21
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('cookbook', '0043_auto_20200507_2302'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='ViewLog',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ('recipe', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.Recipe')),
+ ],
+ ),
+ ]
diff --git a/cookbook/models.py b/cookbook/models.py
index b6d04b44..42a8a698 100644
--- a/cookbook/models.py
+++ b/cookbook/models.py
@@ -248,3 +248,12 @@ class CookLog(models.Model):
def __str__(self):
return self.recipe.name
+
+
+class ViewLog(models.Model):
+ recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE)
+ created_by = models.ForeignKey(User, on_delete=models.CASCADE)
+ created_at = models.DateTimeField(auto_now_add=True)
+
+ def __str__(self):
+ return self.recipe.name
diff --git a/cookbook/templates/index.html b/cookbook/templates/index.html
index cee08e9c..1c23ea3f 100644
--- a/cookbook/templates/index.html
+++ b/cookbook/templates/index.html
@@ -77,6 +77,13 @@
{% endif %}
+ {% if last_viewed %}
+