Skip to content

Commit a970949

Browse files
author
Kátia Nakamura
authored
Merge pull request #6 from PythonBalkan/katia/conf
Add conference and api and prepare the initial page with dynamic data - add conference model to conference app - add count_down model to conference app - relocate speaker model to speaker app - dynamic home page
2 parents d716fff + c6243be commit a970949

33 files changed

+373
-106
lines changed

pyconbalkan/conference/__init__.py

Whitespace-only changes.

pyconbalkan/conference/admin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.contrib import admin
2+
3+
from pyconbalkan.conference.models import Conference, CountDown
4+
5+
6+
class ConferenceAdmin(admin.ModelAdmin):
7+
class Meta:
8+
model = Conference
9+
10+
11+
class CountDownAdmin(admin.ModelAdmin):
12+
class Meta:
13+
model = CountDown
14+
15+
16+
admin.site.register(Conference, ConferenceAdmin)
17+
admin.site.register(CountDown, CountDownAdmin)

pyconbalkan/conference/api_urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from rest_framework import routers
2+
3+
from pyconbalkan.conference.views import ConferenceViewSet
4+
5+
router = routers.DefaultRouter()
6+
router.register(r'conference', ConferenceViewSet)

pyconbalkan/conference/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ConferenceConfig(AppConfig):
5+
name = 'conference'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.11 on 2018-04-26 21:51
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import django_countries.fields
7+
8+
9+
class Migration(migrations.Migration):
10+
11+
initial = True
12+
13+
dependencies = [
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='Conference',
19+
fields=[
20+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('active', models.BooleanField(default=False)),
22+
('event', models.CharField(blank=True, max_length=100, null=True)),
23+
('name', models.CharField(blank=True, max_length=100, null=True)),
24+
('year', models.PositiveIntegerField()),
25+
('number', models.PositiveIntegerField()),
26+
('city', models.CharField(blank=True, max_length=200, null=True)),
27+
('country', django_countries.fields.CountryField(blank=True, max_length=2, null=True)),
28+
('address', models.TextField(blank=True, null=True)),
29+
('from_date', models.DateField(blank=True, null=True)),
30+
('to_date', models.DateField(blank=True, null=True)),
31+
('max_attendees', models.PositiveIntegerField(blank=True, null=True)),
32+
('type', models.IntegerField(choices=[(0, 'International'), (1, 'National')])),
33+
],
34+
options={
35+
'abstract': False,
36+
},
37+
),
38+
migrations.CreateModel(
39+
name='CountDown',
40+
fields=[
41+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
42+
('active', models.BooleanField(default=False)),
43+
('title', models.CharField(blank=True, max_length=100, null=True)),
44+
('count_down', models.DateTimeField(blank=True, null=True)),
45+
],
46+
options={
47+
'abstract': False,
48+
},
49+
),
50+
]

pyconbalkan/conference/migrations/__init__.py

Whitespace-only changes.

pyconbalkan/conference/models.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from django.db import models
2+
from django_countries.fields import CountryField
3+
4+
from pyconbalkan.core.models import SingleActiveModel
5+
6+
7+
class Conference(SingleActiveModel):
8+
INTERNATIONAL = 0
9+
NATIONAL = 1
10+
CONF_TYPE = (
11+
(INTERNATIONAL, 'International'),
12+
(NATIONAL, 'National'),
13+
)
14+
15+
event = models.CharField(null=True, blank=True, max_length=100)
16+
name = models.CharField(null=True, blank=True, max_length=100)
17+
year = models.PositiveIntegerField()
18+
number = models.PositiveIntegerField()
19+
city = models.CharField(null=True, blank=True, max_length=200)
20+
country = CountryField(null=True, blank=True)
21+
address = models.TextField(null=True, blank=True)
22+
from_date = models.DateField(null=True, blank=True)
23+
to_date = models.DateField(null=True, blank=True)
24+
max_attendees = models.PositiveIntegerField(null=True, blank=True)
25+
type = models.IntegerField(choices=CONF_TYPE)
26+
27+
28+
def __str__(self):
29+
return '{} {} {}'.format(self.event, self.name, self.year)
30+
31+
32+
class CountDown(SingleActiveModel):
33+
title = models.CharField(null=True, blank=True, max_length=100)
34+
count_down = models.DateTimeField(null=True, blank=True)
35+
36+
def __str__(self):
37+
return self.title
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from rest_framework import serializers
2+
3+
from pyconbalkan.conference.models import Conference
4+
5+
6+
class ConferenceSerializer(serializers.ModelSerializer):
7+
class Meta:
8+
model = Conference
9+
fields = '__all__'

pyconbalkan/conference/templates/index.html

Whitespace-only changes.

pyconbalkan/conference/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

0 commit comments

Comments
 (0)