~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to news/migrations/0001_initial.py

  • Committer: franku
  • Date: 2016-07-02 12:38:06 UTC
  • mfrom: (404.2.56 widelands)
  • Revision ID: somal@arcor.de-20160702123806-q69u3d48s1prrxds
merged the django1_8 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
from __future__ import unicode_literals
 
3
 
 
4
from django.db import models, migrations
 
5
from django.conf import settings
 
6
import news.models
 
7
import tagging.fields
 
8
 
 
9
 
 
10
class Migration(migrations.Migration):
 
11
 
 
12
    dependencies = [
 
13
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
 
14
    ]
 
15
 
 
16
    operations = [
 
17
        migrations.CreateModel(
 
18
            name='Category',
 
19
            fields=[
 
20
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
21
                ('title', models.CharField(max_length=100, verbose_name='title')),
 
22
                ('slug', models.SlugField(unique=True, verbose_name='slug')),
 
23
                ('image', models.ImageField(upload_to=news.models.get_upload_name)),
 
24
            ],
 
25
            options={
 
26
                'ordering': ('title',),
 
27
                'db_table': 'news_categories',
 
28
                'verbose_name': 'category',
 
29
                'verbose_name_plural': 'categories',
 
30
            },
 
31
        ),
 
32
        migrations.CreateModel(
 
33
            name='Post',
 
34
            fields=[
 
35
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
 
36
                ('title', models.CharField(max_length=200, verbose_name='title')),
 
37
                ('slug', models.SlugField(verbose_name='slug', unique_for_date=b'publish')),
 
38
                ('body', models.TextField(verbose_name='body')),
 
39
                ('tease', models.TextField(verbose_name='tease', blank=True)),
 
40
                ('status', models.IntegerField(default=2, verbose_name='status', choices=[(1, 'Draft'), (2, 'Public')])),
 
41
                ('allow_comments', models.BooleanField(default=True, verbose_name='allow comments')),
 
42
                ('publish', models.DateTimeField(verbose_name='publish')),
 
43
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
 
44
                ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')),
 
45
                ('tags', tagging.fields.TagField(max_length=255, blank=True)),
 
46
                ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True)),
 
47
                ('categories', models.ManyToManyField(to='news.Category', blank=True)),
 
48
            ],
 
49
            options={
 
50
                'ordering': ('-publish',),
 
51
                'db_table': 'news_posts',
 
52
                'verbose_name': 'post',
 
53
                'verbose_name_plural': 'posts',
 
54
                'get_latest_by': 'publish',
 
55
            },
 
56
        ),
 
57
    ]