diff --git a/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc index 8260bbd..13f81a5 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 2c09c47..cb03f2f 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/templates/homepage/Mojeogloszenia.html b/SocialHelper/homepage/templates/homepage/Mojeogloszenia.html index 8010198..0951898 100644 --- a/SocialHelper/homepage/templates/homepage/Mojeogloszenia.html +++ b/SocialHelper/homepage/templates/homepage/Mojeogloszenia.html @@ -44,11 +44,11 @@ {% if types_o.0.0 == product.offer %} Usługa - + {% else %} Przedmiot - - + + {% endif %}
Z miejscowości: {{ product.place }}

{{ product.description }}

diff --git a/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html b/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html index e69de29..bc7c594 100644 --- a/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html +++ b/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html @@ -0,0 +1,178 @@ +{% extends 'base.html' %} +{% load static %} +{% block content %} + + + + + +
+
+
+

Dodaj nowe ogłoszenie

+
+
+
+ + + +
+ {% csrf_token %} + {{ form.media }} + {{ form.as_p }} +
+
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ +
+
+ +
+
+ Wybierz zdjęcie + +
+
+
+ +
+ +
+
+
+ + + + + + + + + + {% endblock %} diff --git a/SocialHelper/homepage/urls.py b/SocialHelper/homepage/urls.py index 9d9b7ef..792e211 100644 --- a/SocialHelper/homepage/urls.py +++ b/SocialHelper/homepage/urls.py @@ -10,5 +10,6 @@ urlpatterns = [ path('Dodawanie', views.Dodawanie, name='Dodawanie'), path('Mojeogloszenia', views.Mojeogloszenia, name='Mojeogloszenia'), path('/delete_offer', views.delete_offer, name='delete_offer'), + path('/edit_offer', views.edit_offer, name='edit_offer'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/SocialHelper/homepage/views.py b/SocialHelper/homepage/views.py index c7c229d..6b83f69 100644 --- a/SocialHelper/homepage/views.py +++ b/SocialHelper/homepage/views.py @@ -33,7 +33,7 @@ def index(request): return HttpResponse(template.render(context, request)) def Mojeogloszenia(request): - all_product = Product.objects.filter(user_owner = "jedrzejklepacki@wp.pl", active = True) + all_product = Product.objects.filter(user_owner = "jedrzejklepacki@wp.pl", active = True).order_by('create_date') template = loader.get_template('homepage/Mojeogloszenia.html') types = TYPE_T types_o = TYPE_O @@ -128,11 +128,40 @@ def Dodawanie(request): return redirect(Mojeogloszenia) return render(request , 'homepage/Dodawanie.html') - - def delete_offer(request, offer_id): instance = Product.objects.get(id=offer_id) instance.active = False instance.save() return redirect(Mojeogloszenia) + +def edit_offer(request, offer_id): + instance = Product.objects.get(id=offer_id) + types = TYPE_T + types_o = TYPE_O + context = { + 'offer': instance, + 'types': types, + 'types_o': types_o, + } + if request.method == 'POST': + place_local = request.POST['place'] + type_local = request.POST['type'] + script_local = request.POST['script'] + title_local = request.POST['title'] + if request.FILES: + pic_local = request.FILES['file'] + instance.picture = pic_local + + offer_local = request.POST['offer'] + + instance.type = int(type_local) + instance.offer = int(offer_local) + instance.title = title_local + instance.description = script_local + instance.place= place_local + instance.keywords = "" + + instance.save() + return redirect(Mojeogloszenia) + return render(request , 'homepage/edycja_ogloszenia.html', context) diff --git a/SocialHelper/media/images/1.jpg b/SocialHelper/media/images/1.jpg deleted file mode 100644 index b7f84ac..0000000 Binary files a/SocialHelper/media/images/1.jpg and /dev/null differ diff --git a/SocialHelper/media/images/1_Rd4PCgl.jpg b/SocialHelper/media/images/1_Rd4PCgl.jpg deleted file mode 100644 index b7f84ac..0000000 Binary files a/SocialHelper/media/images/1_Rd4PCgl.jpg and /dev/null differ diff --git a/SocialHelper/media/images/1_gQYMsX2.jpg b/SocialHelper/media/images/1_gQYMsX2.jpg deleted file mode 100644 index b7f84ac..0000000 Binary files a/SocialHelper/media/images/1_gQYMsX2.jpg and /dev/null differ diff --git a/SocialHelper/media/images/dubatti_gondola_v2_R.png b/SocialHelper/media/images/dubatti_gondola_v2_R.png deleted file mode 100644 index 782f88b..0000000 Binary files a/SocialHelper/media/images/dubatti_gondola_v2_R.png and /dev/null differ