Compare commits
2 Commits
751d4c81fe
...
ca2eac533f
Author | SHA1 | Date | |
---|---|---|---|
ca2eac533f | |||
2007b512c7 |
@ -1,11 +1,12 @@
|
|||||||
import json
|
import json, os
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template import Library, TemplateSyntaxError
|
from django.template import Library, TemplateSyntaxError
|
||||||
|
|
||||||
icons_json_path = getattr(settings, 'SVG_ICONS_SOURCE_FILE')
|
#icons_json_path = getattr(settings, 'SVG_ICONS_SOURCE_FILE')
|
||||||
|
icons_json_path = os.path.join(settings.BASE_DIR, 'lostplaces_app', 'static', 'icons', 'icons.icomoon.json')
|
||||||
icons_json = json.load(open(icons_json_path))
|
icons_json = json.load(open(icons_json_path))
|
||||||
|
|
||||||
register = Library()
|
register = Library()
|
||||||
|
@ -179,19 +179,6 @@ class PlaceDeleteView(IsAuthenticated, IsPlaceSubmitter, DeleteView):
|
|||||||
def get_place(self):
|
def get_place(self):
|
||||||
return self.get_object()
|
return self.get_object()
|
||||||
|
|
||||||
class AlbumCreateView(IsAuthenticated, View):
|
|
||||||
def get(self, request, *args, **kwargs):
|
|
||||||
url = request.GET['url']
|
|
||||||
place_id = request.GET['place_id']
|
|
||||||
place = Place.objects.get(pk=place_id)
|
|
||||||
photo_album = PhotoAlbum()
|
|
||||||
photo_album.url = url
|
|
||||||
photo_album.place = place
|
|
||||||
photo_album.submitted_by = request.user
|
|
||||||
photo_album.save()
|
|
||||||
print(photo_album)
|
|
||||||
return redirect(reverse_lazy('place_detail', kwargs={'pk': place_id}))
|
|
||||||
|
|
||||||
class PhotoAlbumCreateView(IsAuthenticated, SuccessMessageMixin, CreateView):
|
class PhotoAlbumCreateView(IsAuthenticated, SuccessMessageMixin, CreateView):
|
||||||
model = PhotoAlbum
|
model = PhotoAlbum
|
||||||
fields = ['url', 'label']
|
fields = ['url', 'label']
|
||||||
|
Loading…
Reference in New Issue
Block a user