annotate downloads/migrations/0001_initial.py @ 1206:02181fa5ac9d modernize tip

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