diff --git a/bash.exe.stackdump b/bash.exe.stackdump new file mode 100644 index 0000000000000000000000000000000000000000..c0eb0c6494f4f78f5c56bdb3a47eae2462b72f77 --- /dev/null +++ b/bash.exe.stackdump @@ -0,0 +1,19 @@ +Stack trace: +Frame Function Args +000FFFF5B20 0018005D31C (000FFFFE3F4, 00000000000, 00000000000, 000FFFFDE50) +000FFFF5BC0 0018005E91B (00000000064, 00000000000, 00000000000, 00000000000) +000FFFF5E10 00180121DA0 (001801FCA40, 00000000068, 00000000000, 006FFFFFFB7) +000FFFF6070 00180122389 (000FFFF5FF0, 00000000001, 00000000001, 001802FE678) +000FFFF6070 001800AAAAC (000FFFF6320, 000FFFF656C, 000FFFF62A8, 00000000000) +000FFFF6270 0018011A58B (000FFFF6320, 000FFFF656C, 000FFFF62A8, 00000000000) +000FFFF6270 00100428FB2 (000000015F0, 00000000000, 001005F1F98, 00000000000) +00000000001 0010043257E (006001D3DF0, 006001D31B0, 001800BA34C, 00000000000) +006001D3810 00100437B8A (006001D31B0, 006001D33D7, 00000000076, 000FFFF6578) +006001D31B0 00100438BE4 (00000000001, 00600000000, 000FFFF66B8, 00000000000) +006001D33F0 00100439A7C (00000000000, 00000000000, 00000000000, 00000000000) +001005F6B74 0010043A3E6 (00000000083, 00000000009, 006001D2670, 006001D3360) +001005F6B74 0010043A53F (001800F2D30, 03000000000, 000801FC8D0, 006001D2670) +001005F6B74 001004337B1 (00100000000, 0010043A4E0, 006001BEC10, 006001BEC10) +006001D2670 00100433C41 (00000000000, 000FFFFFF01, 00000000000, 001004DB7B8) +006001D2850 0010043C2C7 (0000000001F, 0000000012C, 00000000000, 000FFFFFFFF) +End of stack trace (more stack frames may be present) diff --git a/environment.sh.example b/environment.sh.example deleted file mode 100644 index 14c4e854dbdd5835050a4cc68d37c5bd0b59a28d..0000000000000000000000000000000000000000 --- a/environment.sh.example +++ /dev/null @@ -1,3 +0,0 @@ -export SECRET_KEY=<CHANGE_TO_SECRET> -export AUTHSCH_KEY=<CHANGE_TO_CLIENT_ID> -export AUTHSCH_SECRET=<CHANGE_TO_AUTHSCH_SECRET> diff --git a/src/account/migrations/0002_auto_20171114_2144.py b/src/account/migrations/0002_auto_20171114_2144.py new file mode 100644 index 0000000000000000000000000000000000000000..fc76cef337448de84b568817d4fe13dd023c0f13 --- /dev/null +++ b/src/account/migrations/0002_auto_20171114_2144.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-14 20:44 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('account', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='pref_group', + field=models.CharField(choices=[('DT', 'DevTeam'), ('NET', 'NeTeam'), ('ST', 'SecurITeam'), ('SYS', 'SysAdmin'), ('HAT', 'HallgatĂłi TudĂĄsbĂĄzis'), ('N', 'None')], default='None', max_length=10), + ), + ] diff --git a/src/account/models.py b/src/account/models.py index fc5485c95754005669cc704f713dc2076fcef2c8..946366206503f812b6925a80e6e59b4d1c60dee1 100644 --- a/src/account/models.py +++ b/src/account/models.py @@ -1,16 +1,20 @@ from django.db import models from django.contrib.auth.models import User +from django.utils import timezone +from django.core.exceptions import ValidationError +import datetime class Profile(models.Model): join_date = models.DateField() user = models.OneToOneField(User, on_delete=models.CASCADE) TEAMS = ( - ('DT', 'DevTeam'), - ('NET', 'NeTeam'), - ('ST', 'SecurITeam'), - ('SYS', 'SysAdmin'), - ('N', 'None'), + ('DT', 'DevTeam'), + ('NET', 'NeTeam'), + ('ST', 'SecurITeam'), + ('SYS', 'SysAdmin'), + ('HAT', 'HallgatĂłi TudĂĄsbĂĄzis'), + ('N', 'None'), ) pref_group = models.CharField(max_length=10, choices=TEAMS, default='None') # Homeworks=models.ForeignKey(Homework) @@ -18,4 +22,6 @@ class Profile(models.Model): def __str__(self): return self.user.username -# Create your models here. + def clean(self): + if self.join_date > datetime.date.today() or self.join_date < datetime.date(2015, 1,1): + raise ValidationError('Invalid date') diff --git a/src/account/tests.py b/src/account/tests.py index 7ce503c2dd97ba78597f6ff6e4393132753573f6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/account/tests.py +++ b/src/account/tests.py @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/src/kszkepzes/settings.py b/src/kszkepzes/settings.py index e2881b67204b50a0e103a23970aa429c7e6db75d..e057366577bed2a401555f70283a733181d4f980 100644 --- a/src/kszkepzes/settings.py +++ b/src/kszkepzes/settings.py @@ -123,7 +123,7 @@ LOGIN_URL = "login/authsch/" LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Budapest' USE_I18N = True diff --git a/src/stats/admin.py b/src/stats/admin.py index a782c32b40a02addd3b1c05fb8af73892670d307..2e9fdbf5fce9651a717184b87dbcdba949e891a3 100644 --- a/src/stats/admin.py +++ b/src/stats/admin.py @@ -1,17 +1,7 @@ from django.contrib import admin -from .models import Profile, KszkEvent - - -@admin.register(Profile) -class ProfileAdmin(admin.ModelAdmin): - list_display = ('user_username', 'year_of_join', 'pref_group') - - def user_username(self, obj): - return obj.user.username - - user_username.admin_order_field = 'user__username' +from .models import KszkEvent @admin.register(KszkEvent) class KszkEventAdmin(admin.ModelAdmin): - list_display= ('date', 'num_of_pers') + list_display = ('date') diff --git a/src/stats/migrations/0001_initial.py b/src/stats/migrations/0001_initial.py index 0932d6c5013dde3953fbdc3aa9d9ed2ada2e2154..91e32fff21f7f6489284d3c0ab02d8b58949f049 100644 --- a/src/stats/migrations/0001_initial.py +++ b/src/stats/migrations/0001_initial.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.5 on 2017-10-03 21:48 +# Generated by Django 1.11.5 on 2017-11-11 14: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): @@ -12,7 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('account', '0001_initial'), ] operations = [ @@ -22,15 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateField()), ('num_of_pers', models.IntegerField()), - ('visitors', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Profile', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('year_of_join', models.IntegerField()), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('visitors', models.ManyToManyField(related_name='visitor', to='account.Profile')), ], ), ] diff --git a/src/stats/migrations/0002_auto_20171023_2320.py b/src/stats/migrations/0002_auto_20171023_2320.py deleted file mode 100644 index a523d0bc7c94e8e0faa261d61edb281c4f204100..0000000000000000000000000000000000000000 --- a/src/stats/migrations/0002_auto_20171023_2320.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.5 on 2017-10-23 21:20 -from __future__ import unicode_literals - -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('stats', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='profile', - name='pref_group', - field=models.CharField(choices=[('DT', 'DevTeam'), ('NET', 'NeTeam'), ('ST', 'SecurITeam'), ('SYS', 'SysAdmin'), ('N', 'None')], default='None', max_length=10), - ), - migrations.AlterField( - model_name='kszkevent', - name='visitors', - field=models.ManyToManyField(related_name='visitor', to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/src/stats/migrations/0002_auto_20171111_1646.py b/src/stats/migrations/0002_auto_20171111_1646.py new file mode 100644 index 0000000000000000000000000000000000000000..7a51b6e003a0e51bf2130254034f7a8bfda83b8b --- /dev/null +++ b/src/stats/migrations/0002_auto_20171111_1646.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-11 15:46 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='kszkevent', + name='num_of_pers', + field=models.IntegerField(editable=False), + ), + ] diff --git a/src/stats/migrations/0003_auto_20171114_2026.py b/src/stats/migrations/0003_auto_20171114_2026.py new file mode 100644 index 0000000000000000000000000000000000000000..4f61427074f3da7f8f404795ce58528a1be00bb6 --- /dev/null +++ b/src/stats/migrations/0003_auto_20171114_2026.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-14 19:26 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0002_auto_20171111_1646'), + ] + + operations = [ + migrations.AlterField( + model_name='kszkevent', + name='date', + field=models.DateTimeField(), + ), + ] diff --git a/src/stats/migrations/0004_remove_kszkevent_num_of_pers.py b/src/stats/migrations/0004_remove_kszkevent_num_of_pers.py new file mode 100644 index 0000000000000000000000000000000000000000..06bf71b435fa15cddf94d3352678cba5aa44784a --- /dev/null +++ b/src/stats/migrations/0004_remove_kszkevent_num_of_pers.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-11-14 19:38 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0003_auto_20171114_2026'), + ] + + operations = [ + migrations.RemoveField( + model_name='kszkevent', + name='num_of_pers', + ), + ] diff --git a/src/stats/migrations/0006_auto_20170926_2122.py b/src/stats/migrations/0006_auto_20170926_2122.py new file mode 100644 index 0000000000000000000000000000000000000000..7deb76706b07417969e5bd4679c1936f29f56dc7 --- /dev/null +++ b/src/stats/migrations/0006_auto_20170926_2122.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.5 on 2017-09-26 19:22 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0005_auto_20170925_2329'), + ] + + operations = [ + migrations.RenameModel( + old_name='Kszk_training', + new_name='Event', + ), + ] diff --git a/src/stats/models.py b/src/stats/models.py index 2c73f5b436667e72ec1231dcbb77357e265c9e09..c21c7211c13ef389de79d0c20dda383dff192549 100644 --- a/src/stats/models.py +++ b/src/stats/models.py @@ -1,27 +1,14 @@ from django.db import models -from django.contrib.auth.models import User +from account.models import Profile +from django.utils import timezone +from django.core.exceptions import ValidationError # Create your models here. -class Profile(models.Model): - year_of_join = models.IntegerField() - user = models.OneToOneField(User, on_delete=models.CASCADE) - TEAMS = ( - ('DT', 'DevTeam'), - ('NET', 'NeTeam'), - ('ST', 'SecurITeam'), - ('SYS', 'SysAdmin'), - ('N', 'None'), - ) - pref_group = models.CharField(max_length=10, choices=TEAMS, default='None') - # Homeworks=models.ForeignKey(Homework) - - def __str__(self): - return self.user.username - - class KszkEvent(models.Model): - date = models.DateField() - visitors = models.ManyToManyField(User, related_name='visitor') + date = models.DateTimeField(null=False) + visitors = models.ManyToManyField(Profile, related_name='visitor') - num_of_pers = models.IntegerField() + def clean(self): + if self.date > timezone.now(): + raise ValidationError('Invalid date') diff --git a/src/stats/serializers.py b/src/stats/serializers.py index 1909a903d370d2eb4c7708f7ee487457862b5685..83569981c7ddc3d22fa64e94970bd98dddb71b85 100644 --- a/src/stats/serializers.py +++ b/src/stats/serializers.py @@ -5,10 +5,4 @@ from . import models class KszkEventSerializer(serializers.ModelSerializer): class Meta: model = models.KszkEvent - fields = ('date', 'num_of_pers', 'visitors') - - -class ProfileSerializer(serializers.ModelSerializer): - class Meta: - model = models.Profile - fields = '__all__' + fields = ('date', 'visitors') diff --git a/src/stats/urls.py b/src/stats/urls.py index 808c9e435d51a0f03d9e573575b0ec743efd87e9..cc55e7dac458cda91a5873f7ff747bb68615c627 100644 --- a/src/stats/urls.py +++ b/src/stats/urls.py @@ -4,8 +4,6 @@ from . import views router = routers.DefaultRouter(trailing_slash=False) router.register(r'events', views.KszkEventViewSet) -router.register(r'profiles', views.ProfileViewSet) - # app_name = 'stats' urlpatterns = router.urls diff --git a/src/stats/views.py b/src/stats/views.py index 31c9a8226ebaf978bd439b0e70fe6b56e5675c90..c7ed3ecdf5621171f68cd8dcacc07621296b77c1 100644 --- a/src/stats/views.py +++ b/src/stats/views.py @@ -6,9 +6,4 @@ from . import serializers class KszkEventViewSet(viewsets.ModelViewSet): serializer_class = serializers.KszkEventSerializer - queryset = models.KszkEvent.objects.filter() - - -class ProfileViewSet(viewsets.ModelViewSet): - serializer_class = serializers.ProfileSerializer - queryset = models.Profile.objects.all() + queryset = models.KszkEvent.objects.all()