diff --git a/.gitignore b/.gitignore index 30ecf62..7028740 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -django_web_galleries/media/* \ No newline at end of file +django_web_galleries/media/* +django_web_galleries/static/* \ No newline at end of file diff --git a/django_web_galleries/django_web_galleries/urls.py b/django_web_galleries/django_web_galleries/urls.py index 3717e70..1d50df5 100644 --- a/django_web_galleries/django_web_galleries/urls.py +++ b/django_web_galleries/django_web_galleries/urls.py @@ -16,7 +16,20 @@ Including another URLconf from django.contrib import admin from django.urls import path, include +from django.conf import settings +from django.conf.urls.static import static + urlpatterns = [ path('admin/', admin.site.urls), path('', include('web_galleries.urls')) ] + +if settings.DEBUG: + urlpatterns += static( + settings.MEDIA_URL, + document_root=settings.MEDIA_ROOT + ) + urlpatterns += static( + settings.STATIC_URL, + document_root=settings.STATIC_ROOT + ) \ No newline at end of file diff --git a/django_web_galleries/web_galleries/forms.py b/django_web_galleries/web_galleries/forms.py index 96e6cee..dee0cfe 100644 --- a/django_web_galleries/web_galleries/forms.py +++ b/django_web_galleries/web_galleries/forms.py @@ -6,4 +6,7 @@ from .models import Image class ImageUploadForm(forms.ModelForm): class Meta: model = Image - fields = ['description', 'image_file', 'private'] + fields = ['description', 'image_file', 'private', 'title'] + labels = { + 'private': 'Make this image private' + } diff --git a/django_web_galleries/web_galleries/urls.py b/django_web_galleries/web_galleries/urls.py index 0ebc763..c252d23 100644 --- a/django_web_galleries/web_galleries/urls.py +++ b/django_web_galleries/web_galleries/urls.py @@ -1,6 +1,4 @@ from django.urls import path -from django.conf import settings -from django.conf.urls.static import static from .views import ( ImageUploadView, @@ -11,9 +9,3 @@ urlpatterns = [ path('', PublicImageListView.as_view(), name='home'), path('upload/', ImageUploadView.as_view(), name='upload_image') ] - -if settings.DEBUG: - urlpatterns += static( - settings.MEDIA_URL, - document_root=settings.MEDIA_ROOT - ) \ No newline at end of file