usuwanie ogloszenia
This commit is contained in:
parent
d63c08271b
commit
ef2b52d9ae
Binary file not shown.
Binary file not shown.
@ -43,7 +43,7 @@
|
||||
{% endif %}
|
||||
{% if types_o.0.0 == product.offer %}
|
||||
Usługa</h5>
|
||||
<a href="/homepage/"><button type="button" class="btn btn-danger pull-right">Zakończ</button></a>
|
||||
<a href="{{ product.id }}/delete_offer"><button type="button" class="btn btn-danger pull-right">Zakończ</button></a>
|
||||
<a href="/homepage/"><button type="button" class="btn btn-primary pull-right">Edytuj</button></a>
|
||||
{% else %}
|
||||
Przedmiot</h5>
|
||||
|
@ -9,5 +9,6 @@ urlpatterns = [
|
||||
path('filter', views.filter, name='filter'),
|
||||
path('Dodawanie', views.Dodawanie, name='Dodawanie'),
|
||||
path('Mojeogloszenia', views.Mojeogloszenia, name='Mojeogloszenia'),
|
||||
path('<int:offer_id>/delete_offer', views.delete_offer, name='delete_offer'),
|
||||
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
@ -1,4 +1,4 @@
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.shortcuts import get_object_or_404, render, redirect
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.urls import reverse
|
||||
from django.template import loader
|
||||
@ -32,6 +32,28 @@ def index(request):
|
||||
}
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
def Mojeogloszenia(request):
|
||||
all_product = Product.objects.filter(user_owner = "jedrzejklepacki@wp.pl", active = True)
|
||||
template = loader.get_template('homepage/Mojeogloszenia.html')
|
||||
types = TYPE_T
|
||||
types_o = TYPE_O
|
||||
place_local = ""
|
||||
oddam_local = ""
|
||||
potrzebuje_local = ""
|
||||
usluga_local = ""
|
||||
przedmiot_local = ""
|
||||
context = {
|
||||
'all_product': all_product,
|
||||
'types': types,
|
||||
'place_local': place_local,
|
||||
'oddam_local': oddam_local,
|
||||
'potrzebuje_local': potrzebuje_local,
|
||||
'types_o': types_o,
|
||||
'usluga_local': usluga_local,
|
||||
'przedmiot_local': przedmiot_local,
|
||||
}
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
def filter(request):
|
||||
|
||||
all_product = Product.objects.filter(active = True)
|
||||
@ -103,40 +125,14 @@ def Dodawanie(request):
|
||||
keywords = "",
|
||||
)
|
||||
product.save()
|
||||
all_product = Product.objects.filter(user_owner = "jedrzejklepacki@wp.pl")
|
||||
template = loader.get_template('homepage/Mojeogloszenia.html')
|
||||
types = TYPE_T
|
||||
place_local = ""
|
||||
oddam_local = ""
|
||||
potrzebuje_local = ""
|
||||
context = {
|
||||
'all_product': all_product,
|
||||
'types': types,
|
||||
'place_local': place_local,
|
||||
'oddam_local': oddam_local,
|
||||
'potrzebuje_local': potrzebuje_local,
|
||||
}
|
||||
return HttpResponse(template.render(context, request))
|
||||
return redirect(Mojeogloszenia)
|
||||
return render(request , 'homepage/Dodawanie.html')
|
||||
|
||||
def Mojeogloszenia(request):
|
||||
all_product = Product.objects.filter(user_owner = "jedrzejklepacki@wp.pl")
|
||||
template = loader.get_template('homepage/Mojeogloszenia.html')
|
||||
types = TYPE_T
|
||||
types_o = TYPE_O
|
||||
place_local = ""
|
||||
oddam_local = ""
|
||||
potrzebuje_local = ""
|
||||
usluga_local = ""
|
||||
przedmiot_local = ""
|
||||
context = {
|
||||
'all_product': all_product,
|
||||
'types': types,
|
||||
'place_local': place_local,
|
||||
'oddam_local': oddam_local,
|
||||
'potrzebuje_local': potrzebuje_local,
|
||||
'types_o': types_o,
|
||||
'usluga_local': usluga_local,
|
||||
'przedmiot_local': przedmiot_local,
|
||||
}
|
||||
return HttpResponse(template.render(context, request))
|
||||
|
||||
|
||||
def delete_offer(request, offer_id):
|
||||
instance = Product.objects.get(id=offer_id)
|
||||
instance.active = False
|
||||
instance.save()
|
||||
|
||||
return redirect(Mojeogloszenia)
|
||||
|
Loading…
Reference in New Issue
Block a user