0001_initial.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Generated by Django 3.2.5 on 2021-07-18 10:57
  2. from django.conf import settings
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. import django.utils.timezone
  6. import taggit.managers
  7. class Migration(migrations.Migration):
  8. initial = True
  9. dependencies = [
  10. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  11. ('taggit', '0003_taggeditem_add_unique_index'),
  12. ]
  13. operations = [
  14. migrations.CreateModel(
  15. name='ArticleColumn',
  16. fields=[
  17. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  18. ('title', models.CharField(blank=True, max_length=100)),
  19. ('created', models.DateTimeField(default=django.utils.timezone.now)),
  20. ],
  21. ),
  22. migrations.CreateModel(
  23. name='ArticlePost',
  24. fields=[
  25. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  26. ('title', models.CharField(max_length=100)),
  27. ('summary', models.CharField(max_length=100)),
  28. ('body', models.TextField()),
  29. ('created', models.DateTimeField(default=django.utils.timezone.now)),
  30. ('updated', models.DateTimeField(default=django.utils.timezone.now)),
  31. ('total_views', models.PositiveIntegerField(default=0)),
  32. ('avatar', models.ImageField(blank=True, upload_to='article/%Y%m%d/')),
  33. ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  34. ('column', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='article', to='article.articlecolumn')),
  35. ('tags', taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags')),
  36. ],
  37. options={
  38. 'ordering': ('-created',),
  39. },
  40. ),
  41. ]