diff --git a/pyconbalkan/conference/__init__.py b/pyconbalkan/conference/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyconbalkan/conference/admin.py b/pyconbalkan/conference/admin.py new file mode 100644 index 00000000..9cb49893 --- /dev/null +++ b/pyconbalkan/conference/admin.py @@ -0,0 +1,17 @@ +from django.contrib import admin + +from pyconbalkan.conference.models import Conference, CountDown + + +class ConferenceAdmin(admin.ModelAdmin): + class Meta: + model = Conference + + +class CountDownAdmin(admin.ModelAdmin): + class Meta: + model = CountDown + + +admin.site.register(Conference, ConferenceAdmin) +admin.site.register(CountDown, CountDownAdmin) diff --git a/pyconbalkan/conference/api_urls.py b/pyconbalkan/conference/api_urls.py new file mode 100644 index 00000000..8d3e84e8 --- /dev/null +++ b/pyconbalkan/conference/api_urls.py @@ -0,0 +1,6 @@ +from rest_framework import routers + +from pyconbalkan.conference.views import ConferenceViewSet + +router = routers.DefaultRouter() +router.register(r'conference', ConferenceViewSet) \ No newline at end of file diff --git a/pyconbalkan/conference/apps.py b/pyconbalkan/conference/apps.py new file mode 100644 index 00000000..cd92fc5c --- /dev/null +++ b/pyconbalkan/conference/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ConferenceConfig(AppConfig): + name = 'conference' diff --git a/pyconbalkan/conference/migrations/0001_initial.py b/pyconbalkan/conference/migrations/0001_initial.py new file mode 100644 index 00000000..bf02991d --- /dev/null +++ b/pyconbalkan/conference/migrations/0001_initial.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-04-26 21:51 +from __future__ import unicode_literals + +from django.db import migrations, models +import django_countries.fields + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Conference', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('active', models.BooleanField(default=False)), + ('event', models.CharField(blank=True, max_length=100, null=True)), + ('name', models.CharField(blank=True, max_length=100, null=True)), + ('year', models.PositiveIntegerField()), + ('number', models.PositiveIntegerField()), + ('city', models.CharField(blank=True, max_length=200, null=True)), + ('country', django_countries.fields.CountryField(blank=True, max_length=2, null=True)), + ('address', models.TextField(blank=True, null=True)), + ('from_date', models.DateField(blank=True, null=True)), + ('to_date', models.DateField(blank=True, null=True)), + ('max_attendees', models.PositiveIntegerField(blank=True, null=True)), + ('type', models.IntegerField(choices=[(0, 'International'), (1, 'National')])), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CountDown', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('active', models.BooleanField(default=False)), + ('title', models.CharField(blank=True, max_length=100, null=True)), + ('count_down', models.DateTimeField(blank=True, null=True)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/pyconbalkan/conference/migrations/__init__.py b/pyconbalkan/conference/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pyconbalkan/conference/models.py b/pyconbalkan/conference/models.py new file mode 100644 index 00000000..fb3e69cc --- /dev/null +++ b/pyconbalkan/conference/models.py @@ -0,0 +1,37 @@ +from django.db import models +from django_countries.fields import CountryField + +from pyconbalkan.core.models import SingleActiveModel + + +class Conference(SingleActiveModel): + INTERNATIONAL = 0 + NATIONAL = 1 + CONF_TYPE = ( + (INTERNATIONAL, 'International'), + (NATIONAL, 'National'), + ) + + event = models.CharField(null=True, blank=True, max_length=100) + name = models.CharField(null=True, blank=True, max_length=100) + year = models.PositiveIntegerField() + number = models.PositiveIntegerField() + city = models.CharField(null=True, blank=True, max_length=200) + country = CountryField(null=True, blank=True) + address = models.TextField(null=True, blank=True) + from_date = models.DateField(null=True, blank=True) + to_date = models.DateField(null=True, blank=True) + max_attendees = models.PositiveIntegerField(null=True, blank=True) + type = models.IntegerField(choices=CONF_TYPE) + + + def __str__(self): + return '{} {} {}'.format(self.event, self.name, self.year) + + +class CountDown(SingleActiveModel): + title = models.CharField(null=True, blank=True, max_length=100) + count_down = models.DateTimeField(null=True, blank=True) + + def __str__(self): + return self.title \ No newline at end of file diff --git a/pyconbalkan/conference/serializers.py b/pyconbalkan/conference/serializers.py new file mode 100644 index 00000000..5e8a3ed8 --- /dev/null +++ b/pyconbalkan/conference/serializers.py @@ -0,0 +1,9 @@ +from rest_framework import serializers + +from pyconbalkan.conference.models import Conference + + +class ConferenceSerializer(serializers.ModelSerializer): + class Meta: + model = Conference + fields = '__all__' diff --git a/pyconbalkan/conference/templates/index.html b/pyconbalkan/conference/templates/index.html new file mode 100644 index 00000000..e69de29b diff --git a/pyconbalkan/conference/tests.py b/pyconbalkan/conference/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/pyconbalkan/conference/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/pyconbalkan/conference/views.py b/pyconbalkan/conference/views.py new file mode 100644 index 00000000..fbfda053 --- /dev/null +++ b/pyconbalkan/conference/views.py @@ -0,0 +1,9 @@ +from rest_framework import viewsets + +from pyconbalkan.conference.models import Conference +from pyconbalkan.conference.serializers import ConferenceSerializer + + +class ConferenceViewSet(viewsets.ModelViewSet): + queryset = Conference.objects.all() + serializer_class = ConferenceSerializer diff --git a/pyconbalkan/core/admin.py b/pyconbalkan/core/admin.py index e1f78093..c42474ae 100644 --- a/pyconbalkan/core/admin.py +++ b/pyconbalkan/core/admin.py @@ -1,19 +1,6 @@ from django.apps import AppConfig -from django.contrib import admin - -from pyconbalkan.core.models import Speaker, SpeakerPhoto class CoreConfig(AppConfig): name = 'core' - -class SpeakerImageInline(admin.TabularInline): - model = SpeakerPhoto - - -class SpeakerAdmin(admin.ModelAdmin): - inlines = [SpeakerImageInline] - - -admin.site.register(Speaker, SpeakerAdmin) diff --git a/pyconbalkan/core/api_urls.py b/pyconbalkan/core/api_urls.py new file mode 100644 index 00000000..e69de29b diff --git a/pyconbalkan/core/models.py b/pyconbalkan/core/models.py index 8f3083f0..98103407 100644 --- a/pyconbalkan/core/models.py +++ b/pyconbalkan/core/models.py @@ -1,16 +1,21 @@ from django.db import models -# Create your models here. +class SingleActiveModel(models.Model): + active = models.BooleanField(default=False) -class Speaker(models.Model): - name = models.CharField(max_length=50) - job = models.CharField(max_length=100) + class Meta: + abstract = True - def __str__(self): - return self.name + def save(self, *args, **kwargs): + if self.active: + # select all other active items + qs = type(self).objects.filter(active=True) + # except self (if self already exists) + if self.pk: + qs = qs.exclude(pk=self.pk) + # and deactive them + qs.update(active=False) + super(SingleActiveModel, self).save(*args, **kwargs) -class SpeakerPhoto(models.Model): - speaker = models.ForeignKey('Speaker', related_name='images') - profile_picture = models.ImageField(upload_to="static/img") diff --git a/pyconbalkan/core/routers.py b/pyconbalkan/core/routers.py new file mode 100644 index 00000000..a0924cdc --- /dev/null +++ b/pyconbalkan/core/routers.py @@ -0,0 +1,15 @@ +from rest_framework import routers + + +class DefaultRouter(routers.DefaultRouter): + """ + Extends `DefaultRouter` class to add a method for extending url routes from another router. + """ + def extend(self, router): + """ + Extend the routes with url routes of the passed in router. + + Args: + router: SimpleRouter instance containing route definitions. + """ + self.registry.extend(router.registry) \ No newline at end of file diff --git a/pyconbalkan/core/static/css/style.css b/pyconbalkan/core/static/css/style.css index 8c066fa1..d9bf9cd2 100644 --- a/pyconbalkan/core/static/css/style.css +++ b/pyconbalkan/core/static/css/style.css @@ -185,7 +185,7 @@ ul.countdown li div { } .moveDown { - margin-top: 30px; + margin-top: 50px; } #btnBuyNow { diff --git a/pyconbalkan/core/static/img/userphoto.png b/pyconbalkan/core/static/img/userphoto.png deleted file mode 100644 index 0d0fd634..00000000 Binary files a/pyconbalkan/core/static/img/userphoto.png and /dev/null differ diff --git a/pyconbalkan/core/static/js/timer.js b/pyconbalkan/core/static/js/timer.js index 0a99400b..8f0f69e7 100644 --- a/pyconbalkan/core/static/js/timer.js +++ b/pyconbalkan/core/static/js/timer.js @@ -1,5 +1,5 @@ // Set the date we're counting down to -var countDownDate = new Date("Sep 8, 2018 10:00:00").getTime(); +var countDownDate = new Date("May 15, 2018 00:00:01").getTime(); // Update the count down every 1 second var x = setInterval(function() { diff --git a/pyconbalkan/core/templates/index.html b/pyconbalkan/core/templates/home.html similarity index 56% rename from pyconbalkan/core/templates/index.html rename to pyconbalkan/core/templates/home.html index f086b189..a700f6c6 100644 --- a/pyconbalkan/core/templates/index.html +++ b/pyconbalkan/core/templates/home.html @@ -21,12 +21,37 @@ + + +
@@ -65,28 +90,32 @@Hilton, Kralja Milana 35, 11000 Belgrade Serbia
-8-12 September
-Over 400 Attendees
-International Event
-{{ conference.address }}
+{{ conference.from_date }} - {{ conference.to_date }}
+{{ conference.max_attendees }} attendees
+{{ conference.get_type_display }}
+