diff --git a/README.md b/README.md index 4051526..0005087 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,15 @@ Rozpracováno (částečně funguje): Chybí, je třeba opravit (hmm.. od čeho začít :) * plnění webu day prozatím pouze skrze administraci (viz. link výše) + * front-end, design * hodnocení jízd * poptávky jízd * (a všechno ostatní ...) + + * (skrze administraci) lze přihlásit pasažéra i na trasu mimo jeho jízdu - toto budeme stejně ošetřovat už při vkládání do DB, takže to nakonec tak moc vadit nebude + * všechno ostatní ... + +## Zavislosti + * je potreba rucne doinstalovat emailusernames, pip nefunguje (nevim proc) + * https://github.com/harmo/django-email-as-username diff --git a/apps/web/admin.py b/apps/web/admin.py index 2634554..e460fb9 100644 --- a/apps/web/admin.py +++ b/apps/web/admin.py @@ -6,6 +6,7 @@ admin.site.register(models.Comment) admin.site.register(models.Waypoint) admin.site.register(models.Passanger) +admin.site.register(models.Vehicle) admin.site.register(models.JourneyWaypoints) diff --git a/apps/web/forms.py b/apps/web/forms.py index 467fbf8..559b1b6 100644 --- a/apps/web/forms.py +++ b/apps/web/forms.py @@ -1,5 +1,10 @@ from django import forms + +from . import models + +from random import randint from . import models +from django.utils.translation import ugettext_lazy as _ class SearchJourney(forms.Form): @@ -25,6 +30,7 @@ class Meta: wpt_update_factory_kwargs = dict(wpt_base_factory_kwargs) wpt_new_factory_kwargs['extra'] = 2 + WaypointNewFormSetFactory = forms.inlineformset_factory( **wpt_new_factory_kwargs) WaypointUpdateFormSetFactory = forms.inlineformset_factory( @@ -36,3 +42,53 @@ class Meta: model = models.JourneyWaypoints fields = ['journey', 'waypoint', 'label'] js = ('js/jquery.js',) + +class RegisterForm(forms.Form): + + def rand_anti_question(): + day_list = ["pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota", "neděle"] + + rand_day_num = randint(0, len(day_list)) + rand_addition = randint(0, len(day_list)) + correct_day_num = rand_day_num + rand_addition + correct_day_index = correct_day_num + + if correct_day_index >= len(day_list): + correct_day_index = correct_day_index - len(day_list) + + question = "Dnes je %s. V případě, že je toto tvrzení pravdivé, co bude za %s dny?" % (day_list[rand_day_num - 1], rand_addition) + return (question, day_list[correct_day_index - 1]) + + user_email = forms.CharField(max_length = 100, label = _("Your E-Mail address")) + user_email_confirm = forms.CharField(max_length = 100, label = _("Your E-Mail address - Confirmation")) + user_password = forms.CharField(widget = forms.PasswordInput(), label = _("Your Password")) + user_password_confirm = forms.CharField(widget = forms.PasswordInput(), label = _("Your Password - Confirmation")) + + cont_question, correct_day = rand_anti_question() + random_antibot = forms.CharField(max_length = 50, label = cont_question) + + +class LoginForm(forms.Form): + user_name = forms.EmailField(max_length = 100, label = _("Your email")) + user_pass = forms.CharField(widget = forms.PasswordInput(), label = _("Your Password")) + + +class ManageForm(forms.Form): + user_mail = forms.EmailField(max_length = 100, label = _("Your E-mail address")) + user_mail_confirm = forms.EmailField(max_length = 100, label = _("Your E-mail address - Confirmation")) + user_pass = forms.CharField(max_length = 100, widget = forms.PasswordInput(), label = _("Your Password")) + user_pass_confirm = forms.EmailField(max_length = 100, widget = forms.PasswordInput(), label = _("Your Password - Confirmation")) + user_phone = forms.CharField(max_length = 20, label = _("Your phone number")) + + +class CarManageForm(forms.Form): + car_name = forms.CharField(max_length = 20, label = _("Your car brand")) + #color = forms.CharField(max_length = 10, label = _("Your car's color")) + + air_conditioning = forms.BooleanField(label = _("Air conditioning in car")) + animals_allowed = forms.BooleanField(label = _("Animal transport is allowed")) + has_wifi = forms.BooleanField(label = _("Wifi is in car")) + has_highway_sign = forms.BooleanField(label = _("Car has a Highway stamp")) + smoking_allowed = forms.BooleanField(label = "Smoking allowed in vehicle") + + register_sign = forms.CharField(max_length = 16, label = _("Car national register sign")) diff --git a/apps/web/migrations.old/0001_initial.py b/apps/web/migrations.old/0001_initial.py deleted file mode 100644 index bef3624..0000000 --- a/apps/web/migrations.old/0001_initial.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-11 23:14 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Comment', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('message', models.TextField()), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_author', to=settings.AUTH_USER_MODEL)), - ('recipient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_recipient', to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Journey', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('price', models.FloatField(default=0)), - ('currency', models.CharField(default='CZK', max_length=3)), - ], - ), - migrations.CreateModel( - name='JourneyWaypoints', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('order', models.IntegerField(default=0, verbose_name='Number of stop from start point')), - ('journey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Journey')), - ], - ), - migrations.CreateModel( - name='UserProfile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('phone_number', models.CharField(blank=True, max_length=13, verbose_name='Phone numberr')), - ('reputation', models.IntegerField(blank=True, default=0)), - ('modeid', models.CharField(blank=True, max_length=100)), - ('num_journeys', models.IntegerField(blank=True, default=0)), - ('driven_km', models.IntegerField(blank=True, default=0)), - ('drive_years', models.IntegerField(blank=True, default=0)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Waypoint', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('city', models.CharField(max_length=100)), - ('label', models.CharField(blank=True, default='', max_length=100)), - ], - ), - migrations.AddField( - model_name='journeywaypoints', - name='waypoint', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Waypoint'), - ), - migrations.AddField( - model_name='journey', - name='city_from', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wpt_from', to='web.Waypoint'), - ), - migrations.AddField( - model_name='journey', - name='city_to', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wpt_to', to='web.Waypoint'), - ), - migrations.AddField( - model_name='journey', - name='comments', - field=models.ManyToManyField(blank=True, to='web.Comment'), - ), - migrations.AddField( - model_name='journey', - name='driver', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/apps/web/migrations.old/0002_auto_20160211_2320.py b/apps/web/migrations.old/0002_auto_20160211_2320.py deleted file mode 100644 index f9d7403..0000000 --- a/apps/web/migrations.old/0002_auto_20160211_2320.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-11 23:20 -from __future__ import unicode_literals - -import datetime -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='journey', - name='approx', - field=models.BooleanField(default='', verbose_name='Driver is not sure about exact time of departure'), - ), - migrations.AddField( - model_name='journey', - name='approx_note', - field=models.CharField(blank=True, max_length=100, verbose_name='If approx is applied, this can be used for short note to departure'), - ), - migrations.AddField( - model_name='journey', - name='date', - field=models.DateTimeField(default=datetime.datetime(2016, 2, 11, 23, 20, 43, 417232), verbose_name='Date/time of start of journey'), - ), - migrations.AddField( - model_name='journey', - name='waypoints', - field=models.ManyToManyField(through='web.JourneyWaypoints', to='web.Waypoint'), - ), - ] diff --git a/apps/web/migrations.old/0003_auto_20160211_2321.py b/apps/web/migrations.old/0003_auto_20160211_2321.py deleted file mode 100644 index 4f9933a..0000000 --- a/apps/web/migrations.old/0003_auto_20160211_2321.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-11 23:21 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0002_auto_20160211_2320'), - ] - - operations = [ - migrations.AlterField( - model_name='journey', - name='date', - field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date/time of start of journey'), - ), - ] diff --git a/apps/web/migrations.old/0004_auto_20160212_0905.py b/apps/web/migrations.old/0004_auto_20160212_0905.py deleted file mode 100644 index 6c0832c..0000000 --- a/apps/web/migrations.old/0004_auto_20160212_0905.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 09:05 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0003_auto_20160211_2321'), - ] - - operations = [ - migrations.CreateModel( - name='Group', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128)), - ], - ), - migrations.CreateModel( - name='Membership', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date_joined', models.DateField()), - ('invite_reason', models.CharField(max_length=64)), - ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Group')), - ], - ), - migrations.CreateModel( - name='Person', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128)), - ], - ), - migrations.AddField( - model_name='membership', - name='person', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Person'), - ), - migrations.AddField( - model_name='group', - name='members', - field=models.ManyToManyField(through='web.Membership', to='web.Person'), - ), - ] diff --git a/apps/web/migrations.old/0005_auto_20160212_0907.py b/apps/web/migrations.old/0005_auto_20160212_0907.py deleted file mode 100644 index 2644aad..0000000 --- a/apps/web/migrations.old/0005_auto_20160212_0907.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 09:07 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0004_auto_20160212_0905'), - ] - - operations = [ - migrations.RenameField( - model_name='membership', - old_name='group', - new_name='group1', - ), - migrations.RenameField( - model_name='membership', - old_name='person', - new_name='person1', - ), - ] diff --git a/apps/web/migrations.old/0006_auto_20160212_0921.py b/apps/web/migrations.old/0006_auto_20160212_0921.py deleted file mode 100644 index b8db398..0000000 --- a/apps/web/migrations.old/0006_auto_20160212_0921.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 09:21 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0005_auto_20160212_0907'), - ] - - operations = [ - migrations.RemoveField( - model_name='group', - name='members', - ), - migrations.RemoveField( - model_name='membership', - name='group1', - ), - migrations.RemoveField( - model_name='membership', - name='person1', - ), - migrations.DeleteModel( - name='Group', - ), - migrations.DeleteModel( - name='Membership', - ), - migrations.DeleteModel( - name='Person', - ), - ] diff --git a/apps/web/migrations.old/0007_journeywaypoints_partial_price.py b/apps/web/migrations.old/0007_journeywaypoints_partial_price.py deleted file mode 100644 index f5fb8e2..0000000 --- a/apps/web/migrations.old/0007_journeywaypoints_partial_price.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 09:25 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0006_auto_20160212_0921'), - ] - - operations = [ - migrations.AddField( - model_name='journeywaypoints', - name='partial_price', - field=models.FloatField(blank=True, default=None, null=True, verbose_name='Price between previous and this waypoint (currency is same).'), - ), - ] diff --git a/apps/web/migrations.old/0008_auto_20160212_0941.py b/apps/web/migrations.old/0008_auto_20160212_0941.py deleted file mode 100644 index 1144541..0000000 --- a/apps/web/migrations.old/0008_auto_20160212_0941.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 09:41 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0007_journeywaypoints_partial_price'), - ] - - operations = [ - migrations.AddField( - model_name='waypoint', - name='lat', - field=models.FloatField(default=0, verbose_name='Lattitude'), - ), - migrations.AddField( - model_name='waypoint', - name='long', - field=models.FloatField(default=0, verbose_name='Longtitude'), - ), - migrations.AlterField( - model_name='journeywaypoints', - name='order', - field=models.IntegerField(default=0, verbose_name='Number of stop from start city'), - ), - migrations.AlterUniqueTogether( - name='journeywaypoints', - unique_together=set([('journey', 'waypoint', 'order')]), - ), - ] diff --git a/apps/web/migrations.old/0009_auto_20160212_1109.py b/apps/web/migrations.old/0009_auto_20160212_1109.py deleted file mode 100644 index 9cbef42..0000000 --- a/apps/web/migrations.old/0009_auto_20160212_1109.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 11:09 -from __future__ import unicode_literals - -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), - ('web', '0008_auto_20160212_0941'), - ] - - operations = [ - migrations.CreateModel( - name='Passanger', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('state', models.CharField(choices=[('subscr', 'Assigned to the journey'), ('unsubs', 'Unsubscribed to the journey'), ('reject', 'Rejected by driver')], default='subscr', max_length=6)), - ], - ), - migrations.RenameField( - model_name='userprofile', - old_name='modeid', - new_name='mojeid', - ), - migrations.RemoveField( - model_name='journey', - name='city_from', - ), - migrations.RemoveField( - model_name='journey', - name='city_to', - ), - migrations.AddField( - model_name='journeywaypoints', - name='segment_price', - field=models.FloatField(blank=True, default=None, help_text='Price between previous and this waypoint (currency is same as set in journey).', null=True, verbose_name='Partial price of journey'), - ), - migrations.AddField( - model_name='waypoint', - name='output_only', - field=models.BooleanField(default=False, help_text='Waypoting is for leaving only.'), - ), - migrations.AlterField( - model_name='journeywaypoints', - name='order', - field=models.IntegerField(default=0, verbose_name='Order number from start'), - ), - migrations.AlterField( - model_name='userprofile', - name='phone_number', - field=models.CharField(blank=True, max_length=13), - ), - migrations.RemoveField( - model_name='journeywaypoints', - name='partial_price', - ), - migrations.AddField( - model_name='journeywaypoints', - name='passangers', - field=models.ManyToManyField(to='web.Passanger'), - ), - migrations.AlterUniqueTogether( - name='journeywaypoints', - unique_together=set([('journey', 'order')]), - ), - migrations.AddField( - model_name='passanger', - name='journey', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Journey'), - ), - migrations.AddField( - model_name='passanger', - name='user', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/apps/web/migrations.old/0010_auto_20160212_1128.py b/apps/web/migrations.old/0010_auto_20160212_1128.py deleted file mode 100644 index f14fd8a..0000000 --- a/apps/web/migrations.old/0010_auto_20160212_1128.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 11:28 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0009_auto_20160212_1109'), - ] - - operations = [ - migrations.AlterField( - model_name='journey', - name='currency', - field=models.CharField(choices=[('CZK', 'Kc'), ('EUR', 'Eur')], default='CZK', max_length=3), - ), - migrations.AlterField( - model_name='journey', - name='price', - field=models.FloatField(default=0, help_text='Price for whole journey from beginning to end.'), - ), - ] diff --git a/apps/web/migrations.old/0011_auto_20160212_1138.py b/apps/web/migrations.old/0011_auto_20160212_1138.py deleted file mode 100644 index ff928bf..0000000 --- a/apps/web/migrations.old/0011_auto_20160212_1138.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 11:38 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0010_auto_20160212_1128'), - ] - - operations = [ - migrations.RemoveField( - model_name='waypoint', - name='output_only', - ), - migrations.AddField( - model_name='journeywaypoints', - name='output_only', - field=models.BooleanField(default=False, help_text='Waypoting is for leaving only.'), - ), - migrations.AlterField( - model_name='journeywaypoints', - name='passangers', - field=models.ManyToManyField(blank=True, to='web.Passanger'), - ), - ] diff --git a/apps/web/migrations.old/0012_auto_20160212_1143.py b/apps/web/migrations.old/0012_auto_20160212_1143.py deleted file mode 100644 index a4ffd90..0000000 --- a/apps/web/migrations.old/0012_auto_20160212_1143.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 11:43 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0011_auto_20160212_1138'), - ] - - operations = [ - migrations.RemoveField( - model_name='waypoint', - name='label', - ), - migrations.AddField( - model_name='journeywaypoints', - name='label', - field=models.CharField(blank=True, max_length=100, null=True), - ), - ] diff --git a/apps/web/migrations.old/0013_auto_20160212_1235.py b/apps/web/migrations.old/0013_auto_20160212_1235.py deleted file mode 100644 index 5e043c7..0000000 --- a/apps/web/migrations.old/0013_auto_20160212_1235.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 12:35 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0012_auto_20160212_1143'), - ] - - operations = [ - migrations.AlterField( - model_name='comment', - name='recipient', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_recipient', to=settings.AUTH_USER_MODEL), - ), - migrations.AlterField( - model_name='passanger', - name='state', - field=models.CharField(choices=[('subscr', 'Assigned'), ('unsubs', 'Unsubscribed'), ('reject', 'Rejected by driver')], default='subscr', max_length=6), - ), - ] diff --git a/apps/web/migrations.old/0014_auto_20160212_1236.py b/apps/web/migrations.old/0014_auto_20160212_1236.py deleted file mode 100644 index fbea0d0..0000000 --- a/apps/web/migrations.old/0014_auto_20160212_1236.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 12:36 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0013_auto_20160212_1235'), - ] - - operations = [ - migrations.AlterField( - model_name='comment', - name='recipient', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_recipient', to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/apps/web/migrations.old/0015_auto_20160212_1253.py b/apps/web/migrations.old/0015_auto_20160212_1253.py deleted file mode 100644 index cce99da..0000000 --- a/apps/web/migrations.old/0015_auto_20160212_1253.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 12:53 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0014_auto_20160212_1236'), - ] - - operations = [ - migrations.RemoveField( - model_name='journeywaypoints', - name='passangers', - ), - migrations.AddField( - model_name='journeywaypoints', - name='passangers', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='web.Passanger'), - ), - ] diff --git a/apps/web/migrations.old/0016_auto_20160212_1256.py b/apps/web/migrations.old/0016_auto_20160212_1256.py deleted file mode 100644 index 41e3c24..0000000 --- a/apps/web/migrations.old/0016_auto_20160212_1256.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 12:56 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0015_auto_20160212_1253'), - ] - - operations = [ - migrations.RemoveField( - model_name='journeywaypoints', - name='passangers', - ), - migrations.AddField( - model_name='journeywaypoints', - name='passangers', - field=models.ManyToManyField(to='web.Passanger'), - ), - ] diff --git a/apps/web/migrations.old/0017_auto_20160212_1307.py b/apps/web/migrations.old/0017_auto_20160212_1307.py deleted file mode 100644 index ef4fb56..0000000 --- a/apps/web/migrations.old/0017_auto_20160212_1307.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 13:07 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('web', '0016_auto_20160212_1256'), - ] - - operations = [ - migrations.AlterField( - model_name='journeywaypoints', - name='passangers', - field=models.ManyToManyField(blank=True, to='web.Passanger'), - ), - ] diff --git a/apps/web/migrations.old/__init__.py b/apps/web/migrations.old/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/apps/web/migrations/0001_initial.py b/apps/web/migrations/0001_initial.py deleted file mode 100644 index c3f140d..0000000 --- a/apps/web/migrations/0001_initial.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.2 on 2016-02-12 23:37 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import django.utils.timezone - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='Comment', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateTimeField()), - ('message', models.TextField()), - ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_author', to=settings.AUTH_USER_MODEL)), - ('recipient', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_recipient', to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Journey', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('price', models.FloatField(default=0, help_text='Price for whole journey from beginning to end.')), - ('date', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Date/time of start of journey')), - ('approx', models.BooleanField(default='', verbose_name='Driver is not sure about exact time of departure')), - ('approx_note', models.CharField(blank=True, max_length=100, verbose_name='If approx is applied, this can be used for short note to departure')), - ('currency', models.CharField(choices=[('CZK', 'Kc'), ('EUR', 'Eur')], default='CZK', max_length=3)), - ('comments', models.ManyToManyField(blank=True, to='web.Comment')), - ('driver', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='JourneyWaypoints', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(blank=True, help_text='Note about the place, i.e. corner of cross.', max_length=100, null=True)), - ('output_only', models.BooleanField(default=False, help_text='Waypoting is for leaving only.')), - ('order', models.IntegerField(default=0, verbose_name='Order number from start')), - ('segment_price', models.FloatField(blank=True, default=None, help_text='Price between previous and this waypoint (currency is same as set in journey).', null=True, verbose_name='Partial price of journey')), - ('journey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Journey')), - ], - ), - migrations.CreateModel( - name='Passanger', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('state', models.CharField(choices=[('subscr', 'Assigned'), ('unsubs', 'Unsubscribed'), ('reject', 'Rejected by driver')], default='subscr', max_length=6)), - ('journey', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Journey')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='UserProfile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('phone_number', models.CharField(blank=True, max_length=13)), - ('reputation', models.IntegerField(blank=True, default=0)), - ('mojeid', models.CharField(blank=True, max_length=100)), - ('num_journeys', models.IntegerField(blank=True, default=0)), - ('driven_km', models.IntegerField(blank=True, default=0)), - ('drive_years', models.IntegerField(blank=True, default=0)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Waypoint', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('city', models.CharField(max_length=100)), - ('lat', models.FloatField(default=0, verbose_name='Lattitude')), - ('long', models.FloatField(default=0, verbose_name='Longtitude')), - ], - ), - migrations.AddField( - model_name='journeywaypoints', - name='passangers', - field=models.ManyToManyField(blank=True, to='web.Passanger'), - ), - migrations.AddField( - model_name='journeywaypoints', - name='waypoint', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Waypoint'), - ), - migrations.AddField( - model_name='journey', - name='waypoints', - field=models.ManyToManyField(through='web.JourneyWaypoints', to='web.Waypoint'), - ), - migrations.AlterUniqueTogether( - name='journeywaypoints', - unique_together=set([('journey', 'order')]), - ), - ] diff --git a/apps/web/migrations/0002_vehicle.py b/apps/web/migrations/0002_vehicle.py new file mode 100644 index 0000000..5056d6f --- /dev/null +++ b/apps/web/migrations/0002_vehicle.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-02-24 06:27 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('web', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Vehicle', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=20)), + ('owner', models.IntegerField(default=None)), + ('register', models.CharField(blank=True, default=None, max_length=20)), + ('color', models.CharField(max_length=10)), + ('wifi_on_board', models.BooleanField(default=False)), + ('animals_allowed', models.BooleanField(default=False)), + ('highway_mark', models.BooleanField(default=False)), + ('smoking_allowed', models.BooleanField(default=False)), + ('air_conditioning', models.BooleanField(default=True)), + ], + ), + ] diff --git a/apps/web/migrations/__init__.py b/apps/web/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/apps/web/models.py b/apps/web/models.py index 52926df..28e3524 100644 --- a/apps/web/models.py +++ b/apps/web/models.py @@ -5,9 +5,40 @@ from django.db import models from django.conf import settings from django.db.models import signals + + +from django.contrib.auth.hashers import check_password +#from django.contrib.gis.db import models as gis_models + from django.contrib.auth.models import User +class Vehicle(models.Model): + name = models.CharField(max_length=20, blank=False) + owner = models.ForeignKey(User) + register = models.CharField(max_length=20, blank = True, default = None) + color = models.CharField(max_length=10, blank=False) + + wifi_on_board = models.BooleanField(default=False) + animals_allowed = models.BooleanField(default=False) + highway_mark = models.BooleanField(default=False) + smoking_allowed = models.BooleanField(default=False) + air_conditioning = models.BooleanField(default=False) + + def __str__(self): + ret_str = "Vehicle basic attrs:\n\ + name: %s, register: %s, \ + color: %s\, owner_id: %s, \ + wifi_on_board: %s, animals_allowed: %s, \ + highway_mark: %s\nsmoking_allowed: %s, \ + air_conditioning: %s" % (self.name, self.register, + self.color, self.owner.id, + self.wifi_on_board, self.animals_allowed, + self.highway_mark,self.smoking_allowed, + self.air_conditioning) + return ret_str + + class UserProfile(models.Model): user = models.OneToOneField( settings.AUTH_USER_MODEL, @@ -21,7 +52,7 @@ class UserProfile(models.Model): drive_years = models.IntegerField(blank=True, default=0) def __str__(self): - return self.user.username + return self.user.email def create_user_profile(sender, instance, created, **kwargs): diff --git a/apps/web/static/web/css/styles.css b/apps/web/static/web/css/styles.css index 82e27d6..241f7be 100644 --- a/apps/web/static/web/css/styles.css +++ b/apps/web/static/web/css/styles.css @@ -1,6 +1,46 @@ -table td, table th { - border: 1px solid black; -} -table th { - background-color: #ccc; -} \ No newline at end of file +/* Zaklady. Nejdrive zakladni veci, ktere sjednocuji drtivou vetsinu nastaveni. */ + +body { background: black; padding: 0px; margin: 0 auto; max-width: 1280px; font-family: arial;} + +h1 { margin: 0px; padding: 5px; text-align: right; color: white;} +h2 { padding: 10px; margin: 0px; text-align: center;} +h4 { padding: 10px; margin: 0px; text-align: center;} + +a {text-align: center; padding: 10px; border: 2px solid black; border-radius: 10px; text-decoration: none; display: inline-block; width: 50%; box-sizing: border-box; margin: -1px} +p { padding: 4px; margin: 0px; } + +input { width: 100%; text-align: center; box-sizing: border-box; border-radius: 10px; padding: 5px; margin-top: 2px; margin-bottom: 2px; } +select {width: 100%; text-align: center; padding: 5px;} +textarea {width: 100%; box-sizing: border-box;} + +canvas {width: 100%; height: 32px;} + +/* Spolecne pro div a vzhled zakladu */ +#hlavicka { background: #4b9320; } +#prechod {background: linear-gradient(#4b9320, #71c900)} +#stranka {background: #71c900;} +#vyber_barvy { height: 64px;} + +/* Nastaveni k dialogu ceny */ +#cena_spolujizdy {width: 49%; box-sizing: border-box;} +#cena_spolujizdy_sel {width: 49%; box-sizing: border-box;} + +/* Nastaveni pro chybu */ +#chyba {text-align: center ; background: red; font-size: 20px;} + +/* Nastaveni pro tlacitko typu submit */ +.tlacitko {width: 100%; box-sizing: border-box; background-color: #094100; color: white;} +.tlacitko:hover {background-color: #1f9900; border: 2px solid white;} +/* Chceme sjednotit tlacitko typu a a submit? */ +.tlacitko {width: 100%; background-color: #094100; color: white; border: 2px solid black;} +.tlacitko:hover {background-color: #1f9900; border: 2px solid white;} + +.poznamka {background: orange; font-size: 20px; text-align: center;} +.informace {background: #4e7fff; font-size: 20px; text-align: center;} +.vlas_voz { width: 20px;} +.pulsegment { width: 50%; float: left; background: #71c900;} +.nadpis_hod {font-size: 20px;} +.text_hod { font-size: 20px;} + +.vyber_spolujizdy {width: 100%; text-align: center; background: #03a200; color: white; border: 1px solid black; border-radius: 15px; display: block;} +.vyber_spolujizdy:hover { background: #b6ff6c; color: black;} diff --git a/apps/web/templates/base.html b/apps/web/templates/base.html index 952c488..1f3c9f0 100644 --- a/apps/web/templates/base.html +++ b/apps/web/templates/base.html @@ -1,20 +1,40 @@ {% load i18n %} {% load static from staticfiles %} - - -
- -Logged in as {{ request.user.email }}
+ +Vehicle list
+