filtrowanie ogloszen wolontariat

This commit is contained in:
Alicja Kupczyk 2021-01-02 17:05:39 +01:00
parent 0b37ac8be5
commit 981b39b2fb
22 changed files with 30 additions and 68 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 3.1.4 on 2020-12-20 16:51
# Generated by Django 3.1.4 on 2021-01-02 14:27
import datetime
from django.conf import settings
@ -15,11 +15,20 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Places',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('city', models.TextField(default='', max_length=40)),
('woj_city', models.TextField(default='', max_length=40)),
],
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('active', models.BooleanField(default=True)),
('Wolontatriat', models.BooleanField(default=False)),
('picture', models.ImageField(blank=True, null=True, upload_to='images/')),
('create_date', models.DateField(default=datetime.date.today, verbose_name='Date')),
('type', models.IntegerField(choices=[(1, 'Potrzebuje'), (2, 'Oddam')], default='')),
@ -31,4 +40,13 @@ class Migration(migrations.Migration):
('user_iden', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Ocena',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('comm', models.TextField(default='', max_length=40)),
('ocena_jedn', models.FloatField(default='', max_length=40)),
('user_iden', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.1.4 on 2020-12-30 21:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='product',
name='Wolontatriat',
field=models.BooleanField(default=False),
),
]

View File

@ -1,21 +0,0 @@
# Generated by Django 3.1.4 on 2020-12-31 12:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_product_wolontatriat'),
]
operations = [
migrations.CreateModel(
name='Places',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('city', models.TextField(default='', max_length=40)),
('woj_city', models.TextField(default='', max_length=40)),
],
),
]

View File

@ -1,25 +0,0 @@
# Generated by Django 3.1.4 on 2021-01-01 16:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('homepage', '0003_places'),
]
operations = [
migrations.CreateModel(
name='Ocena',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('comm', models.TextField(default='', max_length=40)),
('ocena_jedn', models.FloatField(default='', max_length=40)),
('user_iden', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -159,9 +159,12 @@
<h3>Wolontariat</h3>
</div>
<ul>
<label for="Wolontariat">Tak</label>
<p></p>
<label for="scales">Nie</label>
{% if wol_local%}
<input type="checkbox" id="wolontariat" name="wolontariat" Checked>
{% else %}
<input type="checkbox" id="wolontariat" name="wolontariat" >
{% endif %}
<label for="wolontariat">Tak</label>
</ul>
</aside>

View File

@ -123,6 +123,8 @@ def filter(request):
potrzebuje_local = request.POST['Potrzebuje']
usluga_local = request.POST['usluga']
przedmiot_local = request.POST['przedmiot']
wol_local = request.POST['wolontariat']
if place_local != "":
@ -144,6 +146,9 @@ def filter(request):
zmienna = 2
all_product = all_product.filter(type=zmienna)
if wol_local == "on":
all_product = all_product.filter(Wolontatriat=True)
types = TYPE_T
types_o = TYPE_O