diff --git a/.gitignore b/.gitignore
index f55b2e7..a614f6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ staticfiles
local_settings.py
db.sqlite3
*~
+*.env
*.py[co]
settings_secret.py
.idea/*
diff --git a/README.md b/README.md
index 4cd4651..ad8bb5f 100644
--- a/README.md
+++ b/README.md
@@ -9,4 +9,3 @@ later works in same gallery group are available, you get links to scroll over to
The live website has been deployed to Heroku and can be viewed at
https://paivisuomela.herokuapp.com
-
diff --git a/gallery/migrations/0001_initial.py b/gallery/migrations/0001_initial.py
index 4bc5c1c..04a3649 100644
--- a/gallery/migrations/0001_initial.py
+++ b/gallery/migrations/0001_initial.py
@@ -1,41 +1,35 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
+# Generated by Django 4.2.3 on 2023-07-11 20:55
-from django.db import models, migrations
+from django.db import migrations, models
+import django.db.models.deletion
class Migration(migrations.Migration):
+ initial = True
+
dependencies = [
]
operations = [
migrations.CreateModel(
- name='Artwork',
+ name='GalleryGroup',
fields=[
- ('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
- ('title', models.CharField(max_length=200)),
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(default='', max_length=100)),
('description', models.TextField()),
- ('published_date', models.DateTimeField(null=True, blank=True)),
- ('art', models.ImageField(upload_to='media/art')),
+ ('slug', models.SlugField(unique=True)),
],
- options={
- },
- bases=(models.Model,),
),
migrations.CreateModel(
- name='Group',
+ name='Artwork',
fields=[
- ('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200)),
+ ('description', models.TextField()),
+ ('published_date', models.DateTimeField(blank=True)),
+ ('art', models.ImageField(upload_to='art')),
+ ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gallery.gallerygroup')),
],
- options={
- },
- bases=(models.Model,),
- ),
- migrations.AddField(
- model_name='artwork',
- name='group',
- field=models.ForeignKey(to='gallery.Group'),
- preserve_default=True,
),
]
diff --git a/gallery/migrations/0002_alter_artwork_description.py b/gallery/migrations/0002_alter_artwork_description.py
new file mode 100644
index 0000000..f46dead
--- /dev/null
+++ b/gallery/migrations/0002_alter_artwork_description.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.3 on 2023-07-12 00:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gallery', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='artwork',
+ name='description',
+ field=models.TextField(default=''),
+ ),
+ ]
diff --git a/gallery/migrations/0002_auto_20150427_1134.py b/gallery/migrations/0002_auto_20150427_1134.py
deleted file mode 100644
index 0fe9432..0000000
--- a/gallery/migrations/0002_auto_20150427_1134.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='group',
- name='description',
- field=models.TextField(null=True, blank=True),
- preserve_default=True,
- ),
- migrations.AddField(
- model_name='group',
- name='title',
- field=models.CharField(max_length=100, default=''),
- preserve_default=True,
- ),
- ]
diff --git a/gallery/migrations/0003_alter_gallerygroup_description.py b/gallery/migrations/0003_alter_gallerygroup_description.py
new file mode 100644
index 0000000..c891575
--- /dev/null
+++ b/gallery/migrations/0003_alter_gallerygroup_description.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.3 on 2023-07-12 00:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gallery', '0002_alter_artwork_description'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='gallerygroup',
+ name='description',
+ field=models.TextField(default=''),
+ ),
+ ]
diff --git a/gallery/migrations/0003_auto_20150427_1134.py b/gallery/migrations/0003_auto_20150427_1134.py
deleted file mode 100644
index 9e3911e..0000000
--- a/gallery/migrations/0003_auto_20150427_1134.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0002_auto_20150427_1134'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='group',
- name='description',
- field=models.TextField(),
- ),
- ]
diff --git a/gallery/migrations/0004_alter_artwork_description_and_more.py b/gallery/migrations/0004_alter_artwork_description_and_more.py
new file mode 100644
index 0000000..eb9d3d1
--- /dev/null
+++ b/gallery/migrations/0004_alter_artwork_description_and_more.py
@@ -0,0 +1,23 @@
+# Generated by Django 4.2.3 on 2023-07-12 00:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gallery', '0003_alter_gallerygroup_description'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='artwork',
+ name='description',
+ field=models.TextField(blank=True, default=''),
+ ),
+ migrations.AlterField(
+ model_name='gallerygroup',
+ name='description',
+ field=models.TextField(blank=True, default=''),
+ ),
+ ]
diff --git a/gallery/migrations/0004_auto_20150427_1254.py b/gallery/migrations/0004_auto_20150427_1254.py
deleted file mode 100644
index 956a93e..0000000
--- a/gallery/migrations/0004_auto_20150427_1254.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0003_auto_20150427_1134'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='GalleryGroup',
- fields=[
- ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
- ('title', models.CharField(max_length=100, default='')),
- ('description', models.TextField()),
- ],
- options={
- },
- bases=(models.Model,),
- ),
- migrations.AlterField(
- model_name='artwork',
- name='group',
- field=models.ForeignKey(to='gallery.GalleryGroup'),
- ),
- migrations.DeleteModel(
- name='Group',
- ),
- ]
diff --git a/gallery/migrations/0005_artwork_featured.py b/gallery/migrations/0005_artwork_featured.py
new file mode 100644
index 0000000..f0f0a3d
--- /dev/null
+++ b/gallery/migrations/0005_artwork_featured.py
@@ -0,0 +1,19 @@
+# Generated by Django 4.2.3 on 2023-07-12 00:51
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('gallery', '0004_alter_artwork_description_and_more'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='artwork',
+ name='featured',
+ field=models.BooleanField(default=False, help_text='Feature this artwork on the home page'),
+ preserve_default=False,
+ ),
+ ]
diff --git a/gallery/migrations/0005_gallerygroup_slug.py b/gallery/migrations/0005_gallerygroup_slug.py
deleted file mode 100644
index 6a1e09f..0000000
--- a/gallery/migrations/0005_gallerygroup_slug.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0004_auto_20150427_1254'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='gallerygroup',
- name='slug',
- field=models.SlugField(unique=True, default=''),
- preserve_default=False,
- ),
- ]
diff --git a/gallery/migrations/0006_auto_20150428_1116.py b/gallery/migrations/0006_auto_20150428_1116.py
deleted file mode 100644
index 4a5af14..0000000
--- a/gallery/migrations/0006_auto_20150428_1116.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0005_gallerygroup_slug'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='gallerygroup',
- name='slug',
- field=models.SlugField(),
- ),
- ]
diff --git a/gallery/migrations/0007_auto_20150428_1131.py b/gallery/migrations/0007_auto_20150428_1131.py
deleted file mode 100644
index ab68579..0000000
--- a/gallery/migrations/0007_auto_20150428_1131.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import models, migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('gallery', '0006_auto_20150428_1116'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='gallerygroup',
- name='slug',
- field=models.SlugField(),
- ),
- ]
diff --git a/gallery/models.py b/gallery/models.py
index 60ef016..016409c 100644
--- a/gallery/models.py
+++ b/gallery/models.py
@@ -1,12 +1,11 @@
from django.db import models
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.template.defaultfilters import slugify
class GalleryGroup(models.Model):
-
title = models.CharField(max_length=100, default='')
- description = models.TextField()
+ description = models.TextField(blank=True, default='')
slug = models.SlugField(unique=True)
def __str__(self):
@@ -22,10 +21,11 @@ def get_absolute_url(self):
class Artwork(models.Model):
title = models.CharField(max_length=200)
- description = models.TextField()
+ description = models.TextField(blank=True, default='')
published_date = models.DateTimeField(blank=True)
art = models.ImageField(upload_to="art")
- group = models.ForeignKey('GalleryGroup')
+ group = models.ForeignKey('GalleryGroup', on_delete=models.CASCADE)
+ featured = models.BooleanField(help_text='Feature this artwork on the home page')
def publish(self):
self.save()
diff --git a/gallery/templates/404.html b/gallery/templates/404.html
index 36c3432..2e0201f 100644
--- a/gallery/templates/404.html
+++ b/gallery/templates/404.html
@@ -1,5 +1,4 @@
-{% extends 'blog/base.html' %}
-
+{% extends 'base.html' %}
{% block content %}
diff --git a/gallery/templates/gallery/base.html b/gallery/templates/base.html
similarity index 76%
rename from gallery/templates/gallery/base.html
rename to gallery/templates/base.html
index 9601f3e..8969ba0 100644
--- a/gallery/templates/gallery/base.html
+++ b/gallery/templates/base.html
@@ -1,4 +1,4 @@
-{% load staticfiles %}
+{% load static %}
@@ -25,7 +25,7 @@