Mercurial > public > sg101
comparison downloads/migrations/0001_initial.py @ 1028:5ba2508939f7
Django 1.8 changes; first batch.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 15 Dec 2015 21:01:07 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1027:cd4db27c90e3 | 1028:5ba2508939f7 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 from __future__ import unicode_literals | |
3 | |
4 from django.db import migrations, models | |
5 import downloads.models | |
6 from django.conf import settings | |
7 | |
8 | |
9 class Migration(migrations.Migration): | |
10 | |
11 dependencies = [ | |
12 migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
13 ] | |
14 | |
15 operations = [ | |
16 migrations.CreateModel( | |
17 name='AllowedExtension', | |
18 fields=[ | |
19 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
20 ('extension', models.CharField(help_text=b'e.g. .txt', max_length=8)), | |
21 ], | |
22 options={ | |
23 'ordering': ('extension',), | |
24 }, | |
25 ), | |
26 migrations.CreateModel( | |
27 name='Category', | |
28 fields=[ | |
29 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
30 ('title', models.CharField(max_length=64)), | |
31 ('slug', models.SlugField(max_length=64)), | |
32 ('description', models.TextField(blank=True)), | |
33 ('count', models.IntegerField(default=0, blank=True)), | |
34 ], | |
35 options={ | |
36 'ordering': ('title',), | |
37 'verbose_name_plural': 'Categories', | |
38 }, | |
39 ), | |
40 migrations.CreateModel( | |
41 name='Download', | |
42 fields=[ | |
43 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
44 ('title', models.CharField(max_length=128)), | |
45 ('description', models.TextField()), | |
46 ('html', models.TextField(blank=True)), | |
47 ('file', models.FileField(upload_to=downloads.models.download_path)), | |
48 ('date_added', models.DateTimeField(db_index=True)), | |
49 ('ip_address', models.IPAddressField(verbose_name=b'IP Address')), | |
50 ('update_date', models.DateTimeField(db_index=True, blank=True)), | |
51 ('hits', models.IntegerField(default=0)), | |
52 ('average_score', models.FloatField(default=0.0)), | |
53 ('total_votes', models.IntegerField(default=0)), | |
54 ('is_public', models.BooleanField(default=False, db_index=True)), | |
55 ('category', models.ForeignKey(to='downloads.Category')), | |
56 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
57 ], | |
58 options={ | |
59 'abstract': False, | |
60 }, | |
61 ), | |
62 migrations.CreateModel( | |
63 name='PendingDownload', | |
64 fields=[ | |
65 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
66 ('title', models.CharField(max_length=128)), | |
67 ('description', models.TextField()), | |
68 ('html', models.TextField(blank=True)), | |
69 ('file', models.FileField(upload_to=downloads.models.download_path)), | |
70 ('date_added', models.DateTimeField(db_index=True)), | |
71 ('ip_address', models.IPAddressField(verbose_name=b'IP Address')), | |
72 ('update_date', models.DateTimeField(db_index=True, blank=True)), | |
73 ('category', models.ForeignKey(to='downloads.Category')), | |
74 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
75 ], | |
76 options={ | |
77 'ordering': ('date_added',), | |
78 }, | |
79 ), | |
80 migrations.CreateModel( | |
81 name='VoteRecord', | |
82 fields=[ | |
83 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
84 ('vote_date', models.DateTimeField(auto_now_add=True)), | |
85 ('download', models.ForeignKey(to='downloads.Download')), | |
86 ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
87 ], | |
88 options={ | |
89 'ordering': ('-vote_date',), | |
90 }, | |
91 ), | |
92 ] |