added travel app and docs

This commit is contained in:
Fred Pauchet 2016-05-13 15:24:30 +02:00
parent 8463c1b411
commit 5f48037402
10 changed files with 78 additions and 0 deletions

5
docs/testing.rst Normal file
View File

@ -0,0 +1,5 @@
#######
Testing
#######
* `Testing with Django-Rest-Framework <http://www.django-rest-framework.org/api-guide/testing/>`_.

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'leaflet',
'travel',
]
MIDDLEWARE_CLASSES = [

0
src/travel/__init__.py Normal file
View File

6
src/travel/admin.py Normal file
View File

@ -0,0 +1,6 @@
from django.contrib import admin
from travel.models import Travel, Event
admin.site.register(Travel)
admin.site.register(Event)

5
src/travel/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class TravelConfig(AppConfig):
name = 'travel'

View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-13 08:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Event',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('when', models.DateField()),
('what', models.CharField(max_length=255)),
('order', models.IntegerField()),
],
),
migrations.CreateModel(
name='Travel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.AddField(
model_name='event',
name='travel',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='events', to='travel.Travel'),
),
]

View File

17
src/travel/models.py Normal file
View File

@ -0,0 +1,17 @@
from django.db import models
class Travel(models.Model):
"""
Initialize a new travel.
"""
name = models.CharField(max_length=255)
class Event(models.Model):
"""
The set of event that compose your travel.
"""
when = models.DateField()
what = models.CharField(max_length=255)
order = models.IntegerField()
travel = models.ForeignKey(Travel, related_name='events')

3
src/travel/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
src/travel/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.