Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
17 changes: 17 additions & 0 deletions pyconbalkan/conference/admin.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions pyconbalkan/conference/api_urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from rest_framework import routers

from pyconbalkan.conference.views import ConferenceViewSet

router = routers.DefaultRouter()
router.register(r'conference', ConferenceViewSet)
5 changes: 5 additions & 0 deletions pyconbalkan/conference/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ConferenceConfig(AppConfig):
name = 'conference'
50 changes: 50 additions & 0 deletions pyconbalkan/conference/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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,
},
),
]
Empty file.
37 changes: 37 additions & 0 deletions pyconbalkan/conference/models.py
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions pyconbalkan/conference/serializers.py
Original file line number Diff line number Diff line change
@@ -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__'
Empty file.
3 changes: 3 additions & 0 deletions pyconbalkan/conference/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
9 changes: 9 additions & 0 deletions pyconbalkan/conference/views.py
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions pyconbalkan/core/admin.py
Original file line number Diff line number Diff line change
@@ -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)
Empty file added pyconbalkan/core/api_urls.py
Empty file.
23 changes: 14 additions & 9 deletions pyconbalkan/core/models.py
Original file line number Diff line number Diff line change
@@ -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")
15 changes: 15 additions & 0 deletions pyconbalkan/core/routers.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pyconbalkan/core/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ ul.countdown li div {
}

.moveDown {
margin-top: 30px;
margin-top: 50px;
}

#btnBuyNow {
Expand Down
Binary file removed pyconbalkan/core/static/img/userphoto.png
Binary file not shown.
2 changes: 1 addition & 1 deletion pyconbalkan/core/static/js/timer.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Loading