diff --git a/ajapaik/ajapaik/forms.py b/ajapaik/ajapaik/forms.py index f56360108..17907f236 100644 --- a/ajapaik/ajapaik/forms.py +++ b/ajapaik/ajapaik/forms.py @@ -665,4 +665,4 @@ class ApiWikidocsAlbumSearchForm(forms.Form): class CsvImportForm(forms.Form): zip_file = forms.FileField(required=False) - csv_file = forms.FileField() \ No newline at end of file + csv_file = forms.FileField() diff --git a/ajapaik/ajapaik/static/css/ajp-geotagger-plugin.css b/ajapaik/ajapaik/static/css/ajp-geotagger-plugin.css index 75a601e6a..883d9c27c 100644 --- a/ajapaik/ajapaik/static/css/ajp-geotagger-plugin.css +++ b/ajapaik/ajapaik/static/css/ajp-geotagger-plugin.css @@ -381,7 +381,6 @@ border-radius: 0; } - #ajp-geotagging-container div.gm-style-mtc > div:nth-of-type(2) { bottom: auto; } \ No newline at end of file diff --git a/ajapaik/ajapaik/views.py b/ajapaik/ajapaik/views.py index d4df2b1b8..f1903711c 100644 --- a/ajapaik/ajapaik/views.py +++ b/ajapaik/ajapaik/views.py @@ -92,7 +92,7 @@ from ajapaik.utils import get_etag, calculate_thumbnail_size, convert_to_degrees, calculate_thumbnail_size_max_height, \ distance_in_meters, angle_diff, last_modified, suggest_photo_edit from .fotis_utils import parse_fotis_timestamp_data -from .utils import get_comment_replies, get_pagination_parameters, ImportBlacklistService +from .utils import get_comment_replies, get_pagination_parameters log = logging.getLogger(__name__) @@ -1531,10 +1531,10 @@ def photoslug(request, photo_id=None, pseudo_slug=None): next_similar_photo = next_photo compare_photos_url = request.build_absolute_uri( reverse('compare-photos', args=(photo_obj.id, next_similar_photo.id))) - image_similarities = ImageSimilarity.objects.filter(from_photo_id=photo_obj.id).exclude(similarity_type=0) - if image_similarities.exists(): + imageSimilarities = ImageSimilarity.objects.filter(from_photo_id=photo_obj.id).exclude(similarity_type=0) + if imageSimilarities.exists(): compare_photos_url = request.build_absolute_uri( - reverse('compare-photos', args=(photo_obj.id, image_similarities.first().to_photo_id))) + reverse('compare-photos', args=(photo_obj.id, imageSimilarities.first().to_photo_id))) people = [x.name for x in photo_obj.people] similar_photos = ImageSimilarity.objects.filter(from_photo=photo_obj.id).exclude(similarity_type=0) @@ -2336,22 +2336,11 @@ def curator_photo_upload_handler(request): # 15 => unknown copyright unknown_licence = Licence.objects.get(pk=15) flickr_licence = Licence.objects.filter(url='https://www.flickr.com/commons/usage/').first() - import_blacklist_service = ImportBlacklistService() - for k, v in selection.items(): upload_form = CuratorPhotoUploadForm(v) created_album_photo_links = [] awarded_curator_points = [] if upload_form.is_valid(): - source_key = upload_form.cleaned_data['identifyingNumber'] - - if source_key and import_blacklist_service.is_blacklisted(source_key): - context['photos'][k] = { - 'error': _( - f'Could not import picture, as it is blacklisted from being imported: {upload_form.cleaned_data["imageUrl"]}')} - context['photos'][k]['success'] = False - continue - if not upload_form.cleaned_data['institution']: licence = unknown_licence source = Source.objects.get(name='AJP') @@ -2389,7 +2378,7 @@ def curator_photo_upload_handler(request): existing_photo = None if upload_form.cleaned_data['id'] and upload_form.cleaned_data['id'] != '': if upload_form.cleaned_data['collections'] == 'DIGAR': - incoming_muis_id = source_key + incoming_muis_id = upload_form.cleaned_data['identifyingNumber'] else: incoming_muis_id = upload_form.cleaned_data['id'] if 'ETERA' in upload_form.cleaned_data['institution']: @@ -2403,7 +2392,7 @@ def curator_photo_upload_handler(request): muis_id = incoming_muis_id muis_media_id = None if upload_form.cleaned_data['collections'] == 'DIGAR': - source_key = \ + upload_form.cleaned_data['identifyingNumber'] = \ f'nlib-digar:{upload_form.cleaned_data["identifyingNumber"]}' muis_media_id = 1 try: @@ -2616,8 +2605,9 @@ def curator_photo_upload_handler(request): ap.delete() for cp in awarded_curator_points: cp.delete() - context['photos'][k] = {'error': _('Error uploading file: %s (%s)' % - (e, upload_form.cleaned_data['imageUrl']))} + context['photos'][k] = {} + context['photos'][k]['error'] = _('Error uploading file: %s (%s)' % + (e, upload_form.cleaned_data['imageUrl'])) else: if general_albums.exists(): for a in general_albums: @@ -2755,7 +2745,6 @@ def csv_import(request): not_found_list = [] profile = request.get_user().profile skipped_list = [] - blacklisted_list = [] success = None unique_album_list = [] upload_folder = f'{settings.MEDIA_ROOT}/uploads/' @@ -2845,11 +2834,6 @@ def del_evenReadonly(action, name, exc): source = Source.objects.filter(id=row['source']).first() if 'source_key' in row.keys(): source_key = row['source_key'] - - if source_key and import_blacklist_service.is_blacklisted(source_key): - blacklisted_list.append(row['file']) - continue - if 'source_url' in row.keys(): source_url = row['source_url'] if 'date_text' in row.keys(): @@ -2886,7 +2870,7 @@ def del_evenReadonly(action, name, exc): lon=lon, geography=geography, source=source, - source_key=source_key, + source_key=upload_form.cleaned_data['identifyingNumber'], source_url=source_url, date_text=date_text, licence=licence, @@ -3002,9 +2986,6 @@ def del_evenReadonly(action, name, exc): if len(skipped_list) > 0: already_exists_error = "Some imports were skipped since they already exist on Ajapaik:" errors.append({'message': already_exists_error, 'list': list(set(skipped_list))}) - if len(blacklisted_list) > 0: - blacklisted_error = "Some images are blacklisted from Ajapaik, they were not added" - errors.append({'message': blacklisted_error, 'list': list(set(blacklisted_list))}) if len(errors) < 1: success = 'OK' @@ -3911,4 +3892,4 @@ class MyConnectionsView(LoginRequiredMixin, ConnectionsView): class MyEmailView(LoginRequiredMixin, EmailView): - success_url = reverse_lazy('user_settings') \ No newline at end of file + success_url = reverse_lazy('user_settings') diff --git a/ajapaik/ajapaik_object_categorization/api.py b/ajapaik/ajapaik_object_categorization/api.py deleted file mode 100644 index 0592d0b82..000000000 --- a/ajapaik/ajapaik_object_categorization/api.py +++ /dev/null @@ -1,62 +0,0 @@ -from django.http import JsonResponse - -from ajapaik.ajapaik.api import AjapaikAPIView, PLEASE_LOGIN - -from django.shortcuts import get_object_or_404 - -from ajapaik.ajapaik.models import Photo -from ajapaik.ajapaik_face_recognition.models import FaceRecognitionRectangle - - -class Category(AjapaikAPIView): - ''' - API Endpoint to get annotation data - ''' - - @staticmethod - def get(request, photo_id): - # try: - # if request.user.is_anonymous: - # return JsonResponse({'error': PLEASE_LOGIN}, status=401) - # - # photo = get_object_or_404(Photo, id=photo_id) - # scene = 'undefined' - # scene_consensus = 'undefined' - # viewpoint_elevation = 'undefined' - # viewpoint_elevation_consensus = 'undefined' - # viewpoint_elevation_suggestion = PhotoViewpointElevationSuggestion.objects \ - # .filter(photo=photo, proposer=request.user.profile).order_by('-created').first() - # if viewpoint_elevation_suggestion: - # if viewpoint_elevation_suggestion.viewpoint_elevation == 0: - # viewpoint_elevation = 'Ground' - # if viewpoint_elevation_suggestion.viewpoint_elevation == 1: - # viewpoint_elevation = 'Raised' - # if viewpoint_elevation_suggestion.viewpoint_elevation == 2: - # viewpoint_elevation = 'Aerial' - # - # scene_suggestion = PhotoSceneSuggestion.objects.filter(photo=photo, proposer=request.user.profile).order_by( - # '-created').first() - # - # if scene_suggestion: - # if scene_suggestion.scene == 0: - # scene = 'Interior' - # if scene_suggestion.scene == 1: - # scene = 'Exterior' - # - # if photo.scene == 0: - # scene_consensus = 'Interior' - # if photo.scene == 1: - # scene_consensus = 'Exterior' - # - # if photo.viewpoint_elevation == 0: - # viewpoint_elevation_consensus = 'Ground' - # if photo.viewpoint_elevation == 1: - # viewpoint_elevation_consensus = 'Raised' - # if photo.viewpoint_elevation == 2: - # viewpoint_elevation_consensus = 'Aerial' - - return JsonResponse( - {'scene': 1, 'scene_consensus': 1, 'viewpoint_elevation': 1, - 'viewpoint_elevation_consensus': 1}) - # except: # noqa - # return JsonResponse({'error': _('Something went wrong')}, status=500) diff --git a/ajapaik/settings/.DS_Store b/ajapaik/settings/.DS_Store deleted file mode 100644 index 5008ddfcf..000000000 Binary files a/ajapaik/settings/.DS_Store and /dev/null differ