# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-ALLOWED_HOSTS = ['quotes.fperrin.net']
+ALLOWED_HOSTS = []
+
# Application definition
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- 'tagging',
'tinymce',
'quotes',
)
USE_TZ = True
-USE_X_FORWARDED_HOST = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
-from django import forms
from django.contrib import admin
# Register your models here.
-from .models import Author, Work, Quote
-#admin.site.register(Tag)
+from .models import Tag, Author, Work, Quote
+admin.site.register(Tag)
+admin.site.register(Author)
admin.site.register(Work)
admin.site.register(Quote)
-
-class AuthorForm(forms.ModelForm):
-# taggit = TagField(required=False, widget=LabelWidget)
- pass
-
-class AuthorAdmin(admin.ModelAdmin):
- form = AuthorForm
-admin.site.register(Author, AuthorAdmin)
safe_value = valid_html(value)
setattr(model_instance, self.attname, safe_value)
return safe_value
-
-import tagging.fields
-
-class TagField(tagging.fields.TagField):
- def __init__(self, *args, **kwargs):
- kwargs.setdefault('help_text', 'Space-separated list of tags')
- return tagging.fields.TagField.__init__(self, *args, **kwargs)
# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:22
from __future__ import unicode_literals
from django.db import migrations, models
-import django.db.models.deletion
-import quotes.localmodels
class Migration(migrations.Migration):
- initial = True
-
dependencies = [
]
migrations.CreateModel(
name='Author',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(help_text=b'Name of the author', max_length=100)),
- ('notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the author; may be left blank. Will not be HTML-escaped.')),
- ('pvt_notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the author; not displayed on the public interface')),
- ('birth_date', models.DateField(blank=True, help_text=b'Date of birth', null=True)),
- ('death_date', models.DateField(blank=True, help_text=b'Date of death (leave blank if still alive!)', null=True)),
+ ('notes', models.TextField(help_text=b'Notes about the author; may be left blank. Will not be HTML-escaped.', blank=True)),
+ ('pvt_notes', models.TextField(help_text=b'Notes about the author; not displayed on the public interface', blank=True)),
+ ('birth_date', models.DateField(help_text=b'Date of birth', null=True, blank=True)),
+ ('death_date', models.DateField(help_text=b'Date of death (leave blank if still alive!)', null=True, blank=True)),
],
),
migrations.CreateModel(
- name='Quote',
+ name='Context',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('text', quotes.localmodels.HTMLField()),
- ('notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the quote; may be left blank. Will not be HTML-escaped. XXX: offer a WYSIWYG editor')),
- ('pvt_notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the quote; not displayed on the public interface')),
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(help_text=b'Name of the context for the quote (title of the work or speech it appears in)', max_length=100)),
+ ('date', models.DateField(help_text=b'Date of the quote', null=True, blank=True)),
+ ('notes', models.TextField(help_text=b'Notes about the work; may be left blank. Will not be HTML-escaped. XXX: offer a WYSIWYG editor', blank=True)),
+ ('pvt_notes', models.TextField(help_text=b'Notes about the work; not displayed on the public interface', blank=True)),
],
),
migrations.CreateModel(
- name='Tag',
+ name='Quote',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('tag', models.CharField(max_length=100)),
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('text', models.TextField()),
+ ('notes', models.TextField(help_text=b'Notes about the quote; may be left blank. Will not be HTML-escaped. XXX: offer a WYSIWYG editor', blank=True)),
+ ('pvt_notes', models.TextField(help_text=b'Notes about the quote; not displayed on the public interface', blank=True)),
+ ('context', models.ForeignKey(to='quotes.Context')),
],
),
migrations.CreateModel(
- name='Work',
+ name='Tag',
fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('name', models.CharField(help_text=b'Name of the context for the quote (title of the work or speech it appears in)', max_length=100)),
- ('date', models.DateField(blank=True, help_text=b'Date of the quote', null=True)),
- ('notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the work; may be left blank. Will not be HTML-escaped. XXX: offer a WYSIWYG editor')),
- ('pvt_notes', quotes.localmodels.HTMLField(blank=True, help_text=b'Notes about the work; not displayed on the public interface')),
- ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quotes.Author')),
- ('tags', models.ManyToManyField(blank=True, to='quotes.Tag')),
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('tag', models.CharField(max_length=100)),
],
),
migrations.AddField(
model_name='quote',
name='tags',
- field=models.ManyToManyField(blank=True, to='quotes.Tag'),
+ field=models.ManyToManyField(to='quotes.Tag', blank=True),
),
migrations.AddField(
- model_name='quote',
- name='work',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quotes.Work'),
+ model_name='context',
+ name='tags',
+ field=models.ManyToManyField(to='quotes.Tag', blank=True),
),
migrations.AddField(
model_name='author',
name='tags',
- field=models.ManyToManyField(blank=True, to='quotes.Tag'),
+ field=models.ManyToManyField(to='quotes.Tag', blank=True),
),
]
# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:33
from __future__ import unicode_literals
from django.db import migrations, models
]
operations = [
- migrations.AlterField(
- model_name='author',
- name='tags',
- field=models.ManyToManyField(to='quotes.Tag'),
+ migrations.AddField(
+ model_name='context',
+ name='author',
+ field=models.ForeignKey(default=1, to='quotes.Author'),
+ preserve_default=False,
),
]
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('quotes', '0002_context_author'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Work',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('name', models.CharField(help_text=b'Name of the context for the quote (title of the work or speech it appears in)', max_length=100)),
+ ('date', models.DateField(help_text=b'Date of the quote', null=True, blank=True)),
+ ('notes', models.TextField(help_text=b'Notes about the work; may be left blank. Will not be HTML-escaped. XXX: offer a WYSIWYG editor', blank=True)),
+ ('pvt_notes', models.TextField(help_text=b'Notes about the work; not displayed on the public interface', blank=True)),
+ ('author', models.ForeignKey(to='quotes.Author')),
+ ('tags', models.ManyToManyField(to='quotes.Tag', blank=True)),
+ ],
+ ),
+ migrations.RemoveField(
+ model_name='context',
+ name='author',
+ ),
+ migrations.RemoveField(
+ model_name='context',
+ name='tags',
+ ),
+ migrations.AlterField(
+ model_name='quote',
+ name='context',
+ field=models.ForeignKey(to='quotes.Work'),
+ ),
+ migrations.DeleteModel(
+ name='Context',
+ ),
+ ]
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:34
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('quotes', '0002_auto_20161031_0033'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='author',
- name='tags',
- field=models.ManyToManyField(blank=True, to='quotes.Tag'),
- ),
- ]
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('quotes', '0003_auto_20161009_2254'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='quote',
+ old_name='context',
+ new_name='work',
+ ),
+ ]
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:36
-from __future__ import unicode_literals
-
-from django.db import migrations
-import tagging.fields
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('quotes', '0003_auto_20161031_0034'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='author',
- name='tagbis',
- field=tagging.fields.TagField(blank=True, max_length=255),
- ),
- migrations.AddField(
- model_name='work',
- name='tagter',
- field=tagging.fields.TagField(blank=True, max_length=255),
- ),
- ]
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:52
-from __future__ import unicode_literals
-
-from django.db import migrations
-import quotes.localmodels
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('quotes', '0004_auto_20161031_0036'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='author',
- name='tagbis',
- ),
- migrations.RemoveField(
- model_name='work',
- name='tagter',
- ),
- migrations.RemoveField(
- model_name='author',
- name='tags',
- ),
- migrations.AddField(
- model_name='author',
- name='tags',
- field=quotes.localmodels.TagField(blank=True, max_length=255),
- ),
- migrations.RemoveField(
- model_name='quote',
- name='tags',
- ),
- migrations.AddField(
- model_name='quote',
- name='tags',
- field=quotes.localmodels.TagField(blank=True, max_length=255),
- ),
- migrations.RemoveField(
- model_name='work',
- name='tags',
- ),
- migrations.AddField(
- model_name='work',
- name='tags',
- field=quotes.localmodels.TagField(blank=True, max_length=255),
- ),
- migrations.DeleteModel(
- name='Tag',
- ),
- ]
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:55
-from __future__ import unicode_literals
-
-from django.db import migrations
-import quotes.localmodels
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('quotes', '0005_auto_20161031_0052'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='author',
- name='tags',
- ),
- migrations.AddField(
- model_name='author',
- name='tag',
- field=quotes.localmodels.TagField(blank=True, max_length=255),
- ),
- ]
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.2 on 2016-10-31 00:56
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('quotes', '0006_auto_20161031_0055'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='author',
- old_name='tag',
- new_name='tags',
- ),
- ]
from django.db import models
-from localmodels import HTMLField, TagField
+from localmodels import HTMLField
# Create your models here.
+class Tag(models.Model):
+ tag = models.CharField(max_length=100)
+ def __unicode__(self):
+ return self.tag
+
class Author(models.Model):
name = models.CharField(max_length=100,
help_text="Name of the author")
pvt_notes = HTMLField(blank=True, help_text= \
"Notes about the author; not displayed on \
the public interface",)
- tags = TagField()
+ tags = models.ManyToManyField(Tag, blank=True)
birth_date = models.DateField(blank=True, null=True,
help_text="Date of birth")
author = models.ForeignKey(Author)
date = models.DateField(blank=True, null=True,
help_text="Date of the quote")
- tags = TagField()
+ tags = models.ManyToManyField(Tag, blank=True)
notes = HTMLField(blank=True, help_text= \
"Notes about the work; may be left blank. Will \
class Quote(models.Model):
text = HTMLField()
- tags = TagField()
+ tags = models.ManyToManyField(Tag, blank=True)
work = models.ForeignKey(Work)
notes = HTMLField(blank=True, help_text= \
from random import randint
-from .models import Author, Work, Quote
+from .models import Author, Work, Quote, Tag
# Create your views here.
def onequote(request, quote_id):