summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2016-02-08 10:44:16 -0500
committerluxagraf <sng@luxagraf.net>2016-02-08 10:44:16 -0500
commit34df0f81d9a4480eb33c77a22879218e35fa0b49 (patch)
tree9438101199265d82cdf8206a808e2d287b0fe277 /app
parente6a76cb591edcd794b6ba27c64dd5ed68601353d (diff)
added an is_public field so I can keep some of the scifi and pulp out of
the public performance part of the site should I decided to do that.
Diffstat (limited to 'app')
-rw-r--r--app/books/migrations/0001_initial.py67
-rw-r--r--app/books/migrations/0002_book_is_public.py20
-rw-r--r--app/books/migrations/__init__.py0
-rw-r--r--app/books/models.py1
-rw-r--r--app/books/views.py2
5 files changed, 89 insertions, 1 deletions
diff --git a/app/books/migrations/0001_initial.py b/app/books/migrations/0001_initial.py
new file mode 100644
index 0000000..d272b11
--- /dev/null
+++ b/app/books/migrations/0001_initial.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-02-08 10:41
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Book',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=200)),
+ ('author_name', models.CharField(max_length=200)),
+ ('slug', models.CharField(max_length=50)),
+ ('read_date', models.DateTimeField()),
+ ('isbn', models.CharField(blank=True, max_length=100, null=True)),
+ ('body_markdown', models.TextField(blank=True, null=True)),
+ ('body_html', models.TextField(blank=True, null=True)),
+ ('read_in', models.TextField(blank=True, null=True)),
+ ('url', models.CharField(blank=True, max_length=200, null=True)),
+ ('pages', models.CharField(blank=True, max_length=5, null=True)),
+ ('publish_date', models.CharField(blank=True, max_length=40, null=True)),
+ ('publish_place', models.CharField(blank=True, max_length=100, null=True)),
+ ('openlib_url', models.CharField(blank=True, max_length=400, null=True)),
+ ('rating', models.CharField(blank=True, choices=[('1', '1 Star'), ('2', '2 Stars'), ('3', '3 Stars'), ('4', '4 Stars'), ('5', '5 Stars')], max_length=1, null=True)),
+ ('enable_comments', models.BooleanField(default=False)),
+ ('image', models.FileField(blank=True, null=True, upload_to='/Users/sng/Sites/luxagraf/site/media/images/book-covers/')),
+ ],
+ options={
+ 'ordering': ('-read_date',),
+ },
+ ),
+ migrations.CreateModel(
+ name='BookHighlight',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('page', models.PositiveSmallIntegerField(null=True)),
+ ('location', models.CharField(blank=True, max_length=200, null=True)),
+ ('date_added', models.DateTimeField()),
+ ('body_markdown', models.TextField()),
+ ],
+ options={
+ 'ordering': ('-date_added',),
+ },
+ ),
+ migrations.CreateModel(
+ name='BookNote',
+ fields=[
+ ('bookhighlight_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='books.BookHighlight')),
+ ],
+ bases=('books.bookhighlight',),
+ ),
+ migrations.AddField(
+ model_name='bookhighlight',
+ name='book',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='books.Book'),
+ ),
+ ]
diff --git a/app/books/migrations/0002_book_is_public.py b/app/books/migrations/0002_book_is_public.py
new file mode 100644
index 0000000..bf36759
--- /dev/null
+++ b/app/books/migrations/0002_book_is_public.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9 on 2016-02-08 10:42
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('books', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='book',
+ name='is_public',
+ field=models.BooleanField(default=True),
+ ),
+ ]
diff --git a/app/books/migrations/__init__.py b/app/books/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/books/migrations/__init__.py
diff --git a/app/books/models.py b/app/books/models.py
index 64d9a3d..4359a3e 100644
--- a/app/books/models.py
+++ b/app/books/models.py
@@ -30,6 +30,7 @@ class Book(models.Model):
)
rating = models.CharField(max_length=1, choices=RATINGS, null=True, blank=True)
enable_comments = models.BooleanField(default=False)
+ is_public = models.BooleanField(default=True)
image = models.FileField(upload_to="%s/%s" % (settings.IMAGES_ROOT, 'book-covers/'), null=True, blank=True)
class Meta:
diff --git a/app/books/views.py b/app/books/views.py
index ef1d5f4..e829476 100644
--- a/app/books/views.py
+++ b/app/books/views.py
@@ -8,7 +8,7 @@ class BookListView(PaginatedListView):
template_name = 'archives/books.html'
def get_queryset(self):
- return Book.objects.all().order_by('-read_date').select_related()
+ return Book.objects.filter(is_public=True).order_by('-read_date').select_related()
class BookDetailView(DetailView):