diff options
Diffstat (limited to 'apps/notes')
-rw-r--r-- | apps/notes/migrations/0001_initial.py | 78 | ||||
-rw-r--r-- | apps/notes/migrations/0002_auto_20181204_0620.py | 42 | ||||
-rw-r--r-- | apps/notes/migrations/0003_auto_20181204_0641.py | 59 | ||||
-rw-r--r-- | apps/notes/migrations/0004_auto_20181204_0653.py | 19 | ||||
-rw-r--r-- | apps/notes/migrations/0005_luxtag_owner.py | 22 | ||||
-rw-r--r-- | apps/notes/migrations/0006_auto_20181204_0957.py | 22 | ||||
-rw-r--r-- | apps/notes/migrations/0007_auto_20181204_1050.py | 22 | ||||
-rw-r--r-- | apps/notes/migrations/0008_auto_20181204_1311.py | 19 | ||||
-rw-r--r-- | apps/notes/migrations/0009_remove_luxtag_owner.py | 17 | ||||
-rw-r--r-- | apps/notes/migrations/0010_auto_20181204_2117.py | 22 | ||||
-rw-r--r-- | apps/notes/migrations/0011_auto_20181221_1029.py | 39 | ||||
-rw-r--r-- | apps/notes/migrations/0012_auto_20181221_1038.py | 22 | ||||
-rw-r--r-- | apps/notes/migrations/0013_remove_luxtag_owner.py | 17 | ||||
-rw-r--r-- | apps/notes/migrations/0014_auto_20190104_1945.py | 56 | ||||
-rw-r--r-- | apps/notes/migrations/0015_auto_20190104_1946.py | 31 | ||||
-rw-r--r-- | apps/notes/views.py | 11 |
16 files changed, 71 insertions, 427 deletions
diff --git a/apps/notes/migrations/0001_initial.py b/apps/notes/migrations/0001_initial.py index f8e2fff..d2bb58e 100644 --- a/apps/notes/migrations/0001_initial.py +++ b/apps/notes/migrations/0001_initial.py @@ -1,9 +1,10 @@ -# Generated by Django 2.1.2 on 2018-11-24 13:55 +# Generated by Django 2.1.2 on 2019-05-02 14:30 from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion +import django.db.models.manager import taggit.managers import uuid @@ -13,12 +14,39 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('taggit', '0002_auto_20150616_2121'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('contenttypes', '0002_remove_content_type_name'), ] operations = [ migrations.CreateModel( + name='Annotation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('unique_id', models.UUIDField(default=uuid.uuid4, editable=False)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('highlight_text', models.TextField(blank=True)), + ('body_text', models.TextField(blank=True)), + ('body_html', models.TextField(blank=True)), + ('body_qjson', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)), + ('is_public', models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name='LuxTag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), + ('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')), + ('color_rgb', models.CharField(blank=True, max_length=20)), + ], + options={ + 'verbose_name_plural': 'Tags', + 'verbose_name': 'Tag', + }, + ), + migrations.CreateModel( name='Note', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), @@ -26,13 +54,19 @@ class Migration(migrations.Migration): ('date_created', models.DateTimeField(auto_now_add=True)), ('date_updated', models.DateTimeField(auto_now=True)), ('title', models.CharField(max_length=250)), - ('body_text', models.TextField(null=True)), - ('body_html', models.TextField(blank=True, null=True)), + ('body_text', models.TextField(blank=True)), + ('body_html', models.TextField(blank=True)), ('body_qjson', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)), - ('url', models.CharField(blank=True, max_length=250, null=True)), + ('url', models.CharField(blank=True, max_length=250)), ('slug', models.SlugField(blank=True)), ('is_public', models.BooleanField(default=False)), ], + options={ + 'ordering': ('-date_created', '-date_updated'), + }, + managers=[ + ('include_trash', django.db.models.manager.Manager()), + ], ), migrations.CreateModel( name='Notebook', @@ -40,12 +74,30 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('unique_id', models.UUIDField(default=uuid.uuid4, editable=False)), ('name', models.CharField(max_length=250)), - ('url', models.CharField(blank=True, max_length=250, null=True)), + ('color_rgb', models.CharField(blank=True, max_length=20)), ('slug', models.SlugField(blank=True)), ('date_created', models.DateTimeField(auto_now_add=True)), ('date_updated', models.DateTimeField(auto_now=True)), ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], + options={ + 'ordering': ('name', 'date_created', 'date_updated'), + }, + managers=[ + ('include_trash', django.db.models.manager.Manager()), + ], + ), + migrations.CreateModel( + name='TaggedNotes', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.IntegerField(db_index=True, verbose_name='Object id')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')), + ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_items', to='notes.LuxTag')), + ], + options={ + 'abstract': False, + }, ), migrations.AddField( model_name='note', @@ -60,11 +112,21 @@ class Migration(migrations.Migration): migrations.AddField( model_name='note', name='tags', - field=taggit.managers.TaggableManager(blank=True, help_text='Tags', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'), + field=taggit.managers.TaggableManager(blank=True, help_text='Tags', through='notes.TaggedNotes', to='notes.LuxTag', verbose_name='Tags'), + ), + migrations.AddField( + model_name='annotation', + name='note', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='notes.Note'), + ), + migrations.AddField( + model_name='annotation', + name='owner', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterUniqueTogether( name='notebook', - unique_together={('owner', 'slug')}, + unique_together={('owner', 'name')}, ), migrations.AlterUniqueTogether( name='note', diff --git a/apps/notes/migrations/0002_auto_20181204_0620.py b/apps/notes/migrations/0002_auto_20181204_0620.py deleted file mode 100644 index e7cb38d..0000000 --- a/apps/notes/migrations/0002_auto_20181204_0620.py +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 12:20 - -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), - ('notes', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='Tag', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=40)), - ('slug', models.SlugField(blank=True)), - ('color_hex', models.CharField(max_length=6)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='parent_tag', to='notes.Tag')), - ], - ), - migrations.AlterModelOptions( - name='note', - options={'ordering': ('-date_created', '-date_updated')}, - ), - migrations.AddField( - model_name='note', - name='tagstwo', - field=models.ManyToManyField(blank=True, to='notes.Tag'), - ), - migrations.AlterUniqueTogether( - name='tag', - unique_together={('owner', 'name')}, - ), - ] diff --git a/apps/notes/migrations/0003_auto_20181204_0641.py b/apps/notes/migrations/0003_auto_20181204_0641.py deleted file mode 100644 index 9423058..0000000 --- a/apps/notes/migrations/0003_auto_20181204_0641.py +++ /dev/null @@ -1,59 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 12:41 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('contenttypes', '0002_remove_content_type_name'), - ('notes', '0002_auto_20181204_0620'), - ] - - operations = [ - migrations.CreateModel( - name='LuxTag', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), - ('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')), - ('color_hex', models.CharField(max_length=6)), - ], - options={ - 'verbose_name': 'Tag', - 'verbose_name_plural': 'Tags', - }, - ), - migrations.CreateModel( - name='TaggedNotes', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('object_id', models.IntegerField(db_index=True, verbose_name='Object id')), - ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')), - ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_items', to='notes.LuxTag')), - ], - options={ - 'abstract': False, - }, - ), - migrations.AlterUniqueTogether( - name='tag', - unique_together=set(), - ), - migrations.RemoveField( - model_name='tag', - name='owner', - ), - migrations.RemoveField( - model_name='tag', - name='parent', - ), - migrations.RemoveField( - model_name='note', - name='tagstwo', - ), - migrations.DeleteModel( - name='Tag', - ), - ] diff --git a/apps/notes/migrations/0004_auto_20181204_0653.py b/apps/notes/migrations/0004_auto_20181204_0653.py deleted file mode 100644 index fc6d911..0000000 --- a/apps/notes/migrations/0004_auto_20181204_0653.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 12:53 - -from django.db import migrations -import taggit.managers - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0003_auto_20181204_0641'), - ] - - operations = [ - migrations.AlterField( - model_name='note', - name='tags', - field=taggit.managers.TaggableManager(blank=True, help_text='Tags', through='notes.TaggedNotes', to='notes.LuxTag', verbose_name='Tags'), - ), - ] diff --git a/apps/notes/migrations/0005_luxtag_owner.py b/apps/notes/migrations/0005_luxtag_owner.py deleted file mode 100644 index 168bd0b..0000000 --- a/apps/notes/migrations/0005_luxtag_owner.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 13:06 - -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), - ('notes', '0004_auto_20181204_0653'), - ] - - operations = [ - migrations.AddField( - model_name='luxtag', - name='owner', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - ] diff --git a/apps/notes/migrations/0006_auto_20181204_0957.py b/apps/notes/migrations/0006_auto_20181204_0957.py deleted file mode 100644 index bf4293c..0000000 --- a/apps/notes/migrations/0006_auto_20181204_0957.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 15:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0005_luxtag_owner'), - ] - - operations = [ - migrations.RemoveField( - model_name='notebook', - name='url', - ), - migrations.AddField( - model_name='notebook', - name='color_hex', - field=models.CharField(blank=True, max_length=6, null=True), - ), - ] diff --git a/apps/notes/migrations/0007_auto_20181204_1050.py b/apps/notes/migrations/0007_auto_20181204_1050.py deleted file mode 100644 index a4bdc30..0000000 --- a/apps/notes/migrations/0007_auto_20181204_1050.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 16:50 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0006_auto_20181204_0957'), - ] - - operations = [ - migrations.RemoveField( - model_name='notebook', - name='color_hex', - ), - migrations.AddField( - model_name='notebook', - name='color_rgb', - field=models.CharField(blank=True, max_length=20, null=True), - ), - ] diff --git a/apps/notes/migrations/0008_auto_20181204_1311.py b/apps/notes/migrations/0008_auto_20181204_1311.py deleted file mode 100644 index 02bf272..0000000 --- a/apps/notes/migrations/0008_auto_20181204_1311.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-04 19:11 - -from django.conf import settings -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('notes', '0007_auto_20181204_1050'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='notebook', - unique_together={('owner', 'name')}, - ), - ] diff --git a/apps/notes/migrations/0009_remove_luxtag_owner.py b/apps/notes/migrations/0009_remove_luxtag_owner.py deleted file mode 100644 index 18896f3..0000000 --- a/apps/notes/migrations/0009_remove_luxtag_owner.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-05 03:15 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0008_auto_20181204_1311'), - ] - - operations = [ - migrations.RemoveField( - model_name='luxtag', - name='owner', - ), - ] diff --git a/apps/notes/migrations/0010_auto_20181204_2117.py b/apps/notes/migrations/0010_auto_20181204_2117.py deleted file mode 100644 index 69da825..0000000 --- a/apps/notes/migrations/0010_auto_20181204_2117.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-05 03:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0009_remove_luxtag_owner'), - ] - - operations = [ - migrations.RemoveField( - model_name='luxtag', - name='color_hex', - ), - migrations.AddField( - model_name='luxtag', - name='color_rgb', - field=models.CharField(blank=True, max_length=20, null=True), - ), - ] diff --git a/apps/notes/migrations/0011_auto_20181221_1029.py b/apps/notes/migrations/0011_auto_20181221_1029.py deleted file mode 100644 index 7b88a62..0000000 --- a/apps/notes/migrations/0011_auto_20181221_1029.py +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-21 16:29 - -from django.conf import settings -import django.contrib.postgres.fields.jsonb -from django.db import migrations, models -import django.db.models.deletion -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('notes', '0010_auto_20181204_2117'), - ] - - operations = [ - migrations.CreateModel( - name='Annotation', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('unique_id', models.UUIDField(default=uuid.uuid4, editable=False)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('date_updated', models.DateTimeField(auto_now=True)), - ('highlight_text', models.TextField(null=True)), - ('body_text', models.TextField(null=True)), - ('body_html', models.TextField(blank=True, null=True)), - ('body_qjson', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)), - ('is_public', models.BooleanField(default=False)), - ('note', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='notes.Note')), - ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.AddField( - model_name='luxtag', - name='owner', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/apps/notes/migrations/0012_auto_20181221_1038.py b/apps/notes/migrations/0012_auto_20181221_1038.py deleted file mode 100644 index f02cbeb..0000000 --- a/apps/notes/migrations/0012_auto_20181221_1038.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-21 16:38 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -from django.contrib import auth -User = auth.get_user_model() - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0011_auto_20181221_1029'), - ] - - operations = [ - migrations.AlterField( - model_name='luxtag', - name='owner', - field=models.ForeignKey(default=User.objects.get(username='luxagraf').id, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - ] diff --git a/apps/notes/migrations/0013_remove_luxtag_owner.py b/apps/notes/migrations/0013_remove_luxtag_owner.py deleted file mode 100644 index a96b105..0000000 --- a/apps/notes/migrations/0013_remove_luxtag_owner.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 2.1.2 on 2018-12-21 17:20 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0012_auto_20181221_1038'), - ] - - operations = [ - migrations.RemoveField( - model_name='luxtag', - name='owner', - ), - ] diff --git a/apps/notes/migrations/0014_auto_20190104_1945.py b/apps/notes/migrations/0014_auto_20190104_1945.py deleted file mode 100644 index 42398a3..0000000 --- a/apps/notes/migrations/0014_auto_20190104_1945.py +++ /dev/null @@ -1,56 +0,0 @@ -# Generated by Django 2.1.2 on 2019-01-05 01:45 - -from django.db import migrations, models -import django.db.models.manager - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0013_remove_luxtag_owner'), - ] - - operations = [ - migrations.AlterModelManagers( - name='note', - managers=[ - ('include_trash', django.db.models.manager.Manager()), - ], - ), - migrations.AlterModelManagers( - name='notebook', - managers=[ - ('include_trash', django.db.models.manager.Manager()), - ], - ), - migrations.AlterField( - model_name='annotation', - name='body_html', - field=models.TextField(blank=True, default=''), - preserve_default=False, - ), - migrations.AlterField( - model_name='annotation', - name='body_text', - field=models.TextField(blank=True, default=''), - preserve_default=False, - ), - migrations.AlterField( - model_name='annotation', - name='highlight_text', - field=models.TextField(blank=True, default=''), - preserve_default=False, - ), - migrations.AlterField( - model_name='note', - name='body_html', - field=models.TextField(blank=True, default=''), - preserve_default=False, - ), - migrations.AlterField( - model_name='note', - name='body_text', - field=models.TextField(blank=True, default=''), - preserve_default=False, - ), - ] diff --git a/apps/notes/migrations/0015_auto_20190104_1946.py b/apps/notes/migrations/0015_auto_20190104_1946.py deleted file mode 100644 index 542dfc6..0000000 --- a/apps/notes/migrations/0015_auto_20190104_1946.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 2.1.2 on 2019-01-05 01:46 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('notes', '0014_auto_20190104_1945'), - ] - - operations = [ - migrations.AlterField( - model_name='luxtag', - name='color_rgb', - field=models.CharField(blank=True, default='', max_length=20), - preserve_default=False, - ), - migrations.AlterField( - model_name='note', - name='url', - field=models.CharField(blank=True, default='', max_length=250), - preserve_default=False, - ), - migrations.AlterField( - model_name='notebook', - name='color_rgb', - field=models.CharField(blank=True, default='', max_length=20), - preserve_default=False, - ), - ] diff --git a/apps/notes/views.py b/apps/notes/views.py index 280020a..2418043 100644 --- a/apps/notes/views.py +++ b/apps/notes/views.py @@ -20,7 +20,7 @@ from rest_framework import permissions from .serializers import NoteSerializer, NotebookSerializer, NoteTagSerializer from .models import Note, Notebook, LuxTag from .forms import NoteForm, NotebookForm -from utils.views import AjaxableResponseMixin +from utils.views import AjaxableResponseMixin, LoggedInViewWithUser ################## # Base Views @@ -37,15 +37,6 @@ class BaseDetailView(DetailView): pass -@method_decorator(login_required, name='dispatch') -class LoggedInViewWithUser(FormView): - - def get_form_kwargs(self, **kwargs): - kwargs = super().get_form_kwargs(**kwargs) - kwargs.update({'user': self.request.user}) - return kwargs - - ################## # Note Views ################## |