diff --git a/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc b/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc
index dcd951f..8cc1645 100644
Binary files a/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc and b/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc differ
diff --git a/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc b/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc
index 7d29b82..b19e165 100644
Binary files a/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc and b/SocialHelper/SocialHelper/__pycache__/urls.cpython-37.pyc differ
diff --git a/SocialHelper/SocialHelper/settings.py b/SocialHelper/SocialHelper/settings.py
index fafb346..70f48eb 100644
--- a/SocialHelper/SocialHelper/settings.py
+++ b/SocialHelper/SocialHelper/settings.py
@@ -84,8 +84,6 @@ DATABASES = {
}
}
-
-
# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
@@ -122,12 +120,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
+MEDIA_URL = '/media/'
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+
STATIC_ROOT = os.path.join(BASE_DIR,'static')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR,'SocialHelper/static')
]
-
-# Media Folder Settings
-MEDIA_ROOT = os.path.join(BASE_DIR, 'media' )
-MEDIA_URL = '/media/'
diff --git a/SocialHelper/SocialHelper/urls.py b/SocialHelper/SocialHelper/urls.py
index 5f16db5..37e56e3 100644
--- a/SocialHelper/SocialHelper/urls.py
+++ b/SocialHelper/SocialHelper/urls.py
@@ -1,22 +1,10 @@
-"""SocialHelper URL Configuration
-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/2.1/topics/http/urls/
-Examples:
-Function views
- 1. Add an import: from my_app import views
- 2. Add a URL to urlpatterns: path('', views.home, name='home')
-Class-based views
- 1. Add an import: from other_app.views import Home
- 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
-Including another URLconf
- 1. Import the include() function: from django.urls import include, path
- 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
-"""
from django.contrib import admin
from django.urls import include, path
+from django.conf import settings
+from django.conf.urls.static import static
+
urlpatterns = [
path('homepage/', include('homepage.urls')),
path('admin/', admin.site.urls),
-]
+] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
diff --git a/SocialHelper/homepage/__pycache__/forms.cpython-37.pyc b/SocialHelper/homepage/__pycache__/forms.cpython-37.pyc
new file mode 100644
index 0000000..daf3ba0
Binary files /dev/null and b/SocialHelper/homepage/__pycache__/forms.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc
index c6a53e5..43a919c 100644
Binary files a/SocialHelper/homepage/__pycache__/models.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/models.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc
index aac9133..a6d2c82 100644
Binary files a/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc
index 2558a53..a1bf143 100644
Binary files a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc and b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/forms.py b/SocialHelper/homepage/forms.py
new file mode 100644
index 0000000..ef89986
--- /dev/null
+++ b/SocialHelper/homepage/forms.py
@@ -0,0 +1,7 @@
+from django import forms
+
+class DocumentForm(forms.Form):
+ docfile = forms.FileField(
+ label='Select a file',
+ help_text='max. 42 megabytes'
+ )
diff --git a/SocialHelper/homepage/migrations/0002_product_picture.py b/SocialHelper/homepage/migrations/0002_product_picture.py
new file mode 100644
index 0000000..5ce4fb0
--- /dev/null
+++ b/SocialHelper/homepage/migrations/0002_product_picture.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.5 on 2020-12-10 18:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('homepage', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='product',
+ name='picture',
+ field=models.FileField(blank=True, null=True, upload_to='documents/%Y/%m/%d'),
+ ),
+ ]
diff --git a/SocialHelper/homepage/migrations/0003_auto_20201210_2008.py b/SocialHelper/homepage/migrations/0003_auto_20201210_2008.py
new file mode 100644
index 0000000..3ffff9f
--- /dev/null
+++ b/SocialHelper/homepage/migrations/0003_auto_20201210_2008.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.5 on 2020-12-10 19:08
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('homepage', '0002_product_picture'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='product',
+ name='picture',
+ field=models.ImageField(blank=True, null=True, upload_to='images/'),
+ ),
+ ]
diff --git a/SocialHelper/homepage/migrations/__pycache__/0002_product_picture.cpython-37.pyc b/SocialHelper/homepage/migrations/__pycache__/0002_product_picture.cpython-37.pyc
new file mode 100644
index 0000000..c9ac885
Binary files /dev/null and b/SocialHelper/homepage/migrations/__pycache__/0002_product_picture.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/migrations/__pycache__/0003_auto_20201210_2008.cpython-37.pyc b/SocialHelper/homepage/migrations/__pycache__/0003_auto_20201210_2008.cpython-37.pyc
new file mode 100644
index 0000000..fb7dcb8
Binary files /dev/null and b/SocialHelper/homepage/migrations/__pycache__/0003_auto_20201210_2008.cpython-37.pyc differ
diff --git a/SocialHelper/homepage/models.py b/SocialHelper/homepage/models.py
index 5fc349e..f3a9e9c 100644
--- a/SocialHelper/homepage/models.py
+++ b/SocialHelper/homepage/models.py
@@ -7,6 +7,7 @@ TYPE_T = (
)
class Product(models.Model):
+ picture = models.ImageField(null=True, blank=True, upload_to="images/")
create_date = models.DateField(("Date"), default=datetime.date.today)
user_owner = models.TextField(max_length=40, blank=False, default="")
type = models.IntegerField(choices = TYPE_T, blank=False, default="")
diff --git a/SocialHelper/homepage/templates/homepage/Dodawanie.html b/SocialHelper/homepage/templates/homepage/Dodawanie.html
index 5eafb6e..ef6180a 100644
--- a/SocialHelper/homepage/templates/homepage/Dodawanie.html
+++ b/SocialHelper/homepage/templates/homepage/Dodawanie.html
@@ -16,38 +16,51 @@
-