diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index f71aea7..957fdeb --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ static/* ./*/*pycache*/* +**/__pycache__ +*/migrations/* +env/ +static_bk/ diff --git a/accounts/__pycache__/__init__.cpython-39.pyc b/accounts/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index 6efdebe..0000000 Binary files a/accounts/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/accounts/__pycache__/admin.cpython-39.pyc b/accounts/__pycache__/admin.cpython-39.pyc deleted file mode 100755 index b4f6bf6..0000000 Binary files a/accounts/__pycache__/admin.cpython-39.pyc and /dev/null differ diff --git a/accounts/__pycache__/apps.cpython-39.pyc b/accounts/__pycache__/apps.cpython-39.pyc deleted file mode 100755 index 44e3960..0000000 Binary files a/accounts/__pycache__/apps.cpython-39.pyc and /dev/null differ diff --git a/accounts/__pycache__/managers.cpython-39.pyc b/accounts/__pycache__/managers.cpython-39.pyc deleted file mode 100755 index 2b29bf4..0000000 Binary files a/accounts/__pycache__/managers.cpython-39.pyc and /dev/null differ diff --git a/accounts/__pycache__/models.cpython-39.pyc b/accounts/__pycache__/models.cpython-39.pyc deleted file mode 100755 index 8452a44..0000000 Binary files a/accounts/__pycache__/models.cpython-39.pyc and /dev/null differ diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py deleted file mode 100755 index 5656586..0000000 --- a/accounts/migrations/0001_initial.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 3.2.8 on 2021-10-27 11:22 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), - ] - - operations = [ - migrations.CreateModel( - name='CustomUser', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), - ], - options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, - }, - ), - ] diff --git a/accounts/migrations/__init__.py b/accounts/migrations/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/accounts/migrations/__pycache__/0001_initial.cpython-39.pyc b/accounts/migrations/__pycache__/0001_initial.cpython-39.pyc deleted file mode 100755 index b91b2e5..0000000 Binary files a/accounts/migrations/__pycache__/0001_initial.cpython-39.pyc and /dev/null differ diff --git a/accounts/migrations/__pycache__/__init__.cpython-39.pyc b/accounts/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index 706e8c7..0000000 Binary files a/accounts/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/__init__.cpython-39.pyc b/api/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index 26c808b..0000000 Binary files a/api/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/admin.cpython-39.pyc b/api/__pycache__/admin.cpython-39.pyc deleted file mode 100755 index 8b5697e..0000000 Binary files a/api/__pycache__/admin.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/apps.cpython-39.pyc b/api/__pycache__/apps.cpython-39.pyc deleted file mode 100755 index d2dba8f..0000000 Binary files a/api/__pycache__/apps.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/models.cpython-39.pyc b/api/__pycache__/models.cpython-39.pyc deleted file mode 100755 index 4efe7e8..0000000 Binary files a/api/__pycache__/models.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/photolog_generator.cpython-39.pyc b/api/__pycache__/photolog_generator.cpython-39.pyc deleted file mode 100644 index 96cb2a2..0000000 Binary files a/api/__pycache__/photolog_generator.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/photolog_layout.cpython-39.pyc b/api/__pycache__/photolog_layout.cpython-39.pyc deleted file mode 100644 index 28ec4e5..0000000 Binary files a/api/__pycache__/photolog_layout.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/serializers.cpython-39.pyc b/api/__pycache__/serializers.cpython-39.pyc deleted file mode 100644 index 2847046..0000000 Binary files a/api/__pycache__/serializers.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/urls.cpython-39.pyc b/api/__pycache__/urls.cpython-39.pyc deleted file mode 100644 index 9588929..0000000 Binary files a/api/__pycache__/urls.cpython-39.pyc and /dev/null differ diff --git a/api/__pycache__/views.cpython-39.pyc b/api/__pycache__/views.cpython-39.pyc deleted file mode 100644 index 83d08ff..0000000 Binary files a/api/__pycache__/views.cpython-39.pyc and /dev/null differ diff --git a/api/migrations/__init__.py b/api/migrations/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/api/migrations/__pycache__/__init__.cpython-39.pyc b/api/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index dad2777..0000000 Binary files a/api/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/api/photolog_generator.py b/api/photolog_generator.py old mode 100644 new mode 100755 diff --git a/api/photolog_layout.py b/api/photolog_layout.py old mode 100644 new mode 100755 diff --git a/api/serializers.py b/api/serializers.py index da54c81..0c25176 100755 --- a/api/serializers.py +++ b/api/serializers.py @@ -1,5 +1,11 @@ from rest_framework import serializers -from photo_log.models import PhotoGroup, Photo, PhotoLog +from photo_log.models import PhotoGroup, Photo, PhotoLog, PhotoTag + + +class PhotoTagSerializer(serializers.ModelSerializer): + class Meta: + model = PhotoTag + fields = ('id', 'name', 'color') class PhotoGroupSerializer(serializers.ModelSerializer): @@ -15,15 +21,17 @@ class PhotosSerializer(serializers.ModelSerializer): class PhotoSerializer(serializers.ModelSerializer): + tag = PhotoTagSerializer() + class Meta: model = Photo - fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'intersections', 'original_image', 'cropped_image', 'ocr_text') + fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'intersections', 'original_image', 'cropped_image', 'ocr_text', 'tag') class PhotoUpdateSerializer(serializers.ModelSerializer): class Meta: model = Photo - fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'ocr_text') + fields = ('id', 'legacy_id', 'group', 'bbox_coords', 'rotate', 'ocr_text', 'tag') class PhotoLogSerializer(serializers.ModelSerializer): diff --git a/api/urls.py b/api/urls.py index d414da1..ada7b9d 100755 --- a/api/urls.py +++ b/api/urls.py @@ -14,6 +14,9 @@ from .views import ( UpdatePhotoLogAPIView, UpdatePhotoAPIView, GeneratePhotoLogAPIView, + PhotoTagsAPIView, + RetrieveUpdateDestroyPhotoTagAPIView, + CreatePhotoTagAPIView, ) @@ -33,4 +36,7 @@ urlpatterns = [ path('updatephotolog//', UpdatePhotoLogAPIView.as_view()), path('updatephoto//', UpdatePhotoAPIView.as_view()), path('generatephotolog//', GeneratePhotoLogAPIView.as_view()), + path('phototag/', CreatePhotoTagAPIView.as_view()), + path('phototags/', PhotoTagsAPIView.as_view()), + path('phototag//', RetrieveUpdateDestroyPhotoTagAPIView.as_view()), ] diff --git a/api/views.py b/api/views.py index bb572c6..70cc96a 100755 --- a/api/views.py +++ b/api/views.py @@ -1,7 +1,7 @@ from rest_framework import generics, views, status from rest_framework.response import Response from django.shortcuts import get_list_or_404 -from photo_log.models import PhotoGroup, Photo, PhotoLog +from photo_log.models import PhotoGroup, Photo, PhotoLog, PhotoTag from .serializers import ( PhotoGroupSerializer, PhotosSerializer, @@ -9,6 +9,7 @@ from .serializers import ( PhotoUpdateSerializer, PhotoLogSerializer, PhotoLogsSerializer, + PhotoTagSerializer, ) from .photolog_generator import generate_photolog_from_latex @@ -22,6 +23,21 @@ from io import BytesIO from PIL import Image, ExifTags +class PhotoTagsAPIView(generics.ListAPIView): + queryset = PhotoTag.objects.all() + serializer_class = PhotoTagSerializer + + +class CreatePhotoTagAPIView(generics.CreateAPIView): + queryset = PhotoTag.objects.all() + serializer_class = PhotoTagSerializer + + +class RetrieveUpdateDestroyPhotoTagAPIView(generics.RetrieveUpdateDestroyAPIView): + queryset = PhotoTag.objects.all() + serializer_class = PhotoTagSerializer + + class PhotoGroupAPIView(generics.ListAPIView): queryset = PhotoGroup.objects.all() serializer_class = PhotoGroupSerializer @@ -135,7 +151,7 @@ class GeneratePhotoLogAPIView(generics.RetrieveAPIView): if log_bytes: photolog.pdf.save('log.pdf', ContentFile(log_bytes)) - return Response({'pdf': 'https://server.riezel.com%s' % str(photolog.pdf.url)}) + return Response({'pdf': 'https://zierle-training.riezel.com%s' % str(photolog.pdf.url)}) return Response({"error": "Not Found"}, status=status.HTTP_404_NOT_FOUND) @@ -191,6 +207,9 @@ def rotateByExif(img): exif = img._getexif() + if not exif: + return img + if exif[orientation] == 3: img=img.rotate(180, expand=True) elif exif[orientation] == 6: diff --git a/config/__pycache__/__init__.cpython-39.pyc b/config/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index ae7f3af..0000000 Binary files a/config/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/config/__pycache__/settings.cpython-39.pyc b/config/__pycache__/settings.cpython-39.pyc deleted file mode 100644 index e7775ca..0000000 Binary files a/config/__pycache__/settings.cpython-39.pyc and /dev/null differ diff --git a/config/__pycache__/urls.cpython-39.pyc b/config/__pycache__/urls.cpython-39.pyc deleted file mode 100644 index 4b43cac..0000000 Binary files a/config/__pycache__/urls.cpython-39.pyc and /dev/null differ diff --git a/config/__pycache__/wsgi.cpython-39.pyc b/config/__pycache__/wsgi.cpython-39.pyc deleted file mode 100755 index aec702a..0000000 Binary files a/config/__pycache__/wsgi.cpython-39.pyc and /dev/null differ diff --git a/config/package-lock.json b/config/package-lock.json old mode 100644 new mode 100755 diff --git a/config/settings.py b/config/settings.py index 86d6407..d214bc5 100755 --- a/config/settings.py +++ b/config/settings.py @@ -26,7 +26,7 @@ SECRET_KEY = 'django-insecure-z465dl_(vk55hxbm0bj*mp-ok3!*=ssw#!$5s2nrxa!9j+67z+ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['server.riezel.com', 'localhost', '127.0.0.1', '192.168.1.244'] +ALLOWED_HOSTS = ['zierle-training.riezel.com', 'localhost', '127.0.0.1', '192.168.1.244'] # Application definition @@ -45,6 +45,7 @@ INSTALLED_APPS = [ 'corsheaders', 'drf_yasg', 'django_tex', + 'colorfield', # local 'accounts', @@ -110,8 +111,8 @@ ASGI_APPLICATION = 'config.asgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'www_db', - 'USER': 'www_db_user', + 'NAME': 'zierle_training_db', + 'USER': 'zierle_training_db_user', 'PASSWORD': 'UI&hWG,El7G{A2c0n=qIULv:b', 'HOST': 'localhost', 'PORT': '5432', @@ -157,12 +158,37 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, "static/") -#STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/")] # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + + +MINIO = False +if MINIO: + # MinIO S3 Object-Storage + DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' + STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage' + + AWS_ACCESS_KEY_ID = 'zierle-trainig-minio' + AWS_SECRET_ACCESS_KEY = 'iGWJt7IFlKzufMtVTnl4W4kGmHz0TTBG' + AWS_STORAGE_BUCKET_NAME = 'zierle-training' + AWS_S3_ENDPOINT_URL = 'https://minio.riezel.com' + AWS_DEFAULT_ACL = 'public' + + MEDIA_URL = 'https://minio.riezel.com/zierle-training/' + STATIC_URL = 'https://minio.riezel.com/zierle-training/' + + AWS_S3_OBJECT_PARAMETERS = { + 'CacheControl': 'public, max-age=86400', + } +else: + #MEDIA_URL = 'media/' + #MEDIA_ROOT = BASE_DIR / 'media' + + STATIC_URL = '/static/' + STATIC_ROOT = os.path.join(BASE_DIR, "static/") + #STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/")] + diff --git a/photo_log/__pycache__/__init__.cpython-39.pyc b/photo_log/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index a9908c2..0000000 Binary files a/photo_log/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/photo_log/__pycache__/admin.cpython-39.pyc b/photo_log/__pycache__/admin.cpython-39.pyc deleted file mode 100644 index 1449c44..0000000 Binary files a/photo_log/__pycache__/admin.cpython-39.pyc and /dev/null differ diff --git a/photo_log/__pycache__/apps.cpython-39.pyc b/photo_log/__pycache__/apps.cpython-39.pyc deleted file mode 100755 index 6987b22..0000000 Binary files a/photo_log/__pycache__/apps.cpython-39.pyc and /dev/null differ diff --git a/photo_log/__pycache__/models.cpython-39.pyc b/photo_log/__pycache__/models.cpython-39.pyc deleted file mode 100644 index 9357bed..0000000 Binary files a/photo_log/__pycache__/models.cpython-39.pyc and /dev/null differ diff --git a/photo_log/admin.py b/photo_log/admin.py index eb1f16d..d01451e 100755 --- a/photo_log/admin.py +++ b/photo_log/admin.py @@ -1,8 +1,9 @@ from django.contrib import admin -from .models import PhotoGroup, Photo, PhotoLog +from .models import PhotoGroup, Photo, PhotoLog, PhotoTag admin.site.register(PhotoGroup) admin.site.register(Photo) admin.site.register(PhotoLog) +admin.site.register(PhotoTag) diff --git a/photo_log/migrations/0001_initial.py b/photo_log/migrations/0001_initial.py deleted file mode 100755 index 94ab575..0000000 --- a/photo_log/migrations/0001_initial.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-05 17:12 - -import django.contrib.postgres.fields -from django.db import migrations, models -import django.db.models.deletion -import photo_log.models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='PhotoGroup', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=200, unique=True)), - ('date', models.DateField(null=True)), - ], - ), - migrations.CreateModel( - name='Photo', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('legacy_id', models.IntegerField(blank=True, null=True, unique=True)), - ('original_image', models.ImageField(upload_to='original_images/')), - ('cropped_image', models.ImageField(blank=True, null=True, upload_to='cropped_images/')), - ('ocr_text', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), size=None)), - ('group', models.ForeignKey(default=photo_log.models.get_default_photogroup, on_delete=django.db.models.deletion.SET_DEFAULT, to='photo_log.photogroup')), - ], - ), - ] diff --git a/photo_log/migrations/0002_auto_20220105_1757.py b/photo_log/migrations/0002_auto_20220105_1757.py deleted file mode 100755 index c303fb7..0000000 --- a/photo_log/migrations/0002_auto_20220105_1757.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-05 17:57 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='photo', - name='cropped_image', - field=models.ImageField(blank=True, null=True, upload_to='static/cropped_images/'), - ), - migrations.AlterField( - model_name='photo', - name='original_image', - field=models.ImageField(upload_to='static/original_images/'), - ), - ] diff --git a/photo_log/migrations/0003_alter_photo_ocr_text.py b/photo_log/migrations/0003_alter_photo_ocr_text.py deleted file mode 100644 index e9c9ab9..0000000 --- a/photo_log/migrations/0003_alter_photo_ocr_text.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-06 08:52 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0002_auto_20220105_1757'), - ] - - operations = [ - migrations.AlterField( - model_name='photo', - name='ocr_text', - field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=50), blank=True, null=True, size=None), - ), - ] diff --git a/photo_log/migrations/0004_alter_photo_group.py b/photo_log/migrations/0004_alter_photo_group.py deleted file mode 100644 index a47102d..0000000 --- a/photo_log/migrations/0004_alter_photo_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-06 12:48 - -from django.db import migrations, models -import django.db.models.deletion -import photo_log.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0003_alter_photo_ocr_text'), - ] - - operations = [ - migrations.AlterField( - model_name='photo', - name='group', - field=models.ForeignKey(blank=True, default=photo_log.models.get_default_photogroup, on_delete=django.db.models.deletion.SET_DEFAULT, to='photo_log.photogroup'), - ), - ] diff --git a/photo_log/migrations/0005_photolog.py b/photo_log/migrations/0005_photolog.py deleted file mode 100644 index f58b768..0000000 --- a/photo_log/migrations/0005_photolog.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-13 13:32 - -import datetime -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0004_alter_photo_group'), - ] - - operations = [ - migrations.CreateModel( - name='PhotoLog', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=5000)), - ('date', models.DateField(default=datetime.date.today)), - ('render_date', models.BooleanField(blank=True, default=True)), - ('start_slide_image', models.IntegerField(blank=True, default=3, null=True)), - ('slides', django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(null=True), blank=True, null=True, size=3), size=None)), - ], - ), - ] diff --git a/photo_log/migrations/0006_alter_photolog_slides.py b/photo_log/migrations/0006_alter_photolog_slides.py deleted file mode 100644 index a466309..0000000 --- a/photo_log/migrations/0006_alter_photolog_slides.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-13 15:11 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0005_photolog'), - ] - - operations = [ - migrations.AlterField( - model_name='photolog', - name='slides', - field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(null=True), blank=True, null=True, size=3), blank=True, default=[], size=None), - ), - ] diff --git a/photo_log/migrations/0007_alter_photolog_slides.py b/photo_log/migrations/0007_alter_photolog_slides.py deleted file mode 100644 index 1e6fdd8..0000000 --- a/photo_log/migrations/0007_alter_photolog_slides.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-13 15:13 - -import django.contrib.postgres.fields -from django.db import migrations, models -import photo_log.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0006_alter_photolog_slides'), - ] - - operations = [ - migrations.AlterField( - model_name='photolog', - name='slides', - field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(null=True), blank=True, null=True, size=3), blank=True, default=photo_log.models.get_empty_photolog_default, size=None), - ), - ] diff --git a/photo_log/migrations/0008_auto_20220118_1847.py b/photo_log/migrations/0008_auto_20220118_1847.py deleted file mode 100644 index f511fcb..0000000 --- a/photo_log/migrations/0008_auto_20220118_1847.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-18 18:47 - -from django.db import migrations, models -import photo_log.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0007_alter_photolog_slides'), - ] - - operations = [ - migrations.AlterField( - model_name='photo', - name='cropped_image', - field=models.ImageField(blank=True, null=True, upload_to=photo_log.models.get_cropped_photo_path), - ), - migrations.AlterField( - model_name='photo', - name='original_image', - field=models.ImageField(upload_to=photo_log.models.get_original_photo_path), - ), - ] diff --git a/photo_log/migrations/0009_photolog_pdf.py b/photo_log/migrations/0009_photolog_pdf.py deleted file mode 100644 index 7a31628..0000000 --- a/photo_log/migrations/0009_photolog_pdf.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-18 19:56 - -from django.db import migrations, models -import photo_log.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0008_auto_20220118_1847'), - ] - - operations = [ - migrations.AddField( - model_name='photolog', - name='pdf', - field=models.FileField(blank=True, null=True, upload_to=photo_log.models.get_photolog_pdf_path), - ), - ] diff --git a/photo_log/migrations/0010_photo_bbox_coords.py b/photo_log/migrations/0010_photo_bbox_coords.py deleted file mode 100644 index 4555d1e..0000000 --- a/photo_log/migrations/0010_photo_bbox_coords.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-21 11:47 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0009_photolog_pdf'), - ] - - operations = [ - migrations.AddField( - model_name='photo', - name='bbox_coords', - field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(default=None, null=True), size=2), blank=True, default=None, null=True, size=4), - ), - ] diff --git a/photo_log/migrations/0011_alter_photo_ocr_text.py b/photo_log/migrations/0011_alter_photo_ocr_text.py deleted file mode 100644 index 859ed3f..0000000 --- a/photo_log/migrations/0011_alter_photo_ocr_text.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.8 on 2022-01-22 11:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0010_photo_bbox_coords'), - ] - - operations = [ - migrations.AlterField( - model_name='photo', - name='ocr_text', - field=models.CharField(blank=True, max_length=200, null=True), - ), - ] diff --git a/photo_log/migrations/0012_photo_rotate.py b/photo_log/migrations/0012_photo_rotate.py deleted file mode 100644 index f91cc91..0000000 --- a/photo_log/migrations/0012_photo_rotate.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.8 on 2022-05-03 14:59 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0011_alter_photo_ocr_text'), - ] - - operations = [ - migrations.AddField( - model_name='photo', - name='rotate', - field=models.FloatField(blank=True, null=True), - ), - ] diff --git a/photo_log/migrations/0013_photo_intersections.py b/photo_log/migrations/0013_photo_intersections.py deleted file mode 100644 index 1fa74ec..0000000 --- a/photo_log/migrations/0013_photo_intersections.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.8 on 2022-05-04 07:28 - -import django.contrib.postgres.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('photo_log', '0012_photo_rotate'), - ] - - operations = [ - migrations.AddField( - model_name='photo', - name='intersections', - field=django.contrib.postgres.fields.ArrayField(base_field=django.contrib.postgres.fields.ArrayField(base_field=models.IntegerField(default=None, null=True), size=2), blank=True, default=None, null=True, size=None), - ), - ] diff --git a/photo_log/migrations/__init__.py b/photo_log/migrations/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/photo_log/migrations/__pycache__/0001_initial.cpython-39.pyc b/photo_log/migrations/__pycache__/0001_initial.cpython-39.pyc deleted file mode 100755 index 512b5ee..0000000 Binary files a/photo_log/migrations/__pycache__/0001_initial.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0002_auto_20220105_1757.cpython-39.pyc b/photo_log/migrations/__pycache__/0002_auto_20220105_1757.cpython-39.pyc deleted file mode 100755 index beff041..0000000 Binary files a/photo_log/migrations/__pycache__/0002_auto_20220105_1757.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0003_alter_photo_ocr_text.cpython-39.pyc b/photo_log/migrations/__pycache__/0003_alter_photo_ocr_text.cpython-39.pyc deleted file mode 100644 index d0cb0c4..0000000 Binary files a/photo_log/migrations/__pycache__/0003_alter_photo_ocr_text.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0004_alter_photo_group.cpython-39.pyc b/photo_log/migrations/__pycache__/0004_alter_photo_group.cpython-39.pyc deleted file mode 100644 index fb65cae..0000000 Binary files a/photo_log/migrations/__pycache__/0004_alter_photo_group.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0005_photolog.cpython-39.pyc b/photo_log/migrations/__pycache__/0005_photolog.cpython-39.pyc deleted file mode 100644 index 0f83c57..0000000 Binary files a/photo_log/migrations/__pycache__/0005_photolog.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0006_alter_photolog_slides.cpython-39.pyc b/photo_log/migrations/__pycache__/0006_alter_photolog_slides.cpython-39.pyc deleted file mode 100644 index 08275fd..0000000 Binary files a/photo_log/migrations/__pycache__/0006_alter_photolog_slides.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0007_alter_photolog_slides.cpython-39.pyc b/photo_log/migrations/__pycache__/0007_alter_photolog_slides.cpython-39.pyc deleted file mode 100644 index ec0076b..0000000 Binary files a/photo_log/migrations/__pycache__/0007_alter_photolog_slides.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0008_auto_20220118_1847.cpython-39.pyc b/photo_log/migrations/__pycache__/0008_auto_20220118_1847.cpython-39.pyc deleted file mode 100644 index dace80e..0000000 Binary files a/photo_log/migrations/__pycache__/0008_auto_20220118_1847.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0009_photolog_pdf.cpython-39.pyc b/photo_log/migrations/__pycache__/0009_photolog_pdf.cpython-39.pyc deleted file mode 100644 index be02909..0000000 Binary files a/photo_log/migrations/__pycache__/0009_photolog_pdf.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0010_photo_bbox_coords.cpython-39.pyc b/photo_log/migrations/__pycache__/0010_photo_bbox_coords.cpython-39.pyc deleted file mode 100644 index 27ff04d..0000000 Binary files a/photo_log/migrations/__pycache__/0010_photo_bbox_coords.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0011_alter_photo_ocr_text.cpython-39.pyc b/photo_log/migrations/__pycache__/0011_alter_photo_ocr_text.cpython-39.pyc deleted file mode 100644 index 902c519..0000000 Binary files a/photo_log/migrations/__pycache__/0011_alter_photo_ocr_text.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0012_photo_rotate.cpython-39.pyc b/photo_log/migrations/__pycache__/0012_photo_rotate.cpython-39.pyc deleted file mode 100644 index 285a97c..0000000 Binary files a/photo_log/migrations/__pycache__/0012_photo_rotate.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/0013_photo_intersections.cpython-39.pyc b/photo_log/migrations/__pycache__/0013_photo_intersections.cpython-39.pyc deleted file mode 100644 index c9742d3..0000000 Binary files a/photo_log/migrations/__pycache__/0013_photo_intersections.cpython-39.pyc and /dev/null differ diff --git a/photo_log/migrations/__pycache__/__init__.cpython-39.pyc b/photo_log/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100755 index ae863b5..0000000 Binary files a/photo_log/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/photo_log/models.py b/photo_log/models.py index 26319a2..bb06e04 100755 --- a/photo_log/models.py +++ b/photo_log/models.py @@ -2,12 +2,22 @@ from django.contrib.postgres.fields import ArrayField from django.db import models from django.dispatch import receiver +from colorfield.fields import ColorField + from datetime import date import os import uuid +class PhotoTag(models.Model): + name = models.CharField(unique=True, null=False, blank=False, max_length=100) + color = ColorField(default='#FFE5B4') + + def __str__(self): + return self.name + + class PhotoGroup(models.Model): name = models.CharField(unique=True, null=False, max_length=200) date = models.DateField(null=True) @@ -63,6 +73,13 @@ class Photo(models.Model): default=get_default_photogroup ) ocr_text = models.CharField(max_length=200, null=True, blank=True) + tag = models.ForeignKey( + PhotoTag, + null=True, + blank=False, + on_delete=models.SET_NULL, + default=None, + ) def __str__(self): return "Photo #" + str(self.id) diff --git a/req.txt b/req.txt deleted file mode 100644 index 15c513e..0000000 --- a/req.txt +++ /dev/null @@ -1,13 +0,0 @@ -imageio==2.13.5 -imutils==0.5.4 -networkx==2.6.3 -numpy==1.22.0 -opencv-python==4.5.5.62 -packaging==21.3 -Pillow==9.0.0 -pyparsing==3.0.6 -pytesseract==0.3.8 -PyWavelets==1.2.0 -scikit-image==0.19.1 -scipy==1.7.3 -tifffile==2021.11.2 diff --git a/requirements.txt b/requirements.txt index d0a0935..c0c9bb4 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,64 @@ asgiref==3.4.1 +attrs==21.4.0 +autobahn==22.4.2 +Automat==20.2.0 beautifulsoup4==4.10.0 certifi==2021.10.8 +cffi==1.15.0 +channels==3.0.4 charset-normalizer==2.0.7 +constantly==15.1.0 +coreapi==2.3.3 +coreschema==0.0.4 +cryptography==37.0.2 +daphne==3.0.2 Django==3.2.8 +django-cors-headers==3.12.0 +django-filter==21.1 +django-tex==1.1.10 djangorestframework==3.13.1 +drf-yasg==1.20.0 gunicorn==20.1.0 +hyperlink==21.0.0 idna==3.3 +imageio==2.13.5 +imutils==0.5.4 +incremental==21.3.0 +inflection==0.5.1 +itypes==1.2.0 +Jinja2==3.1.2 lxml==4.6.3 +Markdown==3.3.7 +MarkupSafe==2.1.1 +networkx==2.6.3 +numpy==1.22.0 +opencv-python==4.5.5.62 +packaging==21.3 Pillow==9.0.0 psycopg2==2.9.1 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pycparser==2.21 +pyOpenSSL==22.0.0 +pyparsing==3.0.6 +pytesseract==0.3.8 python-dateutil==2.8.2 pytz==2021.3 +PyWavelets==1.2.0 requests==2.26.0 +ruamel.yaml==0.17.21 +ruamel.yaml.clib==0.2.6 +scikit-image==0.19.1 +scipy==1.7.3 +service-identity==21.1.0 six==1.16.0 soupsieve==2.2.1 sqlparse==0.4.2 +tifffile==2021.11.2 tqdm==4.62.3 +Twisted==22.4.0 +txaio==22.2.1 +typing_extensions==4.2.0 +uritemplate==4.1.1 urllib3==1.26.7 +zope.interface==5.4.0 diff --git a/templates/photolog.tex b/templates/photolog.tex old mode 100644 new mode 100755